From patchwork Tue Oct 5 12:22:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538093 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE6D8C43217 for ; Tue, 5 Oct 2021 14:06:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B875761131 for ; Tue, 5 Oct 2021 14:06:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235888AbhJEOIs (ORCPT ); Tue, 5 Oct 2021 10:08:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235995AbhJEOIM (ORCPT ); Tue, 5 Oct 2021 10:08:12 -0400 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [IPv6:2001:67c:2050::465:103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A629C08EAC7; Tue, 5 Oct 2021 07:03:43 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4HNznl6jjDzQjb8; Tue, 5 Oct 2021 16:03:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=WXuKKp05FgBaGzLWzaMwG93oVFh4NeKDYaS1W7hf3+E=; b=wZT8+cKRlm4pTDS0WGBbniGcmXdO5KH5T7XxgPxUceWTe0aeTPmuoUo0Xg8lnSwbuSrkUB K1BTHJQAzrdgvYaeLHf10pn2IZXqoF49doP4XxY/jwLVMya1u3B/bsnsMKQw2ylnfGKTQD Uqz60T7BzGRaHgUtA4z7ihRwdTFOWgVk4W4SI70NBWZp5U0qBBkIy83P9KmEager3KlkhU KwiA3sqfAJ66QgfEttmIzFbPZLOmqb/vjEeeGIDEcasVGGgzfEyM8/vkOgcHudDeRGtnfw LlTYNxm833cCsPP1wMMvhhEAdn5tmav6ewqQFY8DqA3823xtu3xlUe5Kpgb2ew== X-Mailbox-Line: From 3e27773cc94bfc740374d0432e70e4b215c08c9a Mon Sep 17 00:00:00 2001 Message-Id: <3e27773cc94bfc740374d0432e70e4b215c08c9a.1633442131.git.rob@robgreener.com> In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 13:22:11 +0100 Subject: [PATCH 01/13] usb: core: config: Use tabs rather than spaces for new lines of args X-Rspamd-Queue-Id: 2D114268 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This fixes the following checkpatch.pl warning at lines 28, 499, 500, 606: WARNING:LEADING_SPACE: please, no spaces at the start of a line Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index b199eb65f378..52b0edee5b55 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -25,7 +25,7 @@ static inline const char *plural(int n) } static int find_next_descriptor(unsigned char *buffer, int size, - int dt1, int dt2, int *num_skipped) + int dt1, int dt2, int *num_skipped) { struct usb_descriptor_header *h; int n = 0; @@ -496,8 +496,8 @@ void usb_release_interface_cache(struct kref *ref) } static int usb_parse_interface(struct device *ddev, int cfgno, - struct usb_host_config *config, unsigned char *buffer, int size, - u8 inums[], u8 nalts[]) + struct usb_host_config *config, unsigned char *buffer, int size, + s[], u8 nalts[]) { unsigned char *buffer0 = buffer; struct usb_interface_descriptor *d; @@ -603,7 +603,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno, } static int usb_parse_configuration(struct usb_device *dev, int cfgidx, - struct usb_host_config *config, unsigned char *buffer, int size) + struct usb_host_config *config, unsigned char *buffer, int size) { struct device *ddev = &dev->dev; unsigned char *buffer0 = buffer; From patchwork Tue Oct 5 12:31:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538083 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D2C0C433EF for ; Tue, 5 Oct 2021 14:06:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 35C6861881 for ; Tue, 5 Oct 2021 14:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235347AbhJEOIk (ORCPT ); Tue, 5 Oct 2021 10:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235597AbhJEOIJ (ORCPT ); Tue, 5 Oct 2021 10:08:09 -0400 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [IPv6:2001:67c:2050::465:103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56A26C08E86A; Tue, 5 Oct 2021 07:03:27 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4HNznn5CW0zQkSX; Tue, 5 Oct 2021 16:03:25 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=OzhPqsCgRjc99rDYjM4KQ72SeZ8m/fONRusVoznTr3E=; b=mLw3rSpnxqDegAEeopmzRydAaz745dZIBimiFiMYECI6RnBaavL+//VR7j+V8xNo+nPEhs kOHvKyArjQteeomczbBM/o+vWYHwgH5QUoTXmvXsvrHTa5KnzJw42MYVXkOjn/rM+gsymr /UUn+jw5YdmHfuaQ+1yw1J9MrXnqSzl1CFs4eFjKJnPD4BBsNQfejq2yBeVdw6OwJBjGOr wYJREiFPXyteDdi4LQxywLVMnQqNlzjMB20cPRo827wghDDO+yfHT/wtRjA7tgIS6uFUCg g5TN4O+6RUaMProe8tyJD7nFxyFv85NY8advb23a0ali7AjGEOBNYEnjY4xz2w== X-Mailbox-Line: From da05f4a46e5183a0aa067673159fb70ae6621403 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 13:31:37 +0100 Subject: [PATCH 02/13] usb: core: config: fix block comment styles X-Rspamd-Queue-Id: 020CC268 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Fix the following checkpatch warning at lines 45, 467, 547, 646, 696, 782, 897: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 52b0edee5b55..52aab1462787 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -42,7 +42,8 @@ static int find_next_descriptor(unsigned char *buffer, int size, } /* Store the number of descriptors skipped and return the - * number of bytes skipped */ + * number of bytes skipped + */ if (num_skipped) *num_skipped = n; return buffer - buffer0; @@ -464,7 +465,8 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, inum, asnum, endpoint, buffer, size); /* Skip over any Class Specific or Vendor Specific descriptors; - * find the next endpoint or interface descriptor */ + * find the next endpoint or interface descriptor + */ endpoint->extra = buffer; i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT, USB_DT_INTERFACE, &n); @@ -544,7 +546,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno, memcpy(&alt->desc, d, USB_DT_INTERFACE_SIZE); /* Skip over any Class Specific or Vendor Specific descriptors; - * find the first endpoint or interface descriptor */ + * find the first endpoint or interface descriptor + */ alt->extra = buffer; i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT, USB_DT_INTERFACE, &n); @@ -643,7 +646,8 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, } /* Go through the descriptors, checking their length and counting the - * number of altsettings for each interface */ + * number of altsettings for each interface + */ n = 0; for ((buffer2 = buffer, size2 = size); size2 > 0; @@ -693,7 +697,8 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, cfgno, inum, nintf_orig - 1); /* Have we already encountered this interface? - * Count its altsettings */ + * Count its altsettings + */ for (i = 0; i < n; ++i) { if (inums[i] == inum) break; @@ -779,7 +784,8 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, /* FIXME: parse the BOS descriptor */ /* Skip over any Class Specific or Vendor Specific descriptors; - * find the first interface descriptor */ + * find the first interface descriptor + */ config->extra = buffer; i = find_next_descriptor(buffer, size, USB_DT_INTERFACE, USB_DT_INTERFACE, &n); @@ -894,7 +900,8 @@ int usb_get_configuration(struct usb_device *dev) for (cfgno = 0; cfgno < ncfg; cfgno++) { /* We grab just the first descriptor so we know how long - * the whole configuration is */ + * the whole configuration is + */ result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, desc, USB_DT_CONFIG_SIZE); if (result < 0) { From patchwork Tue Oct 5 12:35:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538097 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5421C433FE for ; Tue, 5 Oct 2021 14:07:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CEF726115B for ; Tue, 5 Oct 2021 14:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236069AbhJEOIv (ORCPT ); Tue, 5 Oct 2021 10:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235977AbhJEOIM (ORCPT ); Tue, 5 Oct 2021 10:08:12 -0400 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [IPv6:2001:67c:2050::465:101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD2FAC0613B0; Tue, 5 Oct 2021 07:03:43 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [80.241.60.233]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4HNznk4WbqzQkBV; Tue, 5 Oct 2021 16:03:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=qp8W3CHdssybII7b16zFOx2u+1MbGZ2xtIgnn5PDyIQ=; b=c9zAaSkCskfg6+CWV+LmSPsZMsNkw7kNaqCAJNYzBQmzhq5jqEbW+amrCD51Ko1EPCq2DA pRX1QFsUlOoZyJuAZiv/0r6Psjl3QMiyeoxg0H1THKzpZ6oHi9rSoDlGafXb7MGWZu9OiM i/ejoh2mRKxxua+oh3oLrVqgIQobL+ua6gB7oEAolEWVq3ZN7/ITPGAC4Nxub1OVyfEfTR c7RKVYwkDTl8XhPXnAeEQ2dhLZrvt20ERvw21Bmmn56gUJixH4AMEmHUvbGeWn8OOCy3BC XhZbqYmnaLMveakA4dEKRmIwzBqqBK3M9FqKDAU19qQfyTWfTg05T5niccrslA== X-Mailbox-Line: From 89e7ed8527882bef87734af998b83b4f4912b790 Mon Sep 17 00:00:00 2001 Message-Id: <89e7ed8527882bef87734af998b83b4f4912b790.1633442131.git.rob@robgreener.com> In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 13:35:33 +0100 Subject: [PATCH 03/13] usb: core: config: Change `unsigned` to `unsigned int` X-Rspamd-Queue-Id: DDEEA5C1 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Fix the following checkpatch warning: core/config.c:622: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 52aab1462787..5de26d64a00b 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -619,7 +619,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, struct usb_descriptor_header *header; int retval; u8 inums[USB_MAXINTERFACES], nalts[USB_MAXINTERFACES]; - unsigned iad_num = 0; + unsigned int iad_num = 0; memcpy(&config->desc, buffer, USB_DT_CONFIG_SIZE); nintf = nintf_orig = config->desc.bNumInterfaces; From patchwork Tue Oct 5 12:37:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538081 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E906C433F5 for ; Tue, 5 Oct 2021 14:06:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2028561131 for ; Tue, 5 Oct 2021 14:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235448AbhJEOIh (ORCPT ); Tue, 5 Oct 2021 10:08:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235553AbhJEOIJ (ORCPT ); Tue, 5 Oct 2021 10:08:09 -0400 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [IPv6:2001:67c:2050::465:101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA9CCC08E868; Tue, 5 Oct 2021 07:03:25 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [80.241.60.233]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4HNznl3pTBzQkHt; Tue, 5 Oct 2021 16:03:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=sSUSvUhYetKqhetcftUrbC/bhAw4qXKyzeHFsBWvZ/M=; b=pAbuOv3cT8fcMIdvXGN+/n7/1iIJcjN/BIYv1mQ81+qdwdV24Qu+4xx9ZWdMMLP6/rUrYI 0AyGBKXaSCuKS/naXhVoTCX+lYmQCDaXWAvWkj7j4oABGdneijm1F+m/Z8iJTNS+uupeVT yuO4QAWtGXwcN+uAZeeyZeF+lxS/2PpSfTq5N+JDp//5C5zbsNwwKGEwPkNdx8u+jP41BJ 37wGOzfnO64T1xJ7qoLkHDNhRtXYFpsex0X7hfR/Y9jo40vN8W1LBuuFWxzybkeUj2+3EL 9AMZsKN//HW3GY3iysYkbJRXLMuN0NkGQPdwHblj6Bl3+MZLfni5To2AUBn4Qg== X-Mailbox-Line: From d28be71c181a0626326d558a6dd3a59a5ad5aeb6 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 13:37:30 +0100 Subject: [PATCH 04/13] usb: core: config: Avoid multiple line derefrence X-Rspamd-Queue-Id: BFFFD2A7 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Fix the following checkpatch warning: core/config.c:816: WARNING:MULTILINE_DEREFERENCE: Avoid multiple line dereference - prefer 'intfc->altsetting[n].desc.bAlternateSetting' Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 5de26d64a00b..f6c90214bba0 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -812,8 +812,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, intfc = config->intf_cache[i]; for (j = 0; j < intfc->num_altsetting; ++j) { for (n = 0; n < intfc->num_altsetting; ++n) { - if (intfc->altsetting[n].desc. - bAlternateSetting == j) + if (intfc->altsetting[n].desc.bAlternateSetting == j) break; } if (n >= intfc->num_altsetting) From patchwork Tue Oct 5 12:41:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4247C433FE for ; Tue, 5 Oct 2021 14:06:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8FC56115B for ; Tue, 5 Oct 2021 14:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235255AbhJEOIg (ORCPT ); Tue, 5 Oct 2021 10:08:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235572AbhJEOIJ (ORCPT ); Tue, 5 Oct 2021 10:08:09 -0400 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [IPv6:2001:67c:2050::465:103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFE8AC08E869; Tue, 5 Oct 2021 07:03:25 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [80.241.60.233]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4HNznm3BC4zQkJH; Tue, 5 Oct 2021 16:03:24 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=W9q0yh9C4+f0hhYGXD2Uh2ACE2H49tKjSCovdaIxFos=; b=QvSNHBRDu9x1PgSNakfLRM/XYuWBKFDmajZEmT1qLscUEcofGk2PRphmBRDhJWAveqpHin 4Mo5qnCnePGAmqEv0vprQ42Bfg8Q1Jm+3507Nr80VZ+sl5C+pBSl8CfWcHUljgj5rTqSNE Og+0VDJkBUwIb7EbbXvDyovxhjwAAMTpa6jf50NQxPRT6y/AYMtNqRyDl0YR+LiFRp5kJB dnp+c9lNwm1Q0+muPoHhsMWvbGqI29RF9qN0rwD62482HRoYXGx9L84O/a1PEl5urnlIAm LEmRNj30SNhekn5/wq8h/ctzlIkhDFO923nFyxAyfJOuraRRs9nvFXlTwaXoSQ== X-Mailbox-Line: From c818d250f53a97577f01aae2ae051092d098fe74 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 13:41:27 +0100 Subject: [PATCH 05/13] usb: core: config: Fix typo in dev_warn X-Rspamd-Queue-Id: B64B6274 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This fixes the following checkpatch.pl error: core/config.c:66: WARNING:MISSING_SPACE: break quoted strings at a space character This fix solvers inserts a space between companion and for, where there is not one currently. Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index f6c90214bba0..c7451081b08b 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -62,7 +62,7 @@ static void usb_parse_ssp_isoc_endpoint_companion(struct device *ddev, desc = (struct usb_ssp_isoc_ep_comp_descriptor *) buffer; if (desc->bDescriptorType != USB_DT_SSP_ISOC_ENDPOINT_COMP || size < USB_DT_SSP_ISOC_EP_COMP_SIZE) { - dev_warn(ddev, "Invalid SuperSpeedPlus isoc endpoint companion" + dev_warn(ddev, "Invalid SuperSpeedPlus isoc endpoint companion " "for config %d interface %d altsetting %d ep %d.\n", cfgno, inum, asnum, ep->desc.bEndpointAddress); return; From patchwork Tue Oct 5 13:22:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BD7FC433F5 for ; Tue, 5 Oct 2021 14:07:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 264D56113A for ; Tue, 5 Oct 2021 14:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236052AbhJEOJ0 (ORCPT ); Tue, 5 Oct 2021 10:09:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235695AbhJEOIJ (ORCPT ); Tue, 5 Oct 2021 10:08:09 -0400 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [IPv6:2001:67c:2050::465:103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56AB7C08E86B; Tue, 5 Oct 2021 07:03:27 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4HNznp1jCQzQkZm; Tue, 5 Oct 2021 16:03:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=fqo3O/9/epAUV0GXP9kWNRcnLVhhtBguy9K48WqISWE=; b=JE2bmWyaOwj3lG0VWTUHder+3VLfd747BJlkilEHutPH2xk8qqsA0PqGTlmHKyy4f3CoZr QIn7ofaJTTeXUXrCOkhSpInsL0nmoWMgp9y633b72UDHFzQuTVFulVsA6KL5Ma0dVfit0Y iRcUi/aiWjmwxuF6OsIex8xaYeCd32OQtpEeCPdlQJQx7ltMbYiAo96VePZt+zGexGhDIQ 3MBizV3uA5So4+U56LT9fLTPZaNbF9/s86ZXk9TbZs1KF9DkY+i31V+lQCqDGY07aP5D6x 2STN4StUwji9d0lSYa+oEllvnEHtQzi56wvx7Uldcgx+PNMb0GL3MgBmQk5LHQ== X-Mailbox-Line: From 1a69658a8abf6d22fe9121228f57d5a0e9390c34 Mon Sep 17 00:00:00 2001 Message-Id: <1a69658a8abf6d22fe9121228f57d5a0e9390c34.1633442131.git.rob@robgreener.com> In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 14:22:42 +0100 Subject: [PATCH 06/13] usb: core: config: unsplit strings which are split across lines X-Rspamd-Queue-Id: 86CFC272 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This patch fixes the following checkpatch.pl warning across many lines: WARNING:SPLIT_STRING: quoted string split across lines This fix will make it easier to grep these strings in the source code. Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 224 +++++++++++++++++++------------------- 1 file changed, 110 insertions(+), 114 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index c7451081b08b..51c590da7651 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -62,8 +62,8 @@ static void usb_parse_ssp_isoc_endpoint_companion(struct device *ddev, desc = (struct usb_ssp_isoc_ep_comp_descriptor *) buffer; if (desc->bDescriptorType != USB_DT_SSP_ISOC_ENDPOINT_COMP || size < USB_DT_SSP_ISOC_EP_COMP_SIZE) { - dev_warn(ddev, "Invalid SuperSpeedPlus isoc endpoint companion " - "for config %d interface %d altsetting %d ep %d.\n", + dev_warn(ddev, + "Invalid SuperSpeedPlus isoc endpoint companion for config %d interface %d altsetting %d ep %d.\n", cfgno, inum, asnum, ep->desc.bEndpointAddress); return; } @@ -84,10 +84,9 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP || size < USB_DT_SS_EP_COMP_SIZE) { - dev_warn(ddev, "No SuperSpeed endpoint companion for config %d " - " interface %d altsetting %d ep %d: " - "using minimum values\n", - cfgno, inum, asnum, ep->desc.bEndpointAddress); + dev_warn(ddev, + "No SuperSpeed endpoint companion for config %d interface %d altsetting %d ep %d: using minimum values\n", + cfgno, inum, asnum, ep->desc.bEndpointAddress); /* Fill in some default values. * Leave bmAttributes as zero, which will mean no streams for @@ -110,44 +109,41 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, /* Check the various values */ if (usb_endpoint_xfer_control(&ep->desc) && desc->bMaxBurst != 0) { - dev_warn(ddev, "Control endpoint with bMaxBurst = %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to zero\n", desc->bMaxBurst, - cfgno, inum, asnum, ep->desc.bEndpointAddress); + dev_warn(ddev, + "Control endpoint with bMaxBurst = %d in config %d interface %d altsetting %d ep %d: setting to zero\n", + desc->bMaxBurst, cfgno, inum, asnum, + ep->desc.bEndpointAddress); ep->ss_ep_comp.bMaxBurst = 0; } else if (desc->bMaxBurst > 15) { - dev_warn(ddev, "Endpoint with bMaxBurst = %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to 15\n", desc->bMaxBurst, - cfgno, inum, asnum, ep->desc.bEndpointAddress); + dev_warn(ddev, + "Endpoint with bMaxBurst = %d in config %d interface %d altsetting %d ep %d: setting to 15\n", + desc->bMaxBurst, + cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bMaxBurst = 15; } if ((usb_endpoint_xfer_control(&ep->desc) || usb_endpoint_xfer_int(&ep->desc)) && desc->bmAttributes != 0) { - dev_warn(ddev, "%s endpoint with bmAttributes = %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to zero\n", - usb_endpoint_xfer_control(&ep->desc) ? "Control" : "Bulk", - desc->bmAttributes, - cfgno, inum, asnum, ep->desc.bEndpointAddress); + dev_warn(ddev, + "%s endpoint with bmAttributes = %d in config %d interface %d altsetting %d ep %d: setting to zero\n", + usb_endpoint_xfer_control(&ep->desc) ? "Control" : "Bulk", + desc->bmAttributes, + cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bmAttributes = 0; } else if (usb_endpoint_xfer_bulk(&ep->desc) && desc->bmAttributes > 16) { - dev_warn(ddev, "Bulk endpoint with more than 65536 streams in " - "config %d interface %d altsetting %d ep %d: " - "setting to max\n", - cfgno, inum, asnum, ep->desc.bEndpointAddress); + dev_warn(ddev, + "Bulk endpoint with more than 65536 streams in config %d interface %d altsetting %d ep %d: setting to max\n", + cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bmAttributes = 16; } else if (usb_endpoint_xfer_isoc(&ep->desc) && !USB_SS_SSP_ISOC_COMP(desc->bmAttributes) && USB_SS_MULT(desc->bmAttributes) > 3) { - dev_warn(ddev, "Isoc endpoint has Mult of %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to 3\n", - USB_SS_MULT(desc->bmAttributes), - cfgno, inum, asnum, ep->desc.bEndpointAddress); + dev_warn(ddev, + "Isoc endpoint has Mult of %d in config %d interface %d altsetting %d ep %d: setting to 3\n", + USB_SS_MULT(desc->bmAttributes), + cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bmAttributes = 2; } @@ -161,13 +157,12 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, else max_tx = 999999; if (le16_to_cpu(desc->wBytesPerInterval) > max_tx) { - dev_warn(ddev, "%s endpoint with wBytesPerInterval of %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to %d\n", - usb_endpoint_xfer_isoc(&ep->desc) ? "Isoc" : "Int", - le16_to_cpu(desc->wBytesPerInterval), - cfgno, inum, asnum, ep->desc.bEndpointAddress, - max_tx); + dev_warn(ddev, + "%s endpoint with wBytesPerInterval of %d in config %d interface %d altsetting %d ep %d: setting to %d\n", + usb_endpoint_xfer_isoc(&ep->desc) ? "Isoc" : "Int", + le16_to_cpu(desc->wBytesPerInterval), + cfgno, inum, asnum, ep->desc.bEndpointAddress, + max_tx); ep->ss_ep_comp.wBytesPerInterval = cpu_to_le16(max_tx); } /* Parse a possible SuperSpeedPlus isoc ep companion descriptor */ @@ -274,17 +269,17 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, else if (d->bLength >= USB_DT_ENDPOINT_SIZE) n = USB_DT_ENDPOINT_SIZE; else { - dev_warn(ddev, "config %d interface %d altsetting %d has an " - "invalid endpoint descriptor of length %d, skipping\n", - cfgno, inum, asnum, d->bLength); + dev_warn(ddev, + "config %d interface %d altsetting %d has an invalid endpoint descriptor of length %d, skipping\n", + cfgno, inum, asnum, d->bLength); goto skip_to_next_endpoint_or_interface_descriptor; } i = d->bEndpointAddress & ~USB_ENDPOINT_DIR_MASK; if (i >= 16 || i == 0) { - dev_warn(ddev, "config %d interface %d altsetting %d has an " - "invalid endpoint with address 0x%X, skipping\n", - cfgno, inum, asnum, d->bEndpointAddress); + dev_warn(ddev, + "config %d interface %d altsetting %d has an invalid endpoint with address 0x%X, skipping\n", + cfgno, inum, asnum, d->bEndpointAddress); goto skip_to_next_endpoint_or_interface_descriptor; } @@ -379,10 +374,9 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, } } if (d->bInterval < i || d->bInterval > j) { - dev_warn(ddev, "config %d interface %d altsetting %d " - "endpoint 0x%X has an invalid bInterval %d, " - "changing to %d\n", - cfgno, inum, asnum, + dev_warn(ddev, + "config %d interface %d altsetting %d endpoint 0x%X has an invalid bInterval %d, changing to %d\n", + cfgno, inum, asnum, d->bEndpointAddress, d->bInterval, n); endpoint->desc.bInterval = n; } @@ -392,9 +386,9 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, * them usable, we will try treating them as Interrupt endpoints. */ if (udev->speed == USB_SPEED_LOW && usb_endpoint_xfer_bulk(d)) { - dev_warn(ddev, "config %d interface %d altsetting %d " - "endpoint 0x%X is Bulk; changing to Interrupt\n", - cfgno, inum, asnum, d->bEndpointAddress); + dev_warn(ddev, + "config %d interface %d altsetting %d endpoint 0x%X is Bulk; changing to Interrupt\n", + cfgno, inum, asnum, d->bEndpointAddress); endpoint->desc.bmAttributes = USB_ENDPOINT_XFER_INT; endpoint->desc.bInterval = 1; if (usb_endpoint_maxp(&endpoint->desc) > 8) @@ -453,10 +447,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, */ if (udev->speed == USB_SPEED_HIGH && usb_endpoint_xfer_bulk(d)) { if (maxp != 512) - dev_warn(ddev, "config %d interface %d altsetting %d " - "bulk endpoint 0x%X has invalid maxpacket %d\n", - cfgno, inum, asnum, d->bEndpointAddress, - maxp); + dev_warn(ddev, + "config %d interface %d altsetting %d bulk endpoint 0x%X has invalid maxpacket %d\n", + cfgno, inum, asnum, d->bEndpointAddress, + maxp); } /* Parse a possible SuperSpeed endpoint companion descriptor */ @@ -535,9 +529,9 @@ static int usb_parse_interface(struct device *ddev, int cfgno, i < intfc->num_altsetting; (++i, ++alt)) { if (alt->desc.bAlternateSetting == asnum) { - dev_warn(ddev, "Duplicate descriptor for config %d " - "interface %d altsetting %d, skipping\n", - cfgno, inum, asnum); + dev_warn(ddev, + "Duplicate descriptor for config %d interface %d altsetting %d, skipping\n", + cfgno, inum, asnum); goto skip_to_next_interface_descriptor; } } @@ -562,9 +556,9 @@ static int usb_parse_interface(struct device *ddev, int cfgno, num_ep = num_ep_orig = alt->desc.bNumEndpoints; alt->desc.bNumEndpoints = 0; /* Use as a counter */ if (num_ep > USB_MAXENDPOINTS) { - dev_warn(ddev, "too many endpoints for config %d interface %d " - "altsetting %d: %d, using maximum allowed: %d\n", - cfgno, inum, asnum, num_ep, USB_MAXENDPOINTS); + dev_warn(ddev, + "too many endpoints for config %d interface %d altsetting %d: %d, using maximum allowed: %d\n", + cfgno, inum, asnum, num_ep, USB_MAXENDPOINTS); num_ep = USB_MAXENDPOINTS; } @@ -593,10 +587,9 @@ static int usb_parse_interface(struct device *ddev, int cfgno, } if (n != num_ep_orig) - dev_warn(ddev, "config %d interface %d altsetting %d has %d " - "endpoint descriptor%s, different from the interface " - "descriptor's value: %d\n", - cfgno, inum, asnum, n, plural(n), num_ep_orig); + dev_warn(ddev, + "config %d interface %d altsetting %d has %d endpoint descriptor%s, different from the interface descriptor's value: %d\n", + cfgno, inum, asnum, n, plural(n), num_ep_orig); return buffer - buffer0; skip_to_next_interface_descriptor: @@ -628,9 +621,9 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, if (config->desc.bDescriptorType != USB_DT_CONFIG || config->desc.bLength < USB_DT_CONFIG_SIZE || config->desc.bLength > size) { - dev_err(ddev, "invalid descriptor for config index %d: " - "type = 0x%X, length = %d\n", cfgidx, - config->desc.bDescriptorType, config->desc.bLength); + dev_err(ddev, "invalid descriptor for config index %d: type = 0x%X, length = %d\n", + cfgidx, config->desc.bDescriptorType, + config->desc.bLength); return -EINVAL; } cfgno = config->desc.bConfigurationValue; @@ -639,9 +632,9 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, size -= config->desc.bLength; if (nintf > USB_MAXINTERFACES) { - dev_warn(ddev, "config %d has too many interfaces: %d, " - "using maximum allowed: %d\n", - cfgno, nintf, USB_MAXINTERFACES); + dev_warn(ddev, + "config %d has too many interfaces: %d, using maximum allowed: %d\n", + cfgno, nintf, USB_MAXINTERFACES); nintf = USB_MAXINTERFACES; } @@ -654,17 +647,17 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, (buffer2 += header->bLength, size2 -= header->bLength)) { if (size2 < sizeof(struct usb_descriptor_header)) { - dev_warn(ddev, "config %d descriptor has %d excess " - "byte%s, ignoring\n", - cfgno, size2, plural(size2)); + dev_warn(ddev, + "config %d descriptor has %d excess byte%s, ignoring\n", + cfgno, size2, plural(size2)); break; } header = (struct usb_descriptor_header *) buffer2; if ((header->bLength > size2) || (header->bLength < 2)) { - dev_warn(ddev, "config %d has an invalid descriptor " - "of length %d, skipping remainder of the config\n", - cfgno, header->bLength); + dev_warn(ddev, + "config %d has an invalid descriptor of length %d, skipping remainder of the config\n", + cfgno, header->bLength); break; } @@ -674,9 +667,9 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, d = (struct usb_interface_descriptor *) header; if (d->bLength < USB_DT_INTERFACE_SIZE) { - dev_warn(ddev, "config %d has an invalid " - "interface descriptor of length %d, " - "skipping\n", cfgno, d->bLength); + dev_warn(ddev, + "config %d has an invalid interface descriptor of length %d, skipping\n", + cfgno, d->bLength); continue; } @@ -684,17 +677,16 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, if ((dev->quirks & USB_QUIRK_HONOR_BNUMINTERFACES) && n >= nintf_orig) { - dev_warn(ddev, "config %d has more interface " - "descriptors, than it declares in " - "bNumInterfaces, ignoring interface " - "number: %d\n", cfgno, inum); + dev_warn(ddev, + "config %d has more interface descriptors, than it declares in bNumInterfaces, ignoring interface number: %d\n", + cfgno, inum); continue; } if (inum >= nintf_orig) - dev_warn(ddev, "config %d has an invalid " - "interface number: %d but max is %d\n", - cfgno, inum, nintf_orig - 1); + dev_warn(ddev, + "config %d has an invalid interface number: %d but max is %d\n", + cfgno, inum, nintf_orig - 1); /* Have we already encountered this interface? * Count its altsettings @@ -725,10 +717,9 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, } if (iad_num == USB_MAXIADS) { - dev_warn(ddev, "found more Interface " - "Association Descriptors " - "than allocated for in " - "configuration %d\n", cfgno); + dev_warn(ddev, + "found more Interface Association Descriptors than allocated for in configuration %d\n", + cfgno); } else { config->intf_assoc[iad_num] = d; iad_num++; @@ -736,18 +727,18 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, } else if (header->bDescriptorType == USB_DT_DEVICE || header->bDescriptorType == USB_DT_CONFIG) - dev_warn(ddev, "config %d contains an unexpected " - "descriptor of type 0x%X, skipping\n", - cfgno, header->bDescriptorType); + dev_warn(ddev, + "config %d contains an unexpected descriptor of type 0x%X, skipping\n", + cfgno, header->bDescriptorType); } /* for ((buffer2 = buffer, size2 = size); ...) */ size = buffer2 - buffer; config->desc.wTotalLength = cpu_to_le16(buffer2 - buffer0); if (n != nintf) - dev_warn(ddev, "config %d has %d interface%s, different from " - "the descriptor's value: %d\n", - cfgno, n, plural(n), nintf_orig); + dev_warn(ddev, + "config %d has %d interface%s, different from the descriptor's value: %d\n", + cfgno, n, plural(n), nintf_orig); else if (n == 0) dev_warn(ddev, "config %d has no interfaces?\n", cfgno); config->desc.bNumInterfaces = nintf = n; @@ -759,18 +750,18 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, break; } if (j >= nintf) - dev_warn(ddev, "config %d has no interface number " - "%d\n", cfgno, i); + dev_warn(ddev, + "config %d has no interface number %d\n", + cfgno, i); } /* Allocate the usb_interface_caches and altsetting arrays */ for (i = 0; i < nintf; ++i) { j = nalts[i]; if (j > USB_MAXALTSETTING) { - dev_warn(ddev, "too many alternate settings for " - "config %d interface %d: %d, " - "using maximum allowed: %d\n", - cfgno, inums[i], j, USB_MAXALTSETTING); + dev_warn(ddev, + "too many alternate settings for config %d interface %d: %d, using maximum allowed: %d\n", + cfgno, inums[i], j, USB_MAXALTSETTING); nalts[i] = j = USB_MAXALTSETTING; } @@ -816,8 +807,9 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, break; } if (n >= intfc->num_altsetting) - dev_warn(ddev, "config %d interface %d has no " - "altsetting %d\n", cfgno, inums[i], j); + dev_warn(ddev, + "config %d interface %d has no altsetting %d\n", + cfgno, inums[i], j); } } @@ -873,8 +865,9 @@ int usb_get_configuration(struct usb_device *dev) int result; if (ncfg > USB_MAXCONFIG) { - dev_warn(ddev, "too many configurations: %d, " - "using maximum allowed: %d\n", ncfg, USB_MAXCONFIG); + dev_warn(ddev, + "too many configurations: %d, using maximum allowed: %d\n", + ncfg, USB_MAXCONFIG); dev->descriptor.bNumConfigurations = ncfg = USB_MAXCONFIG; } @@ -904,17 +897,18 @@ int usb_get_configuration(struct usb_device *dev) result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, desc, USB_DT_CONFIG_SIZE); if (result < 0) { - dev_err(ddev, "unable to read config index %d " - "descriptor/%s: %d\n", cfgno, "start", result); + dev_err(ddev, + "unable to read config index %d descriptor/%s: %d\n", + cfgno, "start", result); if (result != -EPIPE) goto err; dev_err(ddev, "chopping to %d config(s)\n", cfgno); dev->descriptor.bNumConfigurations = cfgno; break; } else if (result < 4) { - dev_err(ddev, "config index %d descriptor too short " - "(expected %i, got %i)\n", cfgno, - USB_DT_CONFIG_SIZE, result); + dev_err(ddev, + "config index %d descriptor too short (expected %i, got %i)\n", + cfgno, USB_DT_CONFIG_SIZE, result); result = -EINVAL; goto err; } @@ -934,14 +928,16 @@ int usb_get_configuration(struct usb_device *dev) result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, bigbuffer, length); if (result < 0) { - dev_err(ddev, "unable to read config index %d " - "descriptor/%s\n", cfgno, "all"); + dev_err(ddev, + "unable to read config index %d descriptor/%s\n", + cfgno, "all"); kfree(bigbuffer); goto err; } if (result < length) { - dev_warn(ddev, "config index %d descriptor too short " - "(expected %i, got %i)\n", cfgno, length, result); + dev_warn(ddev, + "config index %d descriptor too short (expected %i, got %i)\n", + cfgno, length, result); length = result; } From patchwork Tue Oct 5 13:25:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5761BC433F5 for ; Tue, 5 Oct 2021 14:06:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3EDB36115B for ; Tue, 5 Oct 2021 14:06:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235668AbhJEOIo (ORCPT ); Tue, 5 Oct 2021 10:08:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235962AbhJEOIL (ORCPT ); Tue, 5 Oct 2021 10:08:11 -0400 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050::465:202]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AABAC08EA40; Tue, 5 Oct 2021 07:03:43 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [80.241.60.233]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4HNznp3chKzQkhP; Tue, 5 Oct 2021 16:03:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=FjhFDSUGW84ijFVsp75XszYo7omZ7fAAJfvDmYT0TrY=; b=ZtEC+IyPjitXcMx3oBuEtSjC1lVaSKGkadE+qQFTF8oTuOmJctM+9uOt5DVaMlFfJOVW37 uvFAgJ0E0LvwE28pFNdZHAR/2l98BgbqkgksgFi0Cx+49dN5XlXBrI2eszq6WLxcjamlK2 oT57zlo2VsT3lcHxZ7JBChSpg9Bo8ssq4rpzBlIsXp2qLQKFBIRY72nTUqGrqy6gcZtEe9 xagMeARqE44+5R4id41ONWWGvJqRcmPZNzU9u4wZcuyzP78/mGFYvRGcdFt2E2t6A8kYkc /kg/3tDzYnMPKmKw036tHqWuj+0mrk8IioddTx6m/+qO3QA3Pw8sH6+nSkogsg== X-Mailbox-Line: From 3d00fef299d94804b5719e36f398e42deb760bc9 Mon Sep 17 00:00:00 2001 Message-Id: <3d00fef299d94804b5719e36f398e42deb760bc9.1633442131.git.rob@robgreener.com> In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 14:25:33 +0100 Subject: [PATCH 07/13] usb: core: config: remove unnecessary blank lines X-Rspamd-Queue-Id: A03EF274 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This patch fixes the following checkpatch.pl warning at multiple locations: CHECK:LINE_SPACING: Please don't use multiple blank lines Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 51c590da7651..af88cfe52e92 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -13,12 +13,10 @@ #include #include "usb.h" - #define USB_MAXALTSETTING 128 /* Hard limit */ #define USB_MAXCONFIG 8 /* Arbitrary limit */ - static inline const char *plural(int n) { return (n == 1 ? "" : "s"); @@ -848,7 +846,6 @@ void usb_destroy_configuration(struct usb_device *dev) dev->config = NULL; } - /* * Get the USB config descriptors, cache and parse'em * From patchwork Tue Oct 5 13:26:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538091 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91F41C433EF for ; Tue, 5 Oct 2021 14:06:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7BF6A6115B for ; Tue, 5 Oct 2021 14:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235748AbhJEOIr (ORCPT ); Tue, 5 Oct 2021 10:08:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235940AbhJEOIL (ORCPT ); Tue, 5 Oct 2021 10:08:11 -0400 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050::465:202]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E9F7C08E90E; Tue, 5 Oct 2021 07:03:40 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [80.241.60.233]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4HNznr4bgtzQkhq; Tue, 5 Oct 2021 16:03:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=WPntSniBfBJXxI5Bu1inF6s7l6kqvEphqLuLAFznXlk=; b=uf5vFbgRylcbHETK1Ct1/UqU5KjigATy5lkAj9HLTB54vt1mx6S8m8Z7kJCDnqG/k/K+QZ y69Sf3xyWhoTKgBcvPnw8pySdzoUo4Kgi2hkwVIuTfH2Xb9oMQPnbEyod5F6gFBNdqwUl+ Rr61nJhbbqixjVE6bRn6EnCOgYqN0z8CJd39dHine5x98Nm5N5sCCD8MQxGzSVsFWgMTnV QUQyU+dMeyQeKeqIX7LXacCTfvfv7PSah8JcOjIdAtpganEgT2Dm9qDeaeYAhK/RiH28OP g9woj8KRU0Xu537VQ7lnG3BlCh3qwbp4wtBngK/Q3hwpJ8TnQElvkce5Pd//Zg== X-Mailbox-Line: From 7ccbda3348ab1806edf5c0d91e655b1bcec7f2c1 Mon Sep 17 00:00:00 2001 Message-Id: <7ccbda3348ab1806edf5c0d91e655b1bcec7f2c1.1633442131.git.rob@robgreener.com> In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 14:26:43 +0100 Subject: [PATCH 08/13] usb: core: config: add blank lines after struct def X-Rspamd-Queue-Id: E7D7426C To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This fixes the following checkpatch.pl warning at multiple locations: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index af88cfe52e92..3bf04fdf850a 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -176,12 +176,14 @@ static const unsigned short low_speed_maxpacket_maxes[4] = { [USB_ENDPOINT_XFER_BULK] = 0, [USB_ENDPOINT_XFER_INT] = 8, }; + static const unsigned short full_speed_maxpacket_maxes[4] = { [USB_ENDPOINT_XFER_CONTROL] = 64, [USB_ENDPOINT_XFER_ISOC] = 1023, [USB_ENDPOINT_XFER_BULK] = 64, [USB_ENDPOINT_XFER_INT] = 64, }; + static const unsigned short high_speed_maxpacket_maxes[4] = { [USB_ENDPOINT_XFER_CONTROL] = 64, [USB_ENDPOINT_XFER_ISOC] = 1024, @@ -190,6 +192,7 @@ static const unsigned short high_speed_maxpacket_maxes[4] = { [USB_ENDPOINT_XFER_BULK] = 1024, [USB_ENDPOINT_XFER_INT] = 1024, }; + static const unsigned short super_speed_maxpacket_maxes[4] = { [USB_ENDPOINT_XFER_CONTROL] = 512, [USB_ENDPOINT_XFER_ISOC] = 1024, From patchwork Tue Oct 5 13:30:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56267C433EF for ; Tue, 5 Oct 2021 14:07:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42B9A61131 for ; Tue, 5 Oct 2021 14:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235933AbhJEOIt (ORCPT ); Tue, 5 Oct 2021 10:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235990AbhJEOIM (ORCPT ); Tue, 5 Oct 2021 10:08:12 -0400 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [IPv6:2001:67c:2050::465:102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A5E0C08EA48; Tue, 5 Oct 2021 07:03:43 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4HNzns1vgVzQkBh; Tue, 5 Oct 2021 16:03:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=rNhLsyCLq4qKkSJBH/0nPNy5VFhxhCPgg0+RJqtGwSk=; b=SQh2lnE/BURZjkTtevZt0SP9aRQbLYNMpdTZW5kejxb/2OyVOYCtOcXDKFuUaoZ+aXR2JZ MkdnZztGCG5okULr2x6HWwSR0rc/+454Lzrb9GpXxOw3vINlnLYP/qAk4if8XepAgKNNMN MA3ehDm+3JkqAICmxjVbH/7H7ttE/Q/ihm/1kirZ6L+996bIFwPPsirc21JSGUx3G8VyIY kuF0dpuzSn/vWxTqYqzyGgWis2+FYPnB+1fH5Cz1pjBq9QwCS/1EZeTv67rBv5I26JkQox x3vMLIlpuXpLh8SJalXAHqaXUfjZl2Grp2y0bn2WPzjfB9UTg9aTTh1llFF/Uw== X-Mailbox-Line: From d36b554ae066057954eda49dbadb4e1d97323bfd Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 14:30:49 +0100 Subject: [PATCH 09/13] usb: core: config: fix inline spacign X-Rspamd-Queue-Id: 87B6C272 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This fixes the following checkpatch.pl warnings: (many locations) CHECK:SPACING: No space is necessary after a cast core/config.c:332: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 3bf04fdf850a..9717f89bcb6f 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -31,7 +31,7 @@ static int find_next_descriptor(unsigned char *buffer, int size, /* Find the next descriptor of type dt1 or dt2 */ while (size > 0) { - h = (struct usb_descriptor_header *) buffer; + h = (struct usb_descriptor_header *)buffer; if (h->bDescriptorType == dt1 || h->bDescriptorType == dt2) break; buffer += h->bLength; @@ -57,7 +57,7 @@ static void usb_parse_ssp_isoc_endpoint_companion(struct device *ddev, * The SuperSpeedPlus Isoc endpoint companion descriptor immediately * follows the SuperSpeed Endpoint Companion descriptor */ - desc = (struct usb_ssp_isoc_ep_comp_descriptor *) buffer; + desc = (struct usb_ssp_isoc_ep_comp_descriptor *)buffer; if (desc->bDescriptorType != USB_DT_SSP_ISOC_ENDPOINT_COMP || size < USB_DT_SSP_ISOC_EP_COMP_SIZE) { dev_warn(ddev, @@ -78,7 +78,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, /* The SuperSpeed endpoint companion descriptor is supposed to * be the first thing immediately following the endpoint descriptor. */ - desc = (struct usb_ss_ep_comp_descriptor *) buffer; + desc = (struct usb_ss_ep_comp_descriptor *)buffer; if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP || size < USB_DT_SS_EP_COMP_SIZE) { @@ -261,7 +261,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, unsigned int maxp; const unsigned short *maxpacket_maxes; - d = (struct usb_endpoint_descriptor *) buffer; + d = (struct usb_endpoint_descriptor *)buffer; buffer += d->bLength; size -= d->bLength; @@ -329,7 +329,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, * descriptors. Try to fix those and fall back to an * 8-ms default value otherwise. */ - n = fls(d->bInterval*8); + n = fls(d->bInterval * 8); if (n == 0) n = 7; /* 8 ms = 2^(7-1) uframes */ j = 16; @@ -505,7 +505,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno, int len, retval; int num_ep, num_ep_orig; - d = (struct usb_interface_descriptor *) buffer; + d = (struct usb_interface_descriptor *)buffer; buffer += d->bLength; size -= d->bLength; @@ -574,7 +574,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno, /* Parse all the endpoint descriptors */ n = 0; while (size > 0) { - if (((struct usb_descriptor_header *) buffer)->bDescriptorType + if (((struct usb_descriptor_header *)buffer)->bDescriptorType == USB_DT_INTERFACE) break; retval = usb_parse_endpoint(ddev, cfgno, config, inum, asnum, @@ -654,7 +654,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, break; } - header = (struct usb_descriptor_header *) buffer2; + header = (struct usb_descriptor_header *)buffer2; if ((header->bLength > size2) || (header->bLength < 2)) { dev_warn(ddev, "config %d has an invalid descriptor of length %d, skipping remainder of the config\n", @@ -666,7 +666,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, struct usb_interface_descriptor *d; int inum; - d = (struct usb_interface_descriptor *) header; + d = (struct usb_interface_descriptor *)header; if (d->bLength < USB_DT_INTERFACE_SIZE) { dev_warn(ddev, "config %d has an invalid interface descriptor of length %d, skipping\n", @@ -912,7 +912,7 @@ int usb_get_configuration(struct usb_device *dev) result = -EINVAL; goto err; } - length = max((int) le16_to_cpu(desc->wTotalLength), + length = max((int)le16_to_cpu(desc->wTotalLength), USB_DT_CONFIG_SIZE); /* Now that we know the length, get the whole thing */ From patchwork Tue Oct 5 13:34:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6506C43219 for ; Tue, 5 Oct 2021 14:06:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9441E61131 for ; Tue, 5 Oct 2021 14:06:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235597AbhJEOIq (ORCPT ); Tue, 5 Oct 2021 10:08:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235960AbhJEOIL (ORCPT ); Tue, 5 Oct 2021 10:08:11 -0400 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [IPv6:2001:67c:2050::465:102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44A4CC08E90F; Tue, 5 Oct 2021 07:03:43 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4HNzns1ZgYzQk3d; Tue, 5 Oct 2021 16:03:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=UVWMT03HEQyFx2aXE/nLl7IrocPT7phhra9kOwhx2ak=; b=v3eGTvXkTX+iQy7r/mNMr6/kvRq9ASiM1Glmn7VAvDFtZ3oDLjewQA8v8SzCT79Y8dPmEc ZsN9kS0UuP0BlM6BSoSbkmcehGa1dsBRMvQGB1bHCzcw7/epsl3G4RRqdBR3Fi9Qe2P4pE E8CK4HmbqhN1FiF0jKPBVizOnnMvwncDiy8Z9KJ8l1QkJrN8ubDsXESk3TmJO8SuLeUBD0 6vbOx7/u18mvc9x2e1aBroMcpdaDo2X107gR+2qq/MoiSJ106rIbTdQNOcNnThyd3IUpPV gTtSc6bEVPebAmsNzw+BPb9JZg+Ygd+4/9DlAsXyibaz8EgCGOW3GeZ9dgO7qw== X-Mailbox-Line: From 9fb688c9a39a9114a6137361dc4a143d7a198822 Mon Sep 17 00:00:00 2001 Message-Id: <9fb688c9a39a9114a6137361dc4a143d7a198822.1633442131.git.rob@robgreener.com> In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 14:34:03 +0100 Subject: [PATCH 10/13] usb: core: config: fix checkpatch.pl braces warning X-Rspamd-Queue-Id: 7D869271 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This fixes the following checkpatch.pl warnings: core/config.c:268: CHECK:BRACES: braces {} should be used on all arms of this statement core/config.c:272: CHECK:BRACES: Unbalanced braces around else statement core/config.c:649: CHECK:BRACES: Blank lines aren't necessary after an open brace '{' Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 9717f89bcb6f..76038e8c84c5 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -265,11 +265,12 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, buffer += d->bLength; size -= d->bLength; - if (d->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE) + if (d->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE) { n = USB_DT_ENDPOINT_AUDIO_SIZE; - else if (d->bLength >= USB_DT_ENDPOINT_SIZE) + } + else if (d->bLength >= USB_DT_ENDPOINT_SIZE) { n = USB_DT_ENDPOINT_SIZE; - else { + } else { dev_warn(ddev, "config %d interface %d altsetting %d has an invalid endpoint descriptor of length %d, skipping\n", cfgno, inum, asnum, d->bLength); @@ -646,7 +647,6 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, for ((buffer2 = buffer, size2 = size); size2 > 0; (buffer2 += header->bLength, size2 -= header->bLength)) { - if (size2 < sizeof(struct usb_descriptor_header)) { dev_warn(ddev, "config %d descriptor has %d excess byte%s, ignoring\n", From patchwork Tue Oct 5 13:37:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 794BCC433EF for ; Tue, 5 Oct 2021 14:07:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63172611F2 for ; Tue, 5 Oct 2021 14:07:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235839AbhJEOJZ (ORCPT ); Tue, 5 Oct 2021 10:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235790AbhJEOIJ (ORCPT ); Tue, 5 Oct 2021 10:08:09 -0400 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050::465:201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95884C08E870; Tue, 5 Oct 2021 07:03:31 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4HNznt0nwYzQlXv; Tue, 5 Oct 2021 16:03:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=Vyb27ZqtjS+tKU7zZ0G+derFOD0cVxMh9MjB5mxAUo8=; b=QNQnpkWdCRNqU7B1CNHTZXGNRUiSDmgtEP/yKhjgNc20T+d0RAxL4QsKPY80ZPR4aaCVQM MyLjDl3Wzgf7HNI0reqmTs57zqDZZC6idSGLZKNLRjzx7L5TVMemvtVg/KSDGsqp2ktEka tGKKwj0fnyh1E3uG771tLRkZvhNlTArZeC9GFAqvUrFpAfIt3ebfcCjsBFgWfc3XFYnb1V PLCJORH9jFoqwkYnWFRvyppuPgyR8j3wEjv5cDYhqtIgiSUFGUkq4iMfQctsh0fQ++hQ/E 0xQD5nm1ceikpcN4qTruefFv91y9Dn8b/a5XQ4Fhyxw+wE8qLKS4yzjjyvvz1w== X-Mailbox-Line: From 46320ab3bcc30f51da1f1dacf24eeed082690fa2 Mon Sep 17 00:00:00 2001 Message-Id: <46320ab3bcc30f51da1f1dacf24eeed082690fa2.1633442131.git.rob@robgreener.com> In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 14:37:35 +0100 Subject: [PATCH 11/13] usb: core: config: remove unnecessary parentheses X-Rspamd-Queue-Id: 5E8952A7 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This fixes the following checkpatch.pl warnings: core/config.c:657: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'header->bLength > size2' core/config.c:657: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'header->bLength < 2' Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 76038e8c84c5..ab3395ec4260 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -267,8 +267,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, if (d->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE) { n = USB_DT_ENDPOINT_AUDIO_SIZE; - } - else if (d->bLength >= USB_DT_ENDPOINT_SIZE) { + } else if (d->bLength >= USB_DT_ENDPOINT_SIZE) { n = USB_DT_ENDPOINT_SIZE; } else { dev_warn(ddev, @@ -655,7 +654,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, } header = (struct usb_descriptor_header *)buffer2; - if ((header->bLength > size2) || (header->bLength < 2)) { + if (header->bLength > size2 || header->bLength < 2) { dev_warn(ddev, "config %d has an invalid descriptor of length %d, skipping remainder of the config\n", cfgno, header->bLength); From patchwork Tue Oct 5 13:43:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538099 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7719C433FE for ; Tue, 5 Oct 2021 14:07:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFCE3611F2 for ; Tue, 5 Oct 2021 14:07:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235266AbhJEOJY (ORCPT ); Tue, 5 Oct 2021 10:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235805AbhJEOIJ (ORCPT ); Tue, 5 Oct 2021 10:08:09 -0400 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [IPv6:2001:67c:2050::465:101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AB21C08E876; Tue, 5 Oct 2021 07:03:32 -0700 (PDT) Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4HNznt6q56zQkBY; Tue, 5 Oct 2021 16:03:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=4yU91kg1vQx6jyFicaSxV6cIZEe01aqr2KGabcn8IAs=; b=RMBEXpmwUGL2U5lOIXSm4tNcQ9vEsnZ2rcNquWgZGCV5BlqaPHzBp+lBH0rSe22Eoq5zqd c9Mm4CKX3O5eAbTYG43PMGw9T1JWOhp8k3kfz4z/FwQp4bbAjQcus+LUPCSywYlCd/DgmF DhJjAauKBocmht3m40Gz9qo1fkyZ9wyqTOBCDkijKlZCA3Ti9H+2Wxf1ABFU9T9OE72AJX +w7YEdQZScxam4m1/6enYGem6rnc7abIgm5nJqlXzFIF+kchqXAszxkyK+C0A8hDkox/A7 5UlA2a2atm/S1FRLHsOq1wfpS9thFGQBRa0ukyv//nkHVCTOhiYX/rXW2usTdA== X-Mailbox-Line: From af1fb8e9de157431a5a912f7a03f6ff70d4263cd Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 14:43:08 +0100 Subject: [PATCH 12/13] usb: core: config: remove multiple assignments X-Rspamd-Queue-Id: 36DF8188F To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This fixes the following checkpatch.pl warning at multiple locations: CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index ab3395ec4260..1fe995a66182 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -342,7 +342,8 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, */ if (udev->quirks & USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL) { n = clamp(fls(d->bInterval) + 3, i, j); - i = j = n; + j = n; + i = j; } /* * This quirk fixes bIntervals reported in @@ -350,7 +351,8 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, */ if (udev->quirks & USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL) { n = clamp(fls(d->bInterval), i, j); - i = j = n; + j = n; + i = j; } break; default: /* USB_SPEED_FULL or _LOW */ @@ -554,7 +556,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno, size -= i; /* Allocate space for the right(?) number of endpoints */ - num_ep = num_ep_orig = alt->desc.bNumEndpoints; + num_ep_orig = alt->desc.bNumEndpoints; + num_ep = num_ep_orig; alt->desc.bNumEndpoints = 0; /* Use as a counter */ if (num_ep > USB_MAXENDPOINTS) { dev_warn(ddev, @@ -616,7 +619,8 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, unsigned int iad_num = 0; memcpy(&config->desc, buffer, USB_DT_CONFIG_SIZE); - nintf = nintf_orig = config->desc.bNumInterfaces; + nintf_orig = config->desc.bNumInterfaces; + nintf = nintf_orig; config->desc.bNumInterfaces = 0; // Adjusted later if (config->desc.bDescriptorType != USB_DT_CONFIG || @@ -741,7 +745,8 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, cfgno, n, plural(n), nintf_orig); else if (n == 0) dev_warn(ddev, "config %d has no interfaces?\n", cfgno); - config->desc.bNumInterfaces = nintf = n; + nintf = n; + config->desc.bNumInterfaces = nintf; /* Check for missing interface numbers */ for (i = 0; i < nintf; ++i) { @@ -762,7 +767,8 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, dev_warn(ddev, "too many alternate settings for config %d interface %d: %d, using maximum allowed: %d\n", cfgno, inums[i], j, USB_MAXALTSETTING); - nalts[i] = j = USB_MAXALTSETTING; + j = USB_MAXALTSETTING; + nalts[i] = j; } intfc = kzalloc(struct_size(intfc, altsetting, j), GFP_KERNEL); @@ -867,7 +873,8 @@ int usb_get_configuration(struct usb_device *dev) dev_warn(ddev, "too many configurations: %d, using maximum allowed: %d\n", ncfg, USB_MAXCONFIG); - dev->descriptor.bNumConfigurations = ncfg = USB_MAXCONFIG; + ncfg = USB_MAXCONFIG; + dev->descriptor.bNumConfigurations = ncfg; } if (ncfg < 1) { From patchwork Tue Oct 5 13:52:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Greener X-Patchwork-Id: 12538105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FCDEC433FE for ; Tue, 5 Oct 2021 14:07:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDB0B61165 for ; Tue, 5 Oct 2021 14:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235962AbhJEOJ2 (ORCPT ); Tue, 5 Oct 2021 10:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235841AbhJEOIK (ORCPT ); Tue, 5 Oct 2021 10:08:10 -0400 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [IPv6:2001:67c:2050::465:102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D62A7C08E89D; Tue, 5 Oct 2021 07:03:36 -0700 (PDT) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4HNznz0VLHzQkjm; Tue, 5 Oct 2021 16:03:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=robgreener.com; s=MBO0001; t=1633442613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:in-reply-to:in-reply-to:references:references; bh=ug6rDDzpKnA56k+77e0aEXwzq5oBN6KdvkwcQyZ0wkg=; b=OQEop257I0oKisJVYuxZnizx4T6JSIK/bdk+gxoKzoTC/1r6cp31FqKuSYoR/LX/XysGCv 4b1xTlNZ2TtBOQWgxQFyd9SuC5Ashu2bCG5xzp/+8oVO/GZGAsh0tWlCUWP7uPMpngIEsE gKHrXuDf68YRVjQXFpfrsWmUX2G/ookPQleyy7iYbw9Cdzn4pFBKoQoVZ31jK+PWOO6ckO YfKtTVaiFdxqBYx0YGezBSFYYAf0jYb4w2Sx7dT+SxU0lCR+/5IWv4Ug+rMe1LgFjawHJV Kncu+iHWo5J2Ln1x4VTx30/OY8wgTcvnxgJ+NHk6VfsKogRFGIo0pALOe8pd2Q== X-Mailbox-Line: From 835bbc4e27ca989674fb916f70b81038deaf47e5 Mon Sep 17 00:00:00 2001 Message-Id: <835bbc4e27ca989674fb916f70b81038deaf47e5.1633442131.git.rob@robgreener.com> In-Reply-To: References: From: Robert Greener Date: Tue, 5 Oct 2021 14:52:43 +0100 Subject: [PATCH 13/13] usb: core: config: fix parenthesis alignment X-Rspamd-Queue-Id: 4981426E To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Fixes the following checkpatch.pl warnings at various locations: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis Signed-off-by: Robert Greener --- drivers/usb/core/config.c | 87 +++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 1fe995a66182..94de1476e9d0 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -23,7 +23,7 @@ static inline const char *plural(int n) } static int find_next_descriptor(unsigned char *buffer, int size, - int dt1, int dt2, int *num_skipped) + int dt1, int dt2, int *num_skipped) { struct usb_descriptor_header *h; int n = 0; @@ -48,8 +48,11 @@ static int find_next_descriptor(unsigned char *buffer, int size, } static void usb_parse_ssp_isoc_endpoint_companion(struct device *ddev, - int cfgno, int inum, int asnum, struct usb_host_endpoint *ep, - unsigned char *buffer, int size) + int cfgno, int inum, + int asnum, + struct usb_host_endpoint *ep, + unsigned char *buffer, + int size) { struct usb_ssp_isoc_ep_comp_descriptor *desc; @@ -69,8 +72,9 @@ static void usb_parse_ssp_isoc_endpoint_companion(struct device *ddev, } static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, - int inum, int asnum, struct usb_host_endpoint *ep, - unsigned char *buffer, int size) + int inum, int asnum, + struct usb_host_endpoint *ep, + unsigned char *buffer, int size) { struct usb_ss_ep_comp_descriptor *desc; int max_tx; @@ -81,7 +85,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, desc = (struct usb_ss_ep_comp_descriptor *)buffer; if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP || - size < USB_DT_SS_EP_COMP_SIZE) { + size < USB_DT_SS_EP_COMP_SIZE) { dev_warn(ddev, "No SuperSpeed endpoint companion for config %d interface %d altsetting %d ep %d: using minimum values\n", cfgno, inum, asnum, ep->desc.bEndpointAddress); @@ -96,7 +100,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, ep->ss_ep_comp.bLength = USB_DT_SS_EP_COMP_SIZE; ep->ss_ep_comp.bDescriptorType = USB_DT_SS_ENDPOINT_COMP; if (usb_endpoint_xfer_isoc(&ep->desc) || - usb_endpoint_xfer_int(&ep->desc)) + usb_endpoint_xfer_int(&ep->desc)) ep->ss_ep_comp.wBytesPerInterval = ep->desc.wMaxPacketSize; return; @@ -121,8 +125,8 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, } if ((usb_endpoint_xfer_control(&ep->desc) || - usb_endpoint_xfer_int(&ep->desc)) && - desc->bmAttributes != 0) { + usb_endpoint_xfer_int(&ep->desc)) && + desc->bmAttributes != 0) { dev_warn(ddev, "%s endpoint with bmAttributes = %d in config %d interface %d altsetting %d ep %d: setting to zero\n", usb_endpoint_xfer_control(&ep->desc) ? "Control" : "Bulk", @@ -167,7 +171,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, if (usb_endpoint_xfer_isoc(&ep->desc) && USB_SS_SSP_ISOC_COMP(desc->bmAttributes)) usb_parse_ssp_isoc_endpoint_companion(ddev, cfgno, inum, asnum, - ep, buffer, size); + ep, buffer, size); } static const unsigned short low_speed_maxpacket_maxes[4] = { @@ -201,7 +205,7 @@ static const unsigned short super_speed_maxpacket_maxes[4] = { }; static bool endpoint_is_duplicate(struct usb_endpoint_descriptor *e1, - struct usb_endpoint_descriptor *e2) + struct usb_endpoint_descriptor *e2) { if (e1->bEndpointAddress == e2->bEndpointAddress) return true; @@ -219,7 +223,8 @@ static bool endpoint_is_duplicate(struct usb_endpoint_descriptor *e1, * altsetting currently being parsed. */ static bool config_endpoint_is_duplicate(struct usb_host_config *config, - int inum, int asnum, struct usb_endpoint_descriptor *d) + int inum, int asnum, + struct usb_endpoint_descriptor *d) { struct usb_endpoint_descriptor *epd; struct usb_interface_cache *intfc; @@ -233,7 +238,7 @@ static bool config_endpoint_is_duplicate(struct usb_host_config *config, alt = &intfc->altsetting[j]; if (alt->desc.bInterfaceNumber == inum && - alt->desc.bAlternateSetting != asnum) + alt->desc.bAlternateSetting != asnum) continue; for (k = 0; k < alt->desc.bNumEndpoints; ++k) { @@ -249,9 +254,9 @@ static bool config_endpoint_is_duplicate(struct usb_host_config *config, } static int usb_parse_endpoint(struct device *ddev, int cfgno, - struct usb_host_config *config, int inum, int asnum, - struct usb_host_interface *ifp, int num_ep, - unsigned char *buffer, int size) + struct usb_host_config *config, int inum, + int asnum, struct usb_host_interface *ifp, + int num_ep, unsigned char *buffer, int size) { struct usb_device *udev = to_usb_device(ddev); unsigned char *buffer0 = buffer; @@ -291,7 +296,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, /* Check for duplicate endpoint addresses */ if (config_endpoint_is_duplicate(config, inum, asnum, d)) { dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", - cfgno, inum, asnum, d->bEndpointAddress); + cfgno, inum, asnum, d->bEndpointAddress); goto skip_to_next_endpoint_or_interface_descriptor; } @@ -299,8 +304,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, if (udev->quirks & USB_QUIRK_ENDPOINT_IGNORE) { if (usb_endpoint_is_ignored(udev, ifp, d)) { dev_warn(ddev, "config %d interface %d altsetting %d has an ignored endpoint with address 0x%X, skipping\n", - cfgno, inum, asnum, - d->bEndpointAddress); + cfgno, inum, asnum, d->bEndpointAddress); goto skip_to_next_endpoint_or_interface_descriptor; } } @@ -407,7 +411,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, maxp = usb_endpoint_maxp(&endpoint->desc); if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) { dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", - cfgno, inum, asnum, d->bEndpointAddress); + cfgno, inum, asnum, d->bEndpointAddress); } /* Find the highest legal maxpacket size for this endpoint */ @@ -438,7 +442,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, if (maxp > j) { dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid maxpacket %d, setting to %d\n", - cfgno, inum, asnum, d->bEndpointAddress, maxp, j); + cfgno, inum, asnum, d->bEndpointAddress, maxp, j); maxp = j; endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp); } @@ -459,24 +463,24 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, /* Parse a possible SuperSpeed endpoint companion descriptor */ if (udev->speed >= USB_SPEED_SUPER) usb_parse_ss_endpoint_companion(ddev, cfgno, - inum, asnum, endpoint, buffer, size); + inum, asnum, endpoint, buffer, size); /* Skip over any Class Specific or Vendor Specific descriptors; * find the next endpoint or interface descriptor */ endpoint->extra = buffer; i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT, - USB_DT_INTERFACE, &n); + USB_DT_INTERFACE, &n); endpoint->extralen = i; retval = buffer - buffer0 + i; if (n > 0) dev_dbg(ddev, "skipped %d descriptor%s after %s\n", - n, plural(n), "endpoint"); + n, plural(n), "endpoint"); return retval; skip_to_next_endpoint_or_interface_descriptor: i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT, - USB_DT_INTERFACE, NULL); + USB_DT_INTERFACE, NULL); return buffer - buffer0 + i; } @@ -495,8 +499,9 @@ void usb_release_interface_cache(struct kref *ref) } static int usb_parse_interface(struct device *ddev, int cfgno, - struct usb_host_config *config, unsigned char *buffer, int size, - s[], u8 nalts[]) + struct usb_host_config *config, + unsigned char *buffer, int size, s[], + u8 nalts[]) { unsigned char *buffer0 = buffer; struct usb_interface_descriptor *d; @@ -547,11 +552,11 @@ static int usb_parse_interface(struct device *ddev, int cfgno, */ alt->extra = buffer; i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT, - USB_DT_INTERFACE, &n); + USB_DT_INTERFACE, &n); alt->extralen = i; if (n > 0) dev_dbg(ddev, "skipped %d descriptor%s after %s\n", - n, plural(n), "interface"); + n, plural(n), "interface"); buffer += i; size -= i; @@ -581,7 +586,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno, == USB_DT_INTERFACE) break; retval = usb_parse_endpoint(ddev, cfgno, config, inum, asnum, - alt, num_ep, buffer, size); + alt, num_ep, buffer, size); if (retval < 0) return retval; ++n; @@ -598,12 +603,13 @@ static int usb_parse_interface(struct device *ddev, int cfgno, skip_to_next_interface_descriptor: i = find_next_descriptor(buffer, size, USB_DT_INTERFACE, - USB_DT_INTERFACE, NULL); + USB_DT_INTERFACE, NULL); return buffer - buffer0 + i; } static int usb_parse_configuration(struct usb_device *dev, int cfgidx, - struct usb_host_config *config, unsigned char *buffer, int size) + struct usb_host_config *config, + unsigned char *buffer, int size) { struct device *ddev = &dev->dev; unsigned char *buffer0 = buffer; @@ -785,18 +791,18 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx, */ config->extra = buffer; i = find_next_descriptor(buffer, size, USB_DT_INTERFACE, - USB_DT_INTERFACE, &n); + USB_DT_INTERFACE, &n); config->extralen = i; if (n > 0) dev_dbg(ddev, "skipped %d descriptor%s after %s\n", - n, plural(n), "configuration"); + n, plural(n), "configuration"); buffer += i; size -= i; /* Parse all the interface/altsetting descriptors */ while (size > 0) { retval = usb_parse_interface(ddev, cfgno, config, - buffer, size, inums, nalts); + buffer, size, inums, nalts); if (retval < 0) return retval; @@ -847,7 +853,7 @@ void usb_destroy_configuration(struct usb_device *dev) for (i = 0; i < cf->desc.bNumInterfaces; i++) { if (cf->intf_cache[i]) kref_put(&cf->intf_cache[i]->ref, - usb_release_interface_cache); + usb_release_interface_cache); } } kfree(dev->config); @@ -901,7 +907,7 @@ int usb_get_configuration(struct usb_device *dev) * the whole configuration is */ result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, - desc, USB_DT_CONFIG_SIZE); + desc, USB_DT_CONFIG_SIZE); if (result < 0) { dev_err(ddev, "unable to read config index %d descriptor/%s: %d\n", @@ -919,7 +925,7 @@ int usb_get_configuration(struct usb_device *dev) goto err; } length = max((int)le16_to_cpu(desc->wTotalLength), - USB_DT_CONFIG_SIZE); + USB_DT_CONFIG_SIZE); /* Now that we know the length, get the whole thing */ bigbuffer = kmalloc(length, GFP_KERNEL); @@ -932,7 +938,7 @@ int usb_get_configuration(struct usb_device *dev) msleep(200); result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, - bigbuffer, length); + bigbuffer, length); if (result < 0) { dev_err(ddev, "unable to read config index %d descriptor/%s\n", @@ -950,7 +956,8 @@ int usb_get_configuration(struct usb_device *dev) dev->rawdescriptors[cfgno] = bigbuffer; result = usb_parse_configuration(dev, cfgno, - &dev->config[cfgno], bigbuffer, length); + &dev->config[cfgno], + bigbuffer, length); if (result < 0) { ++cfgno; goto err;