From patchwork Tue Nov 5 08:41:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227147 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0112E13BD for ; Tue, 5 Nov 2019 08:42:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9EA7214D8 for ; Tue, 5 Nov 2019 08:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943337; bh=qI6b1pxD7xAMYu0+M0pwP6Z+IO8SSOYTejU/sWV8aIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VHI7Seo400y7rlFdHASkY91G+kYEs8Kx3XUZ6fdXp7zsgsqV2Q2Tgz/4al0mBgiWE Ebks1MXE7W8e5DL+fIcCwuFfijKVXPXMa1SNkrN1GHeXsPgP+JsW2OI01DXHVr2EaS Eg4nts8MRzjqzu+etJATIh3nMPXkiCBgvqFwyxLU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730503AbfKEImR (ORCPT ); Tue, 5 Nov 2019 03:42:17 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:38761 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727727AbfKEImR (ORCPT ); Tue, 5 Nov 2019 03:42:17 -0500 Received: by mail-lj1-f196.google.com with SMTP id v8so5148350ljh.5 for ; Tue, 05 Nov 2019 00:42:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wZk4Kgf43x0wsTQIaAQzLC6Ozn9yJOh3cGXpmzunqSg=; b=YR86Ip0Juc/UOOflAE80yFNPF4AZfHIea/Z1jDWPU43IHy8Hf44rJKyKxTaywt3sDL KNb3l0GltdqzdCnFCWgGWmfKE7OGteP9ta55T/61OjfyNEuSSG6Da/stTcPmmLHg+/3l AUZhsmMTDVpO50yi418wiOtdyayPtnwMgulrvTbX2XHHlPMvx+PbU9BEpIFWZxAuDhF7 wUBsGfqkNQv8ZiIxCYSH85GIr1RUWRwZxsfdijDNLtC6OqpUT5qjAkR2Hrf76HK1iTKe EeK2K5xcuEb3vfQtv1GvJML5axly+Ax+OhqfcH05eIPt4ek8+99mhlRPwsTvCa05RTg/ +7HQ== X-Gm-Message-State: APjAAAUO7sv2lIwDxROpswzk8AKyPPIN7qsVu/nYewX2s+QFW35K63S4 aST4eXpmeVpYDqmMPRlxwGgyKTJr X-Google-Smtp-Source: APXvYqwkgpjTBbUBW9617msa+K0Ov9gVWs9cPXw34P8ijnhPEGxJuW0YhYY8AXrsExjxao46sIYPNw== X-Received: by 2002:a2e:9612:: with SMTP id v18mr21265785ljh.234.1572943334788; Tue, 05 Nov 2019 00:42:14 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id k6sm11739141lfc.72.2019.11.05.00.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:13 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPl-0004GZ-A8; Tue, 05 Nov 2019 09:42:13 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 01/14] USB: legousbtower: drop redundant MODULE_LICENSE ifdef Date: Tue, 5 Nov 2019 09:41:39 +0100 Message-Id: <20191105084152.16322-2-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The MODULE_LICENSE macro is unconditionally defined in module.h, no need to ifdef its use. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 23061f1526b4..1be84dc13067 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -962,6 +962,4 @@ module_usb_driver(tower_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); -#ifdef MODULE_LICENSE MODULE_LICENSE("GPL"); -#endif From patchwork Tue Nov 5 08:41:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227151 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9736513BD for ; Tue, 5 Nov 2019 08:42:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C7E3214D8 for ; Tue, 5 Nov 2019 08:42:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943339; bh=+fND+6UdNqoTLhucFX7tKKW9A6btKWVBbMZeqL9p3rY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HkJa/hP3pNre07/k5KLRhFO3rDfsd8VsK9jCwxhJBfiRV8ovyH2Xxqja9QtxY2ecE WQgk97ucGT3s4gIDIjkZRopabpmKXKEfn+SaCYoqWepPG/sGBM0j/PIAwFvcG9NpB8 woAKIda47XPh8DJI8z8tZZUaq27m4DyNy3uNr55M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730589AbfKEImS (ORCPT ); Tue, 5 Nov 2019 03:42:18 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:37595 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725806AbfKEImS (ORCPT ); Tue, 5 Nov 2019 03:42:18 -0500 Received: by mail-lf1-f68.google.com with SMTP id b20so14447475lfp.4 for ; Tue, 05 Nov 2019 00:42:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tknfyCUeU7j5xp3rtcyYp9kRvyPf5+IPfN/u9AabkZo=; b=qqF374VCS4D1Y/31nnLk3BVYlcUkjs0fPh79hZo9e9myXtRO8O/CgmovNXW4oEoCNC 0OFGLXd5F1XjRL/Mfq9IYZDGdGON/mCodIk4WRg4HfcA26naP1g1lnM+Llo90Fo5QBCK JCEC5IIRiRMCofNd78bXOAwboK7yoNApwkS5RpMNgJcy5DcVeywHg1Zr5RTxC8Lj5XNJ qCO2Xki2itkUrzOSxoZnqSbJ3ZHCqiVN2PP0OHafZ75BPILnB+T18SxjQedrDZQCLHtj ejmPwX2Gnarvzody0fZD5REK+DJzgAE0pDJwTyF+jGcGCfAuQK/Ito3Dzv6GblM6gQbG HKlA== X-Gm-Message-State: APjAAAWYaJDGe/2oG2vo8E6RmpBMcm6SkFUIQO/8eYm1zMDDH7tz+JwY +qKOzZKp60mRcLL+qtVW/kE= X-Google-Smtp-Source: APXvYqzDfuYpWclhM02n8v/BgK/e1l6Tdyl4yGmktuzWSbocDiI4S4imIU8MTWh1rtBz0K0u4tkDKw== X-Received: by 2002:a19:8b54:: with SMTP id n81mr12710499lfd.114.1572943335639; Tue, 05 Nov 2019 00:42:15 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id r9sm797985ljm.7.2019.11.05.00.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:13 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPl-0004Ge-Cn; Tue, 05 Nov 2019 09:42:13 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 02/14] USB: legousbtower: drop redundant NULL check Date: Tue, 5 Nov 2019 09:41:40 +0100 Message-Id: <20191105084152.16322-3-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop redundant NULL check from tower_abort_transfers(), which is never called with a NULL argument. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 1be84dc13067..a3ae843e0a3a 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -457,9 +457,6 @@ static int tower_release (struct inode *inode, struct file *file) */ static void tower_abort_transfers (struct lego_usb_tower *dev) { - if (dev == NULL) - return; - /* shutdown transfer */ if (dev->interrupt_in_running) { dev->interrupt_in_running = 0; From patchwork Tue Nov 5 08:41:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CBFC1850 for ; Tue, 5 Nov 2019 08:42:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2BC4B214D8 for ; Tue, 5 Nov 2019 08:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943340; bh=fNbxmoYwvN7/70/QgCuTU/yJqgDUtGz2OTcSkBN0Vfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IeMHiLPuMgeQiegbmVgSEm6iJlels1m3Nk6qxJOhLMkjw4hYa5rCnKG1RdpciTqai 8/JdxzVDF5EMtYg8OxDArT97vUFvVo0Vw+g4MYvjw+fWdHrsEvqHgo8iQXdHoZDbVD qchuUG4vjXSH17c4+oK7Qk/kSICt3PnG8pWTz5Ok= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730591AbfKEImT (ORCPT ); Tue, 5 Nov 2019 03:42:19 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:33603 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730216AbfKEImT (ORCPT ); Tue, 5 Nov 2019 03:42:19 -0500 Received: by mail-lf1-f68.google.com with SMTP id y127so14440042lfc.0 for ; Tue, 05 Nov 2019 00:42:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6Bog8rvlkwSMxmIHFiC0pn9jqybkql/feL3YCFo2leg=; b=kpiKyIZ/EwA9nIO/4Px5XQ+VymQpWm+Jvl+ID/xUA+c2hEkNG0rJ6w+iNCHlVhDaYP NEKJxQBru5sKj5VC7cyQcyDwZbVc0+Og4EScBB+1ddE3E2xhv+L3vhmVP7SEB08ICTAA 1u1Xpe2Po8k7PlsllsuY4MdzLF7FsM6CbwfXztNpNd0f4+bIE7ACVQhTiwFtMKFaSs+F zlhDS+OUoMyNh0ni1kxZh+wDJFKZp6d3vjMTa/iSwdXtRdjYwT10Lhq/Hn7La2RrLOqk MZAfoXSwDW0qdDc/qNEyRKflYM7I6zOY6EYK/Grf3SjzIdx2OmNFobUTUo0/snw3j3De i6nQ== X-Gm-Message-State: APjAAAW9SsrBCH/m1eEa58bKCxShHnqZxXXAZegD5TXhqF7ps1KKZ0gG 9n3KObYuxxJtKRCvEhemE2YIuKcw X-Google-Smtp-Source: APXvYqwI95lW70LQuZ75a8lOv4FAoISt7q+C0cNE78q1xt1MJQZv/cvFEpgbRy/y1tFBg6jrEF8E4w== X-Received: by 2002:ac2:41d4:: with SMTP id d20mr3209854lfi.24.1572943336133; Tue, 05 Nov 2019 00:42:16 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id 77sm12083227lfj.41.2019.11.05.00.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:13 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPl-0004Gj-FM; Tue, 05 Nov 2019 09:42:13 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 03/14] USB: legousbtower: zero driver data at allocation Date: Tue, 5 Nov 2019 09:41:41 +0100 Message-Id: <20191105084152.16322-4-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Zero the driver data at allocation rather than depend on explicit zeroing, which easy to miss. Also drop an unnecessary driver-data pointer initialisation. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index a3ae843e0a3a..c880d58e8683 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -791,45 +791,24 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device { struct device *idev = &interface->dev; struct usb_device *udev = interface_to_usbdev(interface); - struct lego_usb_tower *dev = NULL; + struct lego_usb_tower *dev; struct tower_get_version_reply *get_version_reply = NULL; int retval = -ENOMEM; int result; /* allocate memory for our device state and initialize it */ - - dev = kmalloc (sizeof(struct lego_usb_tower), GFP_KERNEL); - + dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) goto exit; mutex_init(&dev->lock); - dev->udev = usb_get_dev(udev); - dev->open_count = 0; - dev->disconnected = 0; - - dev->read_buffer = NULL; - dev->read_buffer_length = 0; - dev->read_packet_length = 0; spin_lock_init (&dev->read_buffer_lock); dev->packet_timeout_jiffies = msecs_to_jiffies(packet_timeout); dev->read_last_arrival = jiffies; - init_waitqueue_head (&dev->read_wait); init_waitqueue_head (&dev->write_wait); - dev->interrupt_in_buffer = NULL; - dev->interrupt_in_endpoint = NULL; - dev->interrupt_in_urb = NULL; - dev->interrupt_in_running = 0; - dev->interrupt_in_done = 0; - - dev->interrupt_out_buffer = NULL; - dev->interrupt_out_endpoint = NULL; - dev->interrupt_out_urb = NULL; - dev->interrupt_out_busy = 0; - result = usb_find_common_endpoints_reverse(interface->cur_altsetting, NULL, NULL, &dev->interrupt_in_endpoint, From patchwork Tue Nov 5 08:41:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227149 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5FD8A1986 for ; Tue, 5 Nov 2019 08:42:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 352AA214D8 for ; Tue, 5 Nov 2019 08:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943338; bh=ryCTm6QurYkIzO4Tihr93etCrTPCobpngCOuJKJpcQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kdhdJyrIXPTdZizH7kqybCc7jEKk015hEgFJFwQrfimYDGJngur1i4C0KHSDfGWJf BvITEUyOYUDtbyAnmxTo+JPyJX9ptcTfEW2VgnhdUGi4qIwZlqdu2lXdN5WrqRjZUE YCTzRatK8IhZeu2lZ8O/h8rdsqbPx6VVrN0SxY2U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730569AbfKEImR (ORCPT ); Tue, 5 Nov 2019 03:42:17 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:36597 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730216AbfKEImR (ORCPT ); Tue, 5 Nov 2019 03:42:17 -0500 Received: by mail-lf1-f67.google.com with SMTP id a6so11042228lfo.3 for ; Tue, 05 Nov 2019 00:42:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pBKLGAEBn3bFo9v8fZaHn5v0bK1Fmv0opJnZ/q6PGn4=; b=GpSEBIP6Ja+w0KtRS5M6Oe0Op5ZKKIn83LqSoDQTRdXFbiO4Ihn4BEnm/ivOewLt5V rwiNu8/JUoP//VseLQJz8vpV+9bL4919NNfLljbvBL2kxifwlAKBI3d0Rrprhd3lmAF9 7SPkasJpirieHDE7wgYa56Bv3NF1kp78TisxtVIDrUAC5VpPngTO85GSfDFhQrUzNP5I rEM22qutr420P+M+3PdEwtSu8Ug4hUaSYI6hZX8T8u2IxjEfLmpSY3+BE8OCXKXdUZFs 6uwSTMw3hs9rgc07JPW9PaOgT+/pbvieghVlvJMyJpltbV73VTIoX6R43KumxenolMNo 22fA== X-Gm-Message-State: APjAAAWjZ240rLTqZcn/eG0X/rFgXECJcZZ1+dD7xkISaShnrMbxuovc nr/DcHjxjnQHcc8++P1C5/M= X-Google-Smtp-Source: APXvYqxFh5G7YO8VnyTtbKEgNIzRKRsL93c+ZWFpTomh31gQzN9EXmXECNSi0Ln8q/1CMOlEXlY09g== X-Received: by 2002:a19:2356:: with SMTP id j83mr19632749lfj.103.1572943334993; Tue, 05 Nov 2019 00:42:14 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id f1sm7522068ljk.77.2019.11.05.00.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:14 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPl-0004Go-Hq; Tue, 05 Nov 2019 09:42:13 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 04/14] USB: legousbtower: drop redundant open_count check Date: Tue, 5 Nov 2019 09:41:42 +0100 Message-Id: <20191105084152.16322-5-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop redundant open_count check in release; the open count is used as a flag and is only set to 0 or 1. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index c880d58e8683..1626a0d2b12b 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -421,13 +421,6 @@ static int tower_release (struct inode *inode, struct file *file) mutex_lock(&dev->lock); - if (dev->open_count != 1) { - dev_dbg(&dev->udev->dev, "%s: device not opened exactly once\n", - __func__); - retval = -ENODEV; - goto unlock_exit; - } - if (dev->disconnected) { /* the device was unplugged before the file was released */ @@ -444,7 +437,6 @@ static int tower_release (struct inode *inode, struct file *file) tower_abort_transfers (dev); dev->open_count = 0; -unlock_exit: mutex_unlock(&dev->lock); exit: return retval; From patchwork Tue Nov 5 08:41:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227155 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACD35112B for ; Tue, 5 Nov 2019 08:42:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 81A82217F4 for ; Tue, 5 Nov 2019 08:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943341; bh=620PQjlVkST0TQJeIOHlzwWo2J69lbPWi0jZhr6Vrfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kvoLqxHHzUdPsEVzw+qCCR4OLgAYFTkh3MxNjxiU3Oeodyve7Kajw0ZWKGwbFrkcP VpOog6gw3pVHnA+riq2WOeRETvSZD+dWgvBC4II5qmJYDdaj5qoYtuvMq20563bapL YKP6PRuiLgTbVSwHJueezjZvpbAZQ3TNI2J/fPYc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730596AbfKEImV (ORCPT ); Tue, 5 Nov 2019 03:42:21 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:41341 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725806AbfKEImU (ORCPT ); Tue, 5 Nov 2019 03:42:20 -0500 Received: by mail-lf1-f65.google.com with SMTP id j14so14437890lfb.8 for ; Tue, 05 Nov 2019 00:42:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+y8cUxoGzN6GT+mRGiWu/EU5YAXI4AEu0RK/ayv8Mzo=; b=lSalObbKrUQfZXLOHSbPUC8a9TyjTxoHX7biwrXi9Q+pQX1tYdIbkwC5ok16y7gsvV QSF9ZosCq4JptmRMGCCsY5/2wBoBnWMM2HDllLNwWBSAe2PakGciKrlILcqrRlY0rpEZ PZrgBKur6p79wRCtLmbwImPLke52eVTYkqL46LAfWGB7D56pXy6HnijhoZT7wpYn6fXd M5xY3Np9Tmwm7E5z8B4WaoUTAwhMbFTqkO4Y8aEXwz6ajw96HctzlemcHaOm63HzgnYa v5wf88HMgqSiiUp3f52oihdNARw+bCtxJiY0Gif8SLSwkv7FeP8POyMIK55gdRxL9I9I MO+g== X-Gm-Message-State: APjAAAVpb0LUdh0VX5v9fAF3cu0hLVsafDGs6xqXg4AB1//syiLvLxL9 E1qzESWNo72zhCnlIkQ84c0= X-Google-Smtp-Source: APXvYqw+/uLoaa+YyTOAY/EWNxbzIl84fDJlAXanBGZYbfmO549ozVBy6Qvfz9xutpXHFpm1SZYyEQ== X-Received: by 2002:a19:7511:: with SMTP id y17mr20371577lfe.19.1572943338023; Tue, 05 Nov 2019 00:42:18 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id f30sm7766470ljp.66.2019.11.05.00.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:16 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPl-0004Gt-Kr; Tue, 05 Nov 2019 09:42:13 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 05/14] USB: legousbtower: drop noisy disconnect messages Date: Tue, 5 Nov 2019 09:41:43 +0100 Message-Id: <20191105084152.16322-6-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org User space already sees -ENODEV in case it tries to do I/O post disconnect, no need to spam the logs with printk messages that don't even include any device-id information. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 1626a0d2b12b..937bce23adf0 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -540,7 +540,6 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, /* verify that the device wasn't unplugged */ if (dev->disconnected) { retval = -ENODEV; - pr_err("No device or device unplugged %d\n", retval); goto unlock_exit; } @@ -626,7 +625,6 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t /* verify that the device wasn't unplugged */ if (dev->disconnected) { retval = -ENODEV; - pr_err("No device or device unplugged %d\n", retval); goto unlock_exit; } From patchwork Tue Nov 5 08:41:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227163 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B502113BD for ; Tue, 5 Nov 2019 08:42:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9387C214D8 for ; Tue, 5 Nov 2019 08:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943343; bh=/TMwdZevNhFDsi32uR/vDrp9Uvv6R6gqODMMSwArGwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dQr2n6XQwxs5Wn348pcR5xBua0MrYHx3CPjKE22bF25Z0AN8K9g5cNHc2Mm/K5tMl WX8r7X+Pq/RY20fM9dyCd5/WsH/MZs7hfMkHgryqIPOQrQIG2nAn4cEE+PaQpwQ5mk NVD46ajSPyCpt6XTtp7NG+O2/BBjxcft5J/uEHR0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730603AbfKEImX (ORCPT ); Tue, 5 Nov 2019 03:42:23 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:38773 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725806AbfKEImW (ORCPT ); Tue, 5 Nov 2019 03:42:22 -0500 Received: by mail-lj1-f196.google.com with SMTP id v8so5148690ljh.5 for ; Tue, 05 Nov 2019 00:42:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nHDduFicuwITdkRhyKQcLW+FICHjtimOFQjrgu0AoZ0=; b=XFgcATtVHvlebmYdJRblBNwLzP1il4JPSCalr/VoH5ALscxVelToDmg1wttCYkmRVB YPQ4gNEZ76kxyKB/L7Kbype8O2Sm6SUNLr7HzwQWQlGpJkcJrIHCWlCxDjbIjM2+yXFm 3tqCvEvKvxYXwJM3yGqziTbZL362sHTSIW7HLcgyYEnQISv+AMAWIgjBsyp4n0leq1R+ uV8Kt2gAyOBRcKOGIfBuuRYGqWjTVWn6qBmAm0dgUFnXan4lprHZJn5MfsddPaOGrC6Z U5WzLKsCrbsDXZIa4rBq53G+TlEnuTgG3Dh6TBo5fxj3BmqTNHjg7P9uAOvLfjGIwe8x FZ+g== X-Gm-Message-State: APjAAAX4eiiDvALDedD5MOPJWOAR+/1hb2PPE4wdOFU5PpFT/sCrbkJO 91Qc7BKOMeCvgVxcRwZA2ho= X-Google-Smtp-Source: APXvYqyFv6t7qRnt3va/sH9X3CisMyp6F4FS9Up1CvI00Sm8nEmKybgptCUYBOPrXJq6yTlQ6Df/+A== X-Received: by 2002:a2e:2e10:: with SMTP id u16mr18614154lju.51.1572943340390; Tue, 05 Nov 2019 00:42:20 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id g2sm7648633lfc.37.2019.11.05.00.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:16 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPl-0004Gz-Nq; Tue, 05 Nov 2019 09:42:13 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 06/14] USB: legousbtower: drop redundant interrupt-in running flag Date: Tue, 5 Nov 2019 09:41:44 +0100 Message-Id: <20191105084152.16322-7-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop the redundant interrupt-in-running flag, which tried to keep track of when the interrupt-in URB was in flight. This isn't needed since we can stop the URB unconditionally in tower_abort_transfers() and the URB can not be submitted while usb_kill_urb() is running anyway. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 937bce23adf0..33533faa019e 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -206,7 +206,6 @@ struct lego_usb_tower { struct usb_endpoint_descriptor* interrupt_in_endpoint; struct urb* interrupt_in_urb; int interrupt_in_interval; - int interrupt_in_running; int interrupt_in_done; char* interrupt_out_buffer; @@ -379,7 +378,6 @@ static int tower_open (struct inode *inode, struct file *file) dev, dev->interrupt_in_interval); - dev->interrupt_in_running = 1; dev->interrupt_in_done = 0; mb(); @@ -387,7 +385,6 @@ static int tower_open (struct inode *inode, struct file *file) if (retval) { dev_err(&dev->udev->dev, "Couldn't submit interrupt_in_urb %d\n", retval); - dev->interrupt_in_running = 0; goto unlock_exit; } @@ -450,11 +447,7 @@ static int tower_release (struct inode *inode, struct file *file) static void tower_abort_transfers (struct lego_usb_tower *dev) { /* shutdown transfer */ - if (dev->interrupt_in_running) { - dev->interrupt_in_running = 0; - mb(); - usb_kill_urb(dev->interrupt_in_urb); - } + usb_kill_urb(dev->interrupt_in_urb); if (dev->interrupt_out_busy) usb_kill_urb(dev->interrupt_out_urb); } @@ -731,15 +724,11 @@ static void tower_interrupt_in_callback (struct urb *urb) } resubmit: - /* resubmit if we're still running */ - if (dev->interrupt_in_running) { - retval = usb_submit_urb (dev->interrupt_in_urb, GFP_ATOMIC); - if (retval) - dev_err(&dev->udev->dev, - "%s: usb_submit_urb failed (%d)\n", - __func__, retval); + retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC); + if (retval) { + dev_err(&dev->udev->dev, "%s: usb_submit_urb failed (%d)\n", + __func__, retval); } - exit: dev->interrupt_in_done = 1; wake_up_interruptible (&dev->read_wait); From patchwork Tue Nov 5 08:41:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227157 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40F041850 for ; Tue, 5 Nov 2019 08:42:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 15E4E214D8 for ; Tue, 5 Nov 2019 08:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943342; bh=fBCY4G/lx19J4B3zugjQxlH5ahHSyhJeif2aiPLh+fI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DrvfwR4dSr9Z9XKysJ+kog8u2Zjvanzx52aSOGMWjm8dmgkk+og/8TkwQvnMbYi/T RXvZxTiOPn1Zj9uJuLtY2MPUuuKF25W7VkQTCXUL2oM/V/o50dQkA99Y4Q5qQ/+BZ0 jMeYhP96b44EH3PqbAedEKR3j/R3ZybjLJw27YyA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730545AbfKEImV (ORCPT ); Tue, 5 Nov 2019 03:42:21 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:45330 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730216AbfKEImV (ORCPT ); Tue, 5 Nov 2019 03:42:21 -0500 Received: by mail-lf1-f66.google.com with SMTP id v8so14405148lfa.12 for ; Tue, 05 Nov 2019 00:42:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=afgTwGT7brsAeSuOhWRZ7IqDVxGWSNG4jsxiRPhaQaE=; b=QAq6lsEriyCxG5sZ+g4sguFSiIbckvgL91HeiPNQIBVWVKGI1JEoBoPj50PCvoY4+7 F4YWlWyYTEAT6oqerGs707Xe6S1FokI27cpL1xM7GKEeSDMUeCFTFgfRhfbHXN2e+G4Z 3TSqN6SjP2CDcmNeEFMOYNtrgSV40AqfwbLo1/7UzyP82YXatZS/fwB3iz+P5MvhCYGx k6O19VHxHhpLw0+87TJHUZtmkI/uf3ttnPBR9Gr01MBMrgQLiYugmv+mORGxzjjz3BKL +URprfNalgzm9AJNg4YN0vr+n3QFiwqomshtK1kEdYCeRUBLWuueWxJGONqSDJ+jR2dC 5Oog== X-Gm-Message-State: APjAAAU5m2zfIRSgF/vgmX/uNQa7WbkxauqsIiA6B3EkIxpfpzpBON9N CL7jy9qIlo0hm46xN3q4UuM= X-Google-Smtp-Source: APXvYqz6voU62owE/+PeCh7//o9mb3l6X8QWXCzgYNJwXxxh+IiFGiA9+k55ftLmaPqgrjx+zLe2Yw== X-Received: by 2002:a19:c6d6:: with SMTP id w205mr18235575lff.17.1572943338396; Tue, 05 Nov 2019 00:42:18 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id r9sm798017ljm.7.2019.11.05.00.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:16 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPl-0004H3-QJ; Tue, 05 Nov 2019 09:42:13 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 07/14] USB: legousbtower: stop interrupt-out URB unconditionally Date: Tue, 5 Nov 2019 09:41:45 +0100 Message-Id: <20191105084152.16322-8-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Stop also the interrupt-out URB unconditionally in tower_abort_transfers() which is called from release() (for connected devices). Calling usb_kill_urb() for an idle URB is perfectly fine. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 33533faa019e..3e409dfe172c 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -448,8 +448,7 @@ static void tower_abort_transfers (struct lego_usb_tower *dev) { /* shutdown transfer */ usb_kill_urb(dev->interrupt_in_urb); - if (dev->interrupt_out_busy) - usb_kill_urb(dev->interrupt_out_urb); + usb_kill_urb(dev->interrupt_out_urb); } From patchwork Tue Nov 5 08:41:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227159 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E2A9112B for ; Tue, 5 Nov 2019 08:42:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C51C214D8 for ; Tue, 5 Nov 2019 08:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943342; bh=WeuP2zhuHrfHVQoKml+rR3X93/RRVD+t5xSB6VysUHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ahtDyt4lQDHpZl0/sk+hjdhLhOn8fHVS4OlFsafyRz/2rVTRX36+gamP0bNk1Xv9g 0c3BHD20vt/Jwg8mWIJ3kOoAZ/9wIp3vIHupf05fJZhlF33NIJxpggXsH4cpKJ7Kfd 71uomtXxIh9ynN7vM5bE5AKxGiXRTHezCnxexhP4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730599AbfKEImV (ORCPT ); Tue, 5 Nov 2019 03:42:21 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45337 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730590AbfKEImV (ORCPT ); Tue, 5 Nov 2019 03:42:21 -0500 Received: by mail-lj1-f193.google.com with SMTP id n21so7179484ljg.12 for ; Tue, 05 Nov 2019 00:42:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WVWQPUbkIxY8XxpQYbclm3TtPtetfRjLFXAjnV3l8xA=; b=b5jNeqEZ++21ut1H8jNPGP5PNl7AFC1+6ceIq1Jn3DZpjVJv0NHOGNu2XUzexL1yYh LCvE/wriq7nnix0hJJcqbqTCg6mieWiwAn9yjvbWTR2PZGNSIVY94QthTOr1vMTVZZ/l dgwLsHU44FRCQl0/mZos0RJ3vB622PJqeMx5dlpzsUw7NKKv+j31seva5MbFmqhAFJba ELlbpKHTk2bJ8DJwH+Xt+pRgV9VnJmEzSx5/Sh7GBoLYNgCXHyz5gN7U4RS0ZBInVDCq pvm8nnzNc2Mh0TsXfyXyoL9jabNrZy7Qgh4L+BNilo/l0dJEUDSxneG1pPOgHxSbghyu X7IQ== X-Gm-Message-State: APjAAAUmjvxrHhaQfGheWBOLu18rB9tz5ychChqGOw5p8SR7Ns4wCSEN hpda1YHsTuEAH0Ba6nxxF9E= X-Google-Smtp-Source: APXvYqyXrlV+M4k0NCRvY46xl69aK07r0Xvm9EdOFtFon/LangEVdycZ2ad3+0gkN4kpTgj/30U32A== X-Received: by 2002:a2e:82cd:: with SMTP id n13mr21640691ljh.116.1572943339331; Tue, 05 Nov 2019 00:42:19 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id 30sm8784026lju.52.2019.11.05.00.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:16 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPl-0004H8-TQ; Tue, 05 Nov 2019 09:42:13 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 08/14] USB: legousbtower: remove tower_abort_transfers() Date: Tue, 5 Nov 2019 09:41:46 +0100 Message-Id: <20191105084152.16322-9-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop the tower_abort_transfers() function which is now only called from release and instead explicitly kill the two URBs. This incidentally also fixes the outdated comment about freeing memory. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 3e409dfe172c..f85b6ed2fb8b 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -226,7 +226,6 @@ static int tower_release (struct inode *inode, struct file *file); static __poll_t tower_poll (struct file *file, poll_table *wait); static loff_t tower_llseek (struct file *file, loff_t off, int whence); -static void tower_abort_transfers (struct lego_usb_tower *dev); static void tower_check_for_read_packet (struct lego_usb_tower *dev); static void tower_interrupt_in_callback (struct urb *urb); static void tower_interrupt_out_callback (struct urb *urb); @@ -431,7 +430,11 @@ static int tower_release (struct inode *inode, struct file *file) if (dev->interrupt_out_busy) { wait_event_interruptible_timeout (dev->write_wait, !dev->interrupt_out_busy, 2 * HZ); } - tower_abort_transfers (dev); + + /* shutdown transfers */ + usb_kill_urb(dev->interrupt_in_urb); + usb_kill_urb(dev->interrupt_out_urb); + dev->open_count = 0; mutex_unlock(&dev->lock); @@ -439,19 +442,6 @@ static int tower_release (struct inode *inode, struct file *file) return retval; } - -/** - * tower_abort_transfers - * aborts transfers and frees associated data structures - */ -static void tower_abort_transfers (struct lego_usb_tower *dev) -{ - /* shutdown transfer */ - usb_kill_urb(dev->interrupt_in_urb); - usb_kill_urb(dev->interrupt_out_urb); -} - - /** * tower_check_for_read_packet * From patchwork Tue Nov 5 08:41:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227165 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 73B991850 for ; Tue, 5 Nov 2019 08:42:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 51CC1214D8 for ; Tue, 5 Nov 2019 08:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943344; bh=rW7PwG+abjWGJAPuYkwIEaqLYJPPKo1YbFtVqmdxkNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=eD59X9XOFmG0cJYCnUZcrpfuQLKEf0e+vXlw7IjZoNGTVENoxZQ7++mwj079pxCuv 2c7ATrJRvPyAwesssbxyVUAqYz3nAaClL1oWbqkbupVoZ+5FI55Yy0mejuj9d+cXFw ndatmGL6iPGxeQbHRTuJqtq/2YGMhAOFqb/FpgWI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730605AbfKEImX (ORCPT ); Tue, 5 Nov 2019 03:42:23 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45345 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730600AbfKEImX (ORCPT ); Tue, 5 Nov 2019 03:42:23 -0500 Received: by mail-lj1-f196.google.com with SMTP id n21so7179631ljg.12 for ; Tue, 05 Nov 2019 00:42:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ERFUKff5h8q5nbebLz28a5tfExWrZYctDruZlj5SbFM=; b=lzzFz1Peew6hwFclhH9SMjVFPLRrI1Rrobfy2KxQqa2ZYMPQQvrtTBs/K7uISQMu2e VkL0lHH8k7YWFAqUb07fwzC/LdyqD7ijlx3/uaegVGke/Zu20SBtQz77VncjfaMwlodh x4wpwIU4sONEBmGVRh8Har3Tw7SJp1IlhQZ9tzbm7J7hHLr6zU8roNvWjDIo51pD5B+D zCHePht1+oYXAHJOL0UPb/zfHXfBTyQ7LPig9a+qj/XSE7zWOeqZ7pkl0OFJxKr/1m6X QMDKfHhCvPHngGJqXS+h4JHNiIfOAyQf/QlgRMvb5SVNF31zMehqn7zjTnA3zwA1svP2 aAnQ== X-Gm-Message-State: APjAAAW86mcj7P1zbO3kLd1dthNLAFzyWpdFkgetld4Vr2DJ1L9nZmqO ZP9LnOskGc5UNJM70KtQt8A= X-Google-Smtp-Source: APXvYqxNwQSNgQ+zs+1jA+5HRNQNAJ3dSHGNHq5cYi7X7agKKs139a3yRrZj7QSNnSxnYwYIZ8MTEg== X-Received: by 2002:a2e:8694:: with SMTP id l20mr22053739lji.64.1572943341401; Tue, 05 Nov 2019 00:42:21 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id v6sm13894861ljd.15.2019.11.05.00.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:16 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPm-0004HD-0M; Tue, 05 Nov 2019 09:42:14 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 09/14] USB: legousbtower: clean up pointer declarations in driver data Date: Tue, 5 Nov 2019 09:41:47 +0100 Message-Id: <20191105084152.16322-10-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Clean up the pointer declarations in the driver data, whose style wasn't even consistent with the rest of the driver. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index f85b6ed2fb8b..c8ed8792b931 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -186,13 +186,13 @@ MODULE_DEVICE_TABLE (usb, tower_table); /* Structure to hold all of our device specific stuff */ struct lego_usb_tower { struct mutex lock; /* locks this structure */ - struct usb_device* udev; /* save off the usb device pointer */ + struct usb_device *udev; /* save off the usb device pointer */ unsigned char minor; /* the starting minor number for this device */ int open_count; /* number of times this port has been opened */ unsigned long disconnected:1; - char* read_buffer; + char *read_buffer; size_t read_buffer_length; /* this much came in */ size_t read_packet_length; /* this much will be returned on read */ spinlock_t read_buffer_lock; @@ -202,15 +202,15 @@ struct lego_usb_tower { wait_queue_head_t read_wait; wait_queue_head_t write_wait; - char* interrupt_in_buffer; - struct usb_endpoint_descriptor* interrupt_in_endpoint; - struct urb* interrupt_in_urb; + char *interrupt_in_buffer; + struct usb_endpoint_descriptor *interrupt_in_endpoint; + struct urb *interrupt_in_urb; int interrupt_in_interval; int interrupt_in_done; - char* interrupt_out_buffer; - struct usb_endpoint_descriptor* interrupt_out_endpoint; - struct urb* interrupt_out_urb; + char *interrupt_out_buffer; + struct usb_endpoint_descriptor *interrupt_out_endpoint; + struct urb *interrupt_out_urb; int interrupt_out_interval; int interrupt_out_busy; From patchwork Tue Nov 5 08:41:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227167 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE88C112B for ; Tue, 5 Nov 2019 08:42:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2926217F4 for ; Tue, 5 Nov 2019 08:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943344; bh=Rt/YKIVauE0uSq0JBakBJKtQjz/E4mSldOOwnhAWWJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yXHtAodCeR+ePkZR1UIMLzmHPxDfynMIEMTbUGww10Z/pktW1KLJFPr9xwW0zeZIv b/2FdysvL1DvjQmQ1L6eqFa5vXVt7BjJuRuwwhIMAcI8s6iAmDFYme87X3SeNP49i9 K//Odq910/neBu0KahWD0pIqIWf6Acyl2hQBPfZ0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730606AbfKEImY (ORCPT ); Tue, 5 Nov 2019 03:42:24 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:36787 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730598AbfKEImX (ORCPT ); Tue, 5 Nov 2019 03:42:23 -0500 Received: by mail-lj1-f196.google.com with SMTP id k15so8683545lja.3 for ; Tue, 05 Nov 2019 00:42:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9FGG4dglC3msTlS8STfdQNYtPuiJ0zY4sPHcmwh6jRs=; b=Eocq4o1RahmI7xBGGi0LeANkfveIawsDDeNNcW5XPt/naKlIeRy8DAw9bbEybe8vfS Bq6pgaOgM7zwS6zd+aKMNJu2tsR/RW3HjOUkwbD5Q1xVCpuHfUGo0Krcygo0CEENf5ZE Q/oMv9WszGRESRA6+TVqGZ8P5+fAKk/6M0TlYr4WbCuUgDxF5H8/mJbFGJq4uM98rqUK zYpBptoqAQKaJ6gXr6mbxXCDnzH46ftLPlG8S48kmqN+LBsBKn44YYz1UY/QZh4LwQnX vBDeOf921FGp2Oy+aIenZF5zdOZ6SJy6X8XD+GE/cYpM4ah8FSV4bRLcwQdFhnjZ0ZYn Pbzw== X-Gm-Message-State: APjAAAXJuR8cpgcCr3D5TbDGT5AlTDD8htgx36cojyZHpfxdaA3ghmnU x+zaaXZCUcAKkv66BOqCpWk= X-Google-Smtp-Source: APXvYqygwxb2D1xl43Cz84w4im/t+p33xSopFYwcx//EojMuwkuMfwbG/Jwrs11Y45whh2Kfm+REnA== X-Received: by 2002:a05:651c:20f:: with SMTP id y15mr6896085ljn.31.1572943340828; Tue, 05 Nov 2019 00:42:20 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id v21sm7793111lfi.74.2019.11.05.00.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:16 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPm-0004HI-3J; Tue, 05 Nov 2019 09:42:14 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 10/14] USB: legousbtower: drop unnecessary packed attributes Date: Tue, 5 Nov 2019 09:41:48 +0100 Message-Id: <20191105084152.16322-11-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop the packed attributes from the two message structs whose fields are naturally aligned and do not have any padding. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index c8ed8792b931..a9b08468a302 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -160,7 +160,7 @@ struct tower_reset_reply { __le16 size; /* little-endian */ __u8 err_code; __u8 spare; -} __attribute__ ((packed)); +}; struct tower_get_version_reply { __le16 size; /* little-endian */ @@ -169,7 +169,7 @@ struct tower_get_version_reply { __u8 major; __u8 minor; __le16 build_no; /* little-endian */ -} __attribute__ ((packed)); +}; /* table of devices that work with this driver */ From patchwork Tue Nov 5 08:41:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227169 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B9F98112B for ; Tue, 5 Nov 2019 08:42:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F600214D8 for ; Tue, 5 Nov 2019 08:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943345; bh=pVBtEwa9n/o/QLSZFvhifOF5e0rpzS1BXOySaUDAHqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=llY56SfvGzHvebxugdI4PM0OCXJGpgjLMYGyjVxoCSJ0Taiq0AG9mbo2w6MfvdNDa qQkRcsyRXgt8asea9ilEoKPBOzqV4/r1fbMTBzC89ewkCMS3bHF8LUrvFA+0nWM4b+ lMA55eMThBOMVQ1m3SUiYSDThu1PNoItC2kniiUg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730607AbfKEImZ (ORCPT ); Tue, 5 Nov 2019 03:42:25 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36787 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730541AbfKEImY (ORCPT ); Tue, 5 Nov 2019 03:42:24 -0500 Received: by mail-lj1-f193.google.com with SMTP id k15so8683643lja.3 for ; Tue, 05 Nov 2019 00:42:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+JzbMSGY3jZ4WIZf1NkEJrGRGPRKMC+8wvHR7emZd58=; b=LEe+aPIsU5d+7d1WLDDDcWve1bRO3014+rWNMtGMeOjejjMZprbTgkiy/ER7hkKW77 TnnY/5xf4HbzlfYOSzmX9EMEf4u0Sg40S9hP9w/uW2c6dmEHKyJDj/I/5qHR6FCHS9Ey miPtnwBj/KzrsstLU90so/RmqnwAnNtVuZ1ko+1v5PShc9KnKZ1/4ssIOkbgcNACkKGw FyjD0XDszrUKCxQ/VN3z/lJ2MLGgLrxJwTP3sF0JjUhz3mvIIhrgJb31wa1/cymOCxnn Im4S4r3NTtomG7pSKbc0J6B2yXJjQGMJ+shmctwydXGAB/Q1FxO/C3Pk7a5hkPGOvI/S tHZQ== X-Gm-Message-State: APjAAAXJcHbmlJw6Y4Rpm81XQUxrZfjisu6gD70MzR1g3xvZmaLp/6fQ 3JR7klE/RcW3XRk7TtRJszCmCBqm X-Google-Smtp-Source: APXvYqwHvuM6GHr3OfyUmMNbLhuwGn/OPKX0zqIsMhtM487o2ZzwhtstDihmMsiVj+FPV376CrejSQ== X-Received: by 2002:a2e:b54d:: with SMTP id a13mr12909864ljn.4.1572943341842; Tue, 05 Nov 2019 00:42:21 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id b4sm8179464ljp.84.2019.11.05.00.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:16 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPm-0004HN-6O; Tue, 05 Nov 2019 09:42:14 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 11/14] USB: legousbtower: drop redundant endianness comments Date: Tue, 5 Nov 2019 09:41:49 +0100 Message-Id: <20191105084152.16322-12-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The endianness is already encoded in the type specifier so drop the redundant little-endian comments from the message structs. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index a9b08468a302..03f6861dfdf0 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -157,18 +157,18 @@ MODULE_PARM_DESC(interrupt_out_interval, "Interrupt out interval in ms"); #define LEGO_USB_TOWER_REQUEST_GET_VERSION 0xFD struct tower_reset_reply { - __le16 size; /* little-endian */ + __le16 size; __u8 err_code; __u8 spare; }; struct tower_get_version_reply { - __le16 size; /* little-endian */ + __le16 size; __u8 err_code; __u8 spare; __u8 major; __u8 minor; - __le16 build_no; /* little-endian */ + __le16 build_no; }; From patchwork Tue Nov 5 08:41:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 10C1016B1 for ; Tue, 5 Nov 2019 08:55:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D16D5214D8 for ; Tue, 5 Nov 2019 08:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572944100; bh=55GGgaQ7cfEqlvlFrZtBlh622r6j/5hZDkzetMCA/nQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OFvVywuV1Vfg+e8UYoEGXBkMppgR7HkKUVcTS9PxyeUKYyAajI9wxHBVl9crX51h0 i6fMzWVhPLKxeWEn7647Mvo7wIcaAnzU35PN1L59y9RRxH+7bVWynd61i0Yej7XYc9 PWt3QUsZT3eXUMR9//iU3qzNE3OER9k1SGhkpQn8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730598AbfKEIy7 (ORCPT ); Tue, 5 Nov 2019 03:54:59 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35506 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729765AbfKEIy7 (ORCPT ); Tue, 5 Nov 2019 03:54:59 -0500 Received: by mail-lj1-f193.google.com with SMTP id r7so12155160ljg.2 for ; Tue, 05 Nov 2019 00:54:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ic/kEOrz0fwI+otK/llrQ6E9mGG2r2a84ncZkZRXbmk=; b=h1qgw/seqTTiEZqeNsXMYKm9t8XD0VV2ATXaYSm5bIrKNa9T6D2kXFaVwHuxEjEhh7 8vtIJObIMbXS95ICxTaIU/fmSN4i/qJfrQtzkjOKJxz90PR+H63HInM7alLZl35ne5RF TDQKxSPKxBIxrIXqQd+kW/SMwK+SQxXuMtmV4bNSGC+r4xMY8XfBvvRLkb55hLeiaEEU bW+qYMSZKfhT4+4svENabV1hbNdSuMoRJsq3dTzGrML2ma1pnoA0G4McjzZPyFG0WadW M9S782TOezEmQHsI6Y3foIexJ1PNbIYV9H2pp7+FnhY0m/VByesz1unP8VCJOeSMlb/j 4wKw== X-Gm-Message-State: APjAAAXj+hSkYxupzZrxwK11TWjcCaIYfka5w/9Cc8enNR+sTkt57ECy JMNMmC4tKfHCCr0uiDaxgP8= X-Google-Smtp-Source: APXvYqy65rRe/KSmzdlPqPAd4rXcX6U7wy/qmp25teCdF5ooOh/mYp0QG0rv40CeGJ5DK3CudgQkuQ== X-Received: by 2002:a2e:b4ba:: with SMTP id q26mr21996146ljm.60.1572944094925; Tue, 05 Nov 2019 00:54:54 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id q15sm7684540lfb.84.2019.11.05.00.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:54:54 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPm-0004HT-9j; Tue, 05 Nov 2019 09:42:14 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 12/14] USB: legousbtower: clean up runaway white space Date: Tue, 5 Nov 2019 09:41:50 +0100 Message-Id: <20191105084152.16322-13-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop space between function identifiers and opening parenthesis, which was no longer even used consistently within the driver. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 172 ++++++++++++++++---------------- 1 file changed, 87 insertions(+), 85 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 03f6861dfdf0..6f34b3802332 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -178,7 +178,7 @@ static const struct usb_device_id tower_table[] = { { } /* Terminating entry */ }; -MODULE_DEVICE_TABLE (usb, tower_table); +MODULE_DEVICE_TABLE(usb, tower_table); #define LEGO_USB_TOWER_MINOR_BASE 160 @@ -218,20 +218,20 @@ struct lego_usb_tower { /* local function prototypes */ -static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, loff_t *ppos); -static ssize_t tower_write (struct file *file, const char __user *buffer, size_t count, loff_t *ppos); -static inline void tower_delete (struct lego_usb_tower *dev); -static int tower_open (struct inode *inode, struct file *file); -static int tower_release (struct inode *inode, struct file *file); -static __poll_t tower_poll (struct file *file, poll_table *wait); -static loff_t tower_llseek (struct file *file, loff_t off, int whence); +static ssize_t tower_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos); +static ssize_t tower_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos); +static inline void tower_delete(struct lego_usb_tower *dev); +static int tower_open(struct inode *inode, struct file *file); +static int tower_release(struct inode *inode, struct file *file); +static __poll_t tower_poll(struct file *file, poll_table *wait); +static loff_t tower_llseek(struct file *file, loff_t off, int whence); -static void tower_check_for_read_packet (struct lego_usb_tower *dev); -static void tower_interrupt_in_callback (struct urb *urb); -static void tower_interrupt_out_callback (struct urb *urb); +static void tower_check_for_read_packet(struct lego_usb_tower *dev); +static void tower_interrupt_in_callback(struct urb *urb); +static void tower_interrupt_out_callback(struct urb *urb); -static int tower_probe (struct usb_interface *interface, const struct usb_device_id *id); -static void tower_disconnect (struct usb_interface *interface); +static int tower_probe(struct usb_interface *interface, const struct usb_device_id *id); +static void tower_disconnect(struct usb_interface *interface); /* file operations needed when we register this driver */ @@ -286,23 +286,23 @@ static inline void lego_usb_tower_debug_data(struct device *dev, /** * tower_delete */ -static inline void tower_delete (struct lego_usb_tower *dev) +static inline void tower_delete(struct lego_usb_tower *dev) { /* free data structures */ usb_free_urb(dev->interrupt_in_urb); usb_free_urb(dev->interrupt_out_urb); - kfree (dev->read_buffer); - kfree (dev->interrupt_in_buffer); - kfree (dev->interrupt_out_buffer); + kfree(dev->read_buffer); + kfree(dev->interrupt_in_buffer); + kfree(dev->interrupt_out_buffer); usb_put_dev(dev->udev); - kfree (dev); + kfree(dev); } /** * tower_open */ -static int tower_open (struct inode *inode, struct file *file) +static int tower_open(struct inode *inode, struct file *file) { struct lego_usb_tower *dev = NULL; int subminor; @@ -321,7 +321,7 @@ static int tower_open (struct inode *inode, struct file *file) nonseekable_open(inode, file); subminor = iminor(inode); - interface = usb_find_interface (&tower_driver, subminor); + interface = usb_find_interface(&tower_driver, subminor); if (!interface) { pr_err("error, can't find device for minor %d\n", subminor); @@ -349,15 +349,15 @@ static int tower_open (struct inode *inode, struct file *file) } /* reset the tower */ - result = usb_control_msg (dev->udev, - usb_rcvctrlpipe(dev->udev, 0), - LEGO_USB_TOWER_REQUEST_RESET, - USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_DEVICE, - 0, - 0, - reset_reply, - sizeof(*reset_reply), - 1000); + result = usb_control_msg(dev->udev, + usb_rcvctrlpipe(dev->udev, 0), + LEGO_USB_TOWER_REQUEST_RESET, + USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_DEVICE, + 0, + 0, + reset_reply, + sizeof(*reset_reply), + 1000); if (result < 0) { dev_err(&dev->udev->dev, "LEGO USB Tower reset control request failed\n"); @@ -368,19 +368,19 @@ static int tower_open (struct inode *inode, struct file *file) /* initialize in direction */ dev->read_buffer_length = 0; dev->read_packet_length = 0; - usb_fill_int_urb (dev->interrupt_in_urb, - dev->udev, - usb_rcvintpipe(dev->udev, dev->interrupt_in_endpoint->bEndpointAddress), - dev->interrupt_in_buffer, - usb_endpoint_maxp(dev->interrupt_in_endpoint), - tower_interrupt_in_callback, - dev, - dev->interrupt_in_interval); + usb_fill_int_urb(dev->interrupt_in_urb, + dev->udev, + usb_rcvintpipe(dev->udev, dev->interrupt_in_endpoint->bEndpointAddress), + dev->interrupt_in_buffer, + usb_endpoint_maxp(dev->interrupt_in_endpoint), + tower_interrupt_in_callback, + dev, + dev->interrupt_in_interval); dev->interrupt_in_done = 0; mb(); - retval = usb_submit_urb (dev->interrupt_in_urb, GFP_KERNEL); + retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); if (retval) { dev_err(&dev->udev->dev, "Couldn't submit interrupt_in_urb %d\n", retval); @@ -403,7 +403,7 @@ static int tower_open (struct inode *inode, struct file *file) /** * tower_release */ -static int tower_release (struct inode *inode, struct file *file) +static int tower_release(struct inode *inode, struct file *file) { struct lego_usb_tower *dev; int retval = 0; @@ -422,13 +422,14 @@ static int tower_release (struct inode *inode, struct file *file) /* unlock here as tower_delete frees dev */ mutex_unlock(&dev->lock); - tower_delete (dev); + tower_delete(dev); goto exit; } /* wait until write transfer is finished */ if (dev->interrupt_out_busy) { - wait_event_interruptible_timeout (dev->write_wait, !dev->interrupt_out_busy, 2 * HZ); + wait_event_interruptible_timeout(dev->write_wait, !dev->interrupt_out_busy, + 2 * HZ); } /* shutdown transfers */ @@ -450,23 +451,23 @@ static int tower_release (struct inode *inode, struct file *file) * until it has been there unchanged for at least * dev->packet_timeout_jiffies, or until the buffer is full. */ -static void tower_check_for_read_packet (struct lego_usb_tower *dev) +static void tower_check_for_read_packet(struct lego_usb_tower *dev) { - spin_lock_irq (&dev->read_buffer_lock); + spin_lock_irq(&dev->read_buffer_lock); if (!packet_timeout || time_after(jiffies, dev->read_last_arrival + dev->packet_timeout_jiffies) || dev->read_buffer_length == read_buffer_size) { dev->read_packet_length = dev->read_buffer_length; } dev->interrupt_in_done = 0; - spin_unlock_irq (&dev->read_buffer_lock); + spin_unlock_irq(&dev->read_buffer_lock); } /** * tower_poll */ -static __poll_t tower_poll (struct file *file, poll_table *wait) +static __poll_t tower_poll(struct file *file, poll_table *wait) { struct lego_usb_tower *dev; __poll_t mask = 0; @@ -494,7 +495,7 @@ static __poll_t tower_poll (struct file *file, poll_table *wait) /** * tower_llseek */ -static loff_t tower_llseek (struct file *file, loff_t off, int whence) +static loff_t tower_llseek(struct file *file, loff_t off, int whence) { return -ESPIPE; /* unseekable */ } @@ -503,7 +504,7 @@ static loff_t tower_llseek (struct file *file, loff_t off, int whence) /** * tower_read */ -static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, loff_t *ppos) +static ssize_t tower_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct lego_usb_tower *dev; size_t bytes_to_read; @@ -536,7 +537,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, } /* wait for data */ - tower_check_for_read_packet (dev); + tower_check_for_read_packet(dev); while (dev->read_packet_length == 0) { if (file->f_flags & O_NONBLOCK) { retval = -EAGAIN; @@ -553,28 +554,28 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, timeout = jiffies + msecs_to_jiffies(read_timeout); } /* check for read timeout */ - if (read_timeout && time_after (jiffies, timeout)) { + if (read_timeout && time_after(jiffies, timeout)) { retval = -ETIMEDOUT; goto unlock_exit; } - tower_check_for_read_packet (dev); + tower_check_for_read_packet(dev); } /* copy the data from read_buffer into userspace */ bytes_to_read = min(count, dev->read_packet_length); - if (copy_to_user (buffer, dev->read_buffer, bytes_to_read)) { + if (copy_to_user(buffer, dev->read_buffer, bytes_to_read)) { retval = -EFAULT; goto unlock_exit; } - spin_lock_irq (&dev->read_buffer_lock); + spin_lock_irq(&dev->read_buffer_lock); dev->read_buffer_length -= bytes_to_read; dev->read_packet_length -= bytes_to_read; for (i=0; iread_buffer_length; i++) { dev->read_buffer[i] = dev->read_buffer[i+bytes_to_read]; } - spin_unlock_irq (&dev->read_buffer_lock); + spin_unlock_irq(&dev->read_buffer_lock); retval = bytes_to_read; @@ -590,7 +591,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, /** * tower_write */ -static ssize_t tower_write (struct file *file, const char __user *buffer, size_t count, loff_t *ppos) +static ssize_t tower_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct lego_usb_tower *dev; size_t bytes_to_write; @@ -622,7 +623,8 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t retval = -EAGAIN; goto unlock_exit; } - retval = wait_event_interruptible (dev->write_wait, !dev->interrupt_out_busy); + retval = wait_event_interruptible(dev->write_wait, + !dev->interrupt_out_busy); if (retval) { goto unlock_exit; } @@ -633,7 +635,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t dev_dbg(&dev->udev->dev, "%s: count = %zd, bytes_to_write = %zd\n", __func__, count, bytes_to_write); - if (copy_from_user (dev->interrupt_out_buffer, buffer, bytes_to_write)) { + if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write)) { retval = -EFAULT; goto unlock_exit; } @@ -651,7 +653,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t dev->interrupt_out_busy = 1; wmb(); - retval = usb_submit_urb (dev->interrupt_out_urb, GFP_KERNEL); + retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); if (retval) { dev->interrupt_out_busy = 0; dev_err(&dev->udev->dev, @@ -672,7 +674,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t /** * tower_interrupt_in_callback */ -static void tower_interrupt_in_callback (struct urb *urb) +static void tower_interrupt_in_callback(struct urb *urb) { struct lego_usb_tower *dev = urb->context; int status = urb->status; @@ -698,9 +700,9 @@ static void tower_interrupt_in_callback (struct urb *urb) if (urb->actual_length > 0) { spin_lock_irqsave(&dev->read_buffer_lock, flags); if (dev->read_buffer_length + urb->actual_length < read_buffer_size) { - memcpy (dev->read_buffer + dev->read_buffer_length, - dev->interrupt_in_buffer, - urb->actual_length); + memcpy(dev->read_buffer + dev->read_buffer_length, + dev->interrupt_in_buffer, + urb->actual_length); dev->read_buffer_length += urb->actual_length; dev->read_last_arrival = jiffies; dev_dbg(&dev->udev->dev, "%s: received %d bytes\n", @@ -720,14 +722,14 @@ static void tower_interrupt_in_callback (struct urb *urb) } exit: dev->interrupt_in_done = 1; - wake_up_interruptible (&dev->read_wait); + wake_up_interruptible(&dev->read_wait); } /** * tower_interrupt_out_callback */ -static void tower_interrupt_out_callback (struct urb *urb) +static void tower_interrupt_out_callback(struct urb *urb) { struct lego_usb_tower *dev = urb->context; int status = urb->status; @@ -755,7 +757,7 @@ static void tower_interrupt_out_callback (struct urb *urb) * Called by the usb core when a new device is connected that it thinks * this driver might be interested in. */ -static int tower_probe (struct usb_interface *interface, const struct usb_device_id *id) +static int tower_probe(struct usb_interface *interface, const struct usb_device_id *id) { struct device *idev = &interface->dev; struct usb_device *udev = interface_to_usbdev(interface); @@ -771,11 +773,11 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device mutex_init(&dev->lock); dev->udev = usb_get_dev(udev); - spin_lock_init (&dev->read_buffer_lock); + spin_lock_init(&dev->read_buffer_lock); dev->packet_timeout_jiffies = msecs_to_jiffies(packet_timeout); dev->read_last_arrival = jiffies; - init_waitqueue_head (&dev->read_wait); - init_waitqueue_head (&dev->write_wait); + init_waitqueue_head(&dev->read_wait); + init_waitqueue_head(&dev->write_wait); result = usb_find_common_endpoints_reverse(interface->cur_altsetting, NULL, NULL, @@ -787,16 +789,16 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device goto error; } - dev->read_buffer = kmalloc (read_buffer_size, GFP_KERNEL); + dev->read_buffer = kmalloc(read_buffer_size, GFP_KERNEL); if (!dev->read_buffer) goto error; - dev->interrupt_in_buffer = kmalloc (usb_endpoint_maxp(dev->interrupt_in_endpoint), GFP_KERNEL); + dev->interrupt_in_buffer = kmalloc(usb_endpoint_maxp(dev->interrupt_in_endpoint), GFP_KERNEL); if (!dev->interrupt_in_buffer) goto error; dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); if (!dev->interrupt_in_urb) goto error; - dev->interrupt_out_buffer = kmalloc (write_buffer_size, GFP_KERNEL); + dev->interrupt_out_buffer = kmalloc(write_buffer_size, GFP_KERNEL); if (!dev->interrupt_out_buffer) goto error; dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); @@ -813,15 +815,15 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device } /* get the firmware version and log it */ - result = usb_control_msg (udev, - usb_rcvctrlpipe(udev, 0), - LEGO_USB_TOWER_REQUEST_GET_VERSION, - USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_DEVICE, - 0, - 0, - get_version_reply, - sizeof(*get_version_reply), - 1000); + result = usb_control_msg(udev, + usb_rcvctrlpipe(udev, 0), + LEGO_USB_TOWER_REQUEST_GET_VERSION, + USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_DEVICE, + 0, + 0, + get_version_reply, + sizeof(*get_version_reply), + 1000); if (result != sizeof(*get_version_reply)) { if (result >= 0) result = -EIO; @@ -836,9 +838,9 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device le16_to_cpu(get_version_reply->build_no)); /* we can register the device now, as it is ready */ - usb_set_intfdata (interface, dev); + usb_set_intfdata(interface, dev); - retval = usb_register_dev (interface, &tower_class); + retval = usb_register_dev(interface, &tower_class); if (retval) { /* something prevented us from registering this driver */ @@ -868,17 +870,17 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device * * Called by the usb core when the device is removed from the system. */ -static void tower_disconnect (struct usb_interface *interface) +static void tower_disconnect(struct usb_interface *interface) { struct lego_usb_tower *dev; int minor; - dev = usb_get_intfdata (interface); + dev = usb_get_intfdata(interface); minor = dev->minor; /* give back our minor and prevent further open() */ - usb_deregister_dev (interface, &tower_class); + usb_deregister_dev(interface, &tower_class); /* stop I/O */ usb_poison_urb(dev->interrupt_in_urb); @@ -889,7 +891,7 @@ static void tower_disconnect (struct usb_interface *interface) /* if the device is not opened, then we clean up right now */ if (!dev->open_count) { mutex_unlock(&dev->lock); - tower_delete (dev); + tower_delete(dev); } else { dev->disconnected = 1; /* wake up pollers */ From patchwork Tue Nov 5 08:41:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227171 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F268116B1 for ; Tue, 5 Nov 2019 08:54:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D10B820869 for ; Tue, 5 Nov 2019 08:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572944096; bh=ov1nc7eCk+Ctq93l4fLsXP09miAHFw/qmyg3KoGhZ7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=n76ye9ZS1DtXijYinh9CIgdVCN1C+xjY01s/V9gC34XgulFMc26xK/kj3vh1AdtHc 6vDQFLjOJz4gg/1nqC4g3d/hjhCphmp1Pzi16JvOp+biqBHFrKw2YsMzKSYqFaUnzi 2zK/X4Y2dv/hVTkxplDvCvdcWdfUvuNVty1paBT4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730596AbfKEIy4 (ORCPT ); Tue, 5 Nov 2019 03:54:56 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:39903 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730573AbfKEIyz (ORCPT ); Tue, 5 Nov 2019 03:54:55 -0500 Received: by mail-lf1-f67.google.com with SMTP id 195so14449915lfj.6 for ; Tue, 05 Nov 2019 00:54:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4afoqspkcc5RK9XOk5fmMpLRXrhOEIrMZ5sEh9PN/9Y=; b=YyD/07VVYLCToxmXrkPnWcNVGfFoZUrf1sJfcy2fsn0/U8Aumeo884gyNnpnifa8Bv ZyGX0OH6eTu0/q01GiXsqYMNSfRqe2hWH/Q2JLuYkwIlBPQwJnQvl5BRsWVYqtdI3czY UrBjL/qJi/5AAOxSRmCdCoh4tKLN/TfImUdRZpSvABRRn1rzzaNfhJG6NVGu9lxVnsB9 4jMeAT5h3cF6vB0IAaB09K0MZEcMA3by0xn7OYGTFtNS4jk8VrBJIuhepYr/Zuwpip9H C0DZ6TdwqVkgdjNsx1jAKzDW5EoEq2fJicxAas2omGMAm4BW5RYnrJuPbohJUIQUeDam N2Bw== X-Gm-Message-State: APjAAAXRULijT16F8pDSLQDOb2CjalPNmg8aLW2EyTwGzE/ThRR3npSz nhIe+jKv4ckmAdDoti8NrI8= X-Google-Smtp-Source: APXvYqy5inEdoGPeJOoHkLb9eiBFVdXaJe6OPaBXWVAVFc7Y8Q1DejKXrD6QVsGByN96uWPmc6NrQQ== X-Received: by 2002:ac2:4989:: with SMTP id f9mr1706265lfl.42.1572944093536; Tue, 05 Nov 2019 00:54:53 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id f3sm2342885lfp.0.2019.11.05.00.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:54:52 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPm-0004HX-Cr; Tue, 05 Nov 2019 09:42:14 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 13/14] USB: legousbtower: drop superfluous brackets Date: Tue, 5 Nov 2019 09:41:51 +0100 Message-Id: <20191105084152.16322-14-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop superfluous brackets around single-line blocks. Also add missing white space around operators in a for-expression being modified. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 6f34b3802332..6b7ea80d5876 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -481,12 +481,10 @@ static __poll_t tower_poll(struct file *file, poll_table *wait) poll_wait(file, &dev->write_wait, wait); tower_check_for_read_packet(dev); - if (dev->read_packet_length > 0) { + if (dev->read_packet_length > 0) mask |= EPOLLIN | EPOLLRDNORM; - } - if (!dev->interrupt_out_busy) { + if (!dev->interrupt_out_busy) mask |= EPOLLOUT | EPOLLWRNORM; - } return mask; } @@ -532,9 +530,8 @@ static ssize_t tower_read(struct file *file, char __user *buffer, size_t count, goto unlock_exit; } - if (read_timeout) { + if (read_timeout) timeout = jiffies + msecs_to_jiffies(read_timeout); - } /* wait for data */ tower_check_for_read_packet(dev); @@ -544,9 +541,8 @@ static ssize_t tower_read(struct file *file, char __user *buffer, size_t count, goto unlock_exit; } retval = wait_event_interruptible_timeout(dev->read_wait, dev->interrupt_in_done, dev->packet_timeout_jiffies); - if (retval < 0) { + if (retval < 0) goto unlock_exit; - } /* reset read timeout during read or write activity */ if (read_timeout @@ -572,9 +568,8 @@ static ssize_t tower_read(struct file *file, char __user *buffer, size_t count, spin_lock_irq(&dev->read_buffer_lock); dev->read_buffer_length -= bytes_to_read; dev->read_packet_length -= bytes_to_read; - for (i=0; iread_buffer_length; i++) { + for (i = 0; i < dev->read_buffer_length; i++) dev->read_buffer[i] = dev->read_buffer[i+bytes_to_read]; - } spin_unlock_irq(&dev->read_buffer_lock); retval = bytes_to_read; @@ -625,9 +620,8 @@ static ssize_t tower_write(struct file *file, const char __user *buffer, size_t } retval = wait_event_interruptible(dev->write_wait, !dev->interrupt_out_busy); - if (retval) { + if (retval) goto unlock_exit; - } } /* write the data into interrupt_out_buffer from userspace */ From patchwork Tue Nov 5 08:41:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 11227161 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F00791986 for ; Tue, 5 Nov 2019 08:42:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CEFBF217F5 for ; Tue, 5 Nov 2019 08:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572943342; bh=R353TqXQHkvu7WMFOQxrDlelJJWvKtRWc0b1QH23B6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Zc6xJuFtfgOffQ1NAm6iNhOcJ8cXpxtpmm7xpUZfSo4TCsdHa3iTikAOKtutLc80n hokYd424DOERjr1rLnCIld6y2DqDGnTq/P8CWK069UEv/EYxDLLQhME/mQ35qQsEEZ nwlj+4uM4pLIM1ZNdnOYrRiXrivQ11dpVA4jGv08= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730601AbfKEImW (ORCPT ); Tue, 5 Nov 2019 03:42:22 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:46720 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730541AbfKEImV (ORCPT ); Tue, 5 Nov 2019 03:42:21 -0500 Received: by mail-lj1-f195.google.com with SMTP id e9so7498787ljp.13 for ; Tue, 05 Nov 2019 00:42:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KzD2kRMqXBk5Yohy1WZyW20m/TFgSNbBGXd2XRm4RLc=; b=UspIH8ziMEILjxCXVD6s9T7GRZ0p+hG+bLP07jBY0GEOwUsz0K8RkL3m3ihnmkji1q daHCpeHl1hvi6FijZj70w//htg98N8ZMU2Gr976JUuzF7m1oB2BQsw8BeiyTR8rufLxl EeQKAGhjOCl3njs6L84FsYg0MgGcMQ2JcpF8U/hbnCfjQV6lyFSHsWZbZXVJCIGTR7pk P5tGOwn1fa3DjYxyDmEUej7tyuLljHQdRjVdoTwMRsi6O/XqLzFRdoj0a8fTbYWd25pM ywGP8IiqoJX+IEG2sj1fJZl0jM+QBKahUqR/jFm9hEfB+b/OvPI/1pAq71fitJlOOEPT gmBw== X-Gm-Message-State: APjAAAW34cECWNxjvB8vr0AvcA03kc0J0JbO9hncmQmcviwxlitmrgYS /XOKJJpHC2oUReKeggiPMWE5P0fG X-Google-Smtp-Source: APXvYqz/Tf/zHFQUZBgQpN4ukW+wBjTaq52O80nCjCrse6r6pgdXd/roW482mpw8wruO4jF68kn7GA== X-Received: by 2002:a05:651c:28a:: with SMTP id b10mr3113831ljo.124.1572943339825; Tue, 05 Nov 2019 00:42:19 -0800 (PST) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id e22sm10521721ljg.73.2019.11.05.00.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 00:42:16 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1iRuPm-0004Hc-G4; Tue, 05 Nov 2019 09:42:14 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Juergen Stuber , legousb-devel@lists.sourceforge.net, linux-usb@vger.kernel.org, Johan Hovold Subject: [PATCH 14/14] USB: legousbtower: drop superfluous newlines Date: Tue, 5 Nov 2019 09:41:52 +0100 Message-Id: <20191105084152.16322-15-johan@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191105084152.16322-1-johan@kernel.org> References: <20191105084152.16322-1-johan@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Drop some superfluous newlines before conditionals which made the code harder to read. Signed-off-by: Johan Hovold --- drivers/usb/misc/legousbtower.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 6b7ea80d5876..ab4b98b04115 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -312,7 +312,6 @@ static int tower_open(struct inode *inode, struct file *file) int result; reset_reply = kmalloc(sizeof(*reset_reply), GFP_KERNEL); - if (!reset_reply) { retval = -ENOMEM; goto exit; @@ -322,7 +321,6 @@ static int tower_open(struct inode *inode, struct file *file) subminor = iminor(inode); interface = usb_find_interface(&tower_driver, subminor); - if (!interface) { pr_err("error, can't find device for minor %d\n", subminor); retval = -ENODEV; @@ -409,7 +407,6 @@ static int tower_release(struct inode *inode, struct file *file) int retval = 0; dev = file->private_data; - if (dev == NULL) { retval = -ENODEV; goto exit; @@ -802,7 +799,6 @@ static int tower_probe(struct usb_interface *interface, const struct usb_device_ dev->interrupt_out_interval = interrupt_out_interval ? interrupt_out_interval : dev->interrupt_out_endpoint->bInterval; get_version_reply = kmalloc(sizeof(*get_version_reply), GFP_KERNEL); - if (!get_version_reply) { retval = -ENOMEM; goto error; @@ -835,7 +831,6 @@ static int tower_probe(struct usb_interface *interface, const struct usb_device_ usb_set_intfdata(interface, dev); retval = usb_register_dev(interface, &tower_class); - if (retval) { /* something prevented us from registering this driver */ dev_err(idev, "Not able to get a minor for this device.\n");