From patchwork Thu Mar 17 03:55:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent MAILHOL X-Patchwork-Id: 553313 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC8C2C433F5 for ; Thu, 17 Mar 2022 06:06:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbiCQGHe (ORCPT ); Thu, 17 Mar 2022 02:07:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbiCQGH2 (ORCPT ); Thu, 17 Mar 2022 02:07:28 -0400 Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FA131877DD for ; Wed, 16 Mar 2022 22:41:38 -0700 (PDT) Received: by mail-oo1-xc2d.google.com with SMTP id y27-20020a4a9c1b000000b0032129651bb0so5308859ooj.2 for ; Wed, 16 Mar 2022 22:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eKWoLdilS/xkKbSS5GySewhiz9ZErVZagSWCzPknuLE=; b=FqXuQMOFnqBE6bBsSlhdI9alOQYxAXLxS1CVr9WBBV27+wmlxvyiJAJsuCOVNCEvTI OiRVsBxxfskJhw4mp8BDrpBVgGNBmdRWuoFVZzS1SXVXRef0/9Zb/LLZaaFw3qymSu9U IYFQU4OuToy939E5Uth2ceMjbFEBOKYv+VuH0is529E0CuqukhqXdGN3hIGx3E0XPb/d nCcOaDQwL1Ykp0CVfJNd6RAxgp1XTYRLCoMllt1FHHI7qWiltBzXR7xNQVHHHMPaMSk2 fyznGvU76N8NeDz8EjluTiI3hb3dRlmNTpocoPJP+tCfKdXmjwS8oSKehgur/dxw0OvQ YHjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=eKWoLdilS/xkKbSS5GySewhiz9ZErVZagSWCzPknuLE=; b=iKQriGID8RGuFHrOFCwGZIgKpb/QOXX0OETagAd/LdFv7RQM/o/K0Y9iyyVY5cHdTe 2KS0H7iri3KAnorcTzuC+ZBr6XjOa0jCMyzeru0X2kPJMuFDbCVi/iftZToHQyr6U2X2 WgWVJLy6YBGCW77lt4DhXgoNMwKKMfN0xCgGz6fP6Jv+tefvu4GOkXKojHEHnCEqdM9+ iKODSyA/7uSXrIYY0YRd0/bcappAm60W7iIx2CKDO3YDoFYCr8791cW+r8aP1LsOmKqp /0OobDCcmp+n6gwmfXdlDW3IG3lPMn+dLlDlVmFEd3uCSfvHA2wHluL+iWiUp91m22Sh Pxow== X-Gm-Message-State: AOAM530wCMrB1N4pcg3y66lolH7hnbhOXDP6D1swnzmmVOqGIOxcUaUq REITCFi4ux1I0xGro966kF1+n5di0AI= X-Google-Smtp-Source: ABdhPJyPbBaLrJCUcNtWWIB1eRklnVSjmo82iUkp9BVVNv/0J7Whh7i/mwE4q0vX4tyeUVsDuoAsKw== X-Received: by 2002:a17:90a:6c02:b0:1c6:1173:6880 with SMTP id x2-20020a17090a6c0200b001c611736880mr13731401pjj.171.1647489334552; Wed, 16 Mar 2022 20:55:34 -0700 (PDT) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id e6-20020a056a001a8600b004f78e446ff5sm5096734pfv.15.2022.03.16.20.55.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 20:55:34 -0700 (PDT) Sender: Vincent Mailhol From: Vincent Mailhol To: Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Vincent Mailhol Subject: [PATCH v4 1/9] usb: deprecate the third argument of usb_maxpacket() Date: Thu, 17 Mar 2022 12:55:06 +0900 Message-Id: <20220317035514.6378-2-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220317035514.6378-1-mailhol.vincent@wanadoo.fr> References: <20220304105420.1059585-1-mailhol.vincent@wanadoo.fr> <20220317035514.6378-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This is a transitional patch with the ultimate goal of changing the prototype of usb_maxpacket() from: | static inline __u16 | usb_maxpacket(struct usb_device *udev, int pipe, int is_out) into: | static inline u16 usb_maxpacket(struct usb_device *udev, int pipe) The third argument of usb_maxpacket(): is_out gets removed because it can be derived from its second argument: pipe using usb_pipeout(pipe). Furthermore, in the current version, ubs_pipeout(pipe) is called regardless in order to sanitize the is_out parameter. In order to make a smooth change, we first deprecate the is_out parameter by simply ignoring it (using a variadic function) and will remove it later, once all the callers get updated. The body of the function is reworked accordingly and is_out is replaced by usb_pipeout(pipe). The WARN_ON() calls become unnecessary and get removed. Finally, the return type is changed from __u16 to u16 because this is not a UAPI function. Signed-off-by: Vincent Mailhol --- include/linux/usb.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/include/linux/usb.h b/include/linux/usb.h index 200b7b79acb5..572e136f6314 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1969,21 +1969,17 @@ usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe) return eps[usb_pipeendpoint(pipe)]; } -/*-------------------------------------------------------------------------*/ - -static inline __u16 -usb_maxpacket(struct usb_device *udev, int pipe, int is_out) +static inline u16 usb_maxpacket(struct usb_device *udev, int pipe, + /* int is_out deprecated */ ...) { struct usb_host_endpoint *ep; unsigned epnum = usb_pipeendpoint(pipe); - if (is_out) { - WARN_ON(usb_pipein(pipe)); + if (usb_pipeout(pipe)) ep = udev->ep_out[epnum]; - } else { - WARN_ON(usb_pipeout(pipe)); + else ep = udev->ep_in[epnum]; - } + if (!ep) return 0; @@ -1991,8 +1987,6 @@ usb_maxpacket(struct usb_device *udev, int pipe, int is_out) return usb_endpoint_maxp(&ep->desc); } -/* ----------------------------------------------------------------------- */ - /* translate USB error codes to codes user space understands */ static inline int usb_translate_errors(int error_code) { From patchwork Thu Mar 17 03:55:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent MAILHOL X-Patchwork-Id: 553316 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25F12C433F5 for ; Thu, 17 Mar 2022 05:16:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229613AbiCQFRh (ORCPT ); Thu, 17 Mar 2022 01:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbiCQFRe (ORCPT ); Thu, 17 Mar 2022 01:17:34 -0400 Received: from mail-oo1-xc31.google.com (mail-oo1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5D10232104 for ; Wed, 16 Mar 2022 22:02:20 -0700 (PDT) Received: by mail-oo1-xc31.google.com with SMTP id u30-20020a4a6c5e000000b00320d8dc2438so5181456oof.12 for ; Wed, 16 Mar 2022 22:02:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NavN5PfG0SoH7IP8V9kbX5XfpZ3HZw9He6gkjWERkCU=; b=qtWmzkS+MbsvdEN49AkaqqVHCU4OivQT2IM/YQx19Ui8pQvjGwCl2gerX4eY8jN4Xz eta+HJDU6usM+zn0aVi4c2Cxve4bDz8VMyi0mIga7ub4Nxis8Hg9QpGe8tRrjFRiovUZ RpCaOQIjY/aGfRWOfAA5eXgsrfKH/XL/aNwBysT5xwnhnX/lJj7WrCL7mDkpWJgRMOXx jkkaPVv5POeb86VP/cVFUVR7ORwx6cYvV8sRJ0fdmX2FsRB443GrjnTxDA45+QGy/9Ca G+zj5iVjEkcE9EsZqjnh0KmrI7ErnXS/BR40aBNMwUHPZ8FpB8vRkF55uBZ6kc78+gx4 I3Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=NavN5PfG0SoH7IP8V9kbX5XfpZ3HZw9He6gkjWERkCU=; b=UINDzjIDA85fGHOp1ey+dq5DUp+iu5GKkY5Z7jgoO3AkImPK7lkNmOnBUIYsLOs4LG 0A6eCRAtX6gpJfNEDesvXHdXRO3JFyd5zrbymYk2msSfNV8ihBWSzFmLA+gOaLz50zfJ iL+2+H38Qrt8qxZZurB9zqEKWeEHt0kwk4aj4p1IVo57KU2V+AqnRTPQnpBC2YH29FfA /i+gzytmXpGhaiCCYqMBNEyhOGZ4naYKNr0LjgxLp/TpCGjK3iMz4IWNI/zA7RQlXdGz wSXfY2H1XDc3qAIhc0XUNuEv6+wFmeHKG3SriM3ffBh03wyyjp4+M0wVnB0mFwQUyVB6 cP7w== X-Gm-Message-State: AOAM533lbN5VwjHpQA8z+et061XmOOBR0Qt4nZV0AdunSzRB6O01SIVT wJrOD3OH2V8vmfPf6cScspZsa4YKlwg+MA== X-Google-Smtp-Source: ABdhPJzyMuFf8xSvVZDsDQH2hBQGuE9Lvas0y9oGjv0VKJIy7ivAW9dg/qpKooxSURcRzQvhfOxTfg== X-Received: by 2002:a17:90a:9ab:b0:1c6:34bd:3d96 with SMTP id 40-20020a17090a09ab00b001c634bd3d96mr3054092pjo.25.1647489347274; Wed, 16 Mar 2022 20:55:47 -0700 (PDT) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id e6-20020a056a001a8600b004f78e446ff5sm5096734pfv.15.2022.03.16.20.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 20:55:46 -0700 (PDT) Sender: Vincent Mailhol From: Vincent Mailhol To: Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Vincent Mailhol , Jaroslav Kysela , Takashi Iwai , Clemens Ladisch Subject: [PATCH v4 7/9] sound: usb: remove third argument of usb_maxpacket() Date: Thu, 17 Mar 2022 12:55:12 +0900 Message-Id: <20220317035514.6378-8-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220317035514.6378-1-mailhol.vincent@wanadoo.fr> References: <20220304105420.1059585-1-mailhol.vincent@wanadoo.fr> <20220317035514.6378-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The third argument of usb_maxpacket(): in_out has been deprecated because it could be derived from the second argument (e.g. using usb_pipeout(pipe)). N.B. function usb_maxpacket() was made variadic to accommodate the transition from the old prototype with three arguments to the new one with only two arguments (so that no renaming is needed). The variadic argument is to be removed once all users of usb_maxpacket() get migrated. CC: Jaroslav Kysela CC: Takashi Iwai CC: Clemens Ladisch Signed-off-by: Vincent Mailhol --- sound/usb/line6/pcm.c | 4 ++-- sound/usb/midi.c | 4 ++-- sound/usb/usx2y/usb_stream.c | 6 +++--- sound/usb/usx2y/usbusx2yaudio.c | 2 +- sound/usb/usx2y/usx2yhwdeppcm.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c index fdbdfb7bce92..6a4af725aedd 100644 --- a/sound/usb/line6/pcm.c +++ b/sound/usb/line6/pcm.c @@ -552,10 +552,10 @@ int line6_init_pcm(struct usb_line6 *line6, line6pcm->max_packet_size_in = usb_maxpacket(line6->usbdev, - usb_rcvisocpipe(line6->usbdev, ep_read), 0); + usb_rcvisocpipe(line6->usbdev, ep_read)); line6pcm->max_packet_size_out = usb_maxpacket(line6->usbdev, - usb_sndisocpipe(line6->usbdev, ep_write), 1); + usb_sndisocpipe(line6->usbdev, ep_write)); if (!line6pcm->max_packet_size_in || !line6pcm->max_packet_size_out) { dev_err(line6pcm->line6->ifcdev, "cannot get proper max packet size\n"); diff --git a/sound/usb/midi.c b/sound/usb/midi.c index 2c01649c70f6..fba498f9e7dc 100644 --- a/sound/usb/midi.c +++ b/sound/usb/midi.c @@ -1285,7 +1285,7 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi *umidi, pipe = usb_rcvintpipe(umidi->dev, ep_info->in_ep); else pipe = usb_rcvbulkpipe(umidi->dev, ep_info->in_ep); - length = usb_maxpacket(umidi->dev, pipe, 0); + length = usb_maxpacket(umidi->dev, pipe); for (i = 0; i < INPUT_URBS; ++i) { buffer = usb_alloc_coherent(umidi->dev, length, GFP_KERNEL, &ep->urbs[i]->transfer_dma); @@ -1374,7 +1374,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi, pipe = usb_sndbulkpipe(umidi->dev, ep_info->out_ep); switch (umidi->usb_id) { default: - ep->max_transfer = usb_maxpacket(umidi->dev, pipe, 1); + ep->max_transfer = usb_maxpacket(umidi->dev, pipe); break; /* * Various chips declare a packet size larger than 4 bytes, but diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index 9d0e44793896..a4d32e8a1d36 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c @@ -51,7 +51,7 @@ static int init_pipe_urbs(struct usb_stream_kernel *sk, { int u, p; int maxpacket = use_packsize ? - use_packsize : usb_maxpacket(dev, pipe, usb_pipeout(pipe)); + use_packsize : usb_maxpacket(dev, pipe); int transfer_length = maxpacket * sk->n_o_ps; for (u = 0; u < USB_STREAM_NURBS; @@ -171,7 +171,7 @@ struct usb_stream *usb_stream_new(struct usb_stream_kernel *sk, out_pipe = usb_sndisocpipe(dev, out_endpoint); max_packsize = use_packsize ? - use_packsize : usb_maxpacket(dev, in_pipe, 0); + use_packsize : usb_maxpacket(dev, in_pipe); /* t_period = period_frames / sample_rate @@ -187,7 +187,7 @@ struct usb_stream *usb_stream_new(struct usb_stream_kernel *sk, read_size += packets * USB_STREAM_URBDEPTH * (max_packsize + sizeof(struct usb_stream_packet)); - max_packsize = usb_maxpacket(dev, out_pipe, 1); + max_packsize = usb_maxpacket(dev, out_pipe); write_size = max_packsize * packets * USB_STREAM_URBDEPTH; if (read_size >= 256*PAGE_SIZE || write_size >= 256*PAGE_SIZE) { diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index cfc1ea53978d..9cd5e3aae4f7 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c @@ -421,7 +421,7 @@ static int usx2y_urbs_allocate(struct snd_usx2y_substream *subs) pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : usb_rcvisocpipe(dev, subs->endpoint); - subs->maxpacksize = usb_maxpacket(dev, pipe, is_playback); + subs->maxpacksize = usb_maxpacket(dev, pipe); if (!subs->maxpacksize) return -EINVAL; diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index db83522c1b49..240349b644f3 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c @@ -321,7 +321,7 @@ static int usx2y_usbpcm_urbs_allocate(struct snd_usx2y_substream *subs) pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : usb_rcvisocpipe(dev, subs->endpoint); - subs->maxpacksize = usb_maxpacket(dev, pipe, is_playback); + subs->maxpacksize = usb_maxpacket(dev, pipe); if (!subs->maxpacksize) return -EINVAL; From patchwork Thu Mar 17 03:55:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent MAILHOL X-Patchwork-Id: 553312 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85D47C433F5 for ; Thu, 17 Mar 2022 06:09:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229594AbiCQGKj (ORCPT ); Thu, 17 Mar 2022 02:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbiCQGKZ (ORCPT ); Thu, 17 Mar 2022 02:10:25 -0400 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B55628BC0E for ; Wed, 16 Mar 2022 22:48:23 -0700 (PDT) Received: by mail-qv1-xf2e.google.com with SMTP id 13so3518002qvq.8 for ; Wed, 16 Mar 2022 22:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IYm0xrEfQCLBvqWht5ahAv+lSz1UlH3ACTq5MZ064P0=; b=Asb/OGG6z6LgqCY1/QHCrenmF+fttJgehUYa8spTVlahGvRUcdCQScStm+FdZnX4OL zHfH5cRL5beGgYV7dFniAO88x9LF0aBZ7KJA7/MgVpVvY2qaweXcmQvTyBieQ55Jjx9H KclR20Dffv3dnW43HsdT2p1YducpRqmY8xWxgsMe0f0ojeciebrp7NFoKe+yeKPpKBSB iPHZa8N7PEDwR2oFG3egBnH4eKWB2faaaE/p6eqbrXyATFmCHmcaDK8EUjmT0ZxVGQTe liOgpfps43Sv2Hhj3vwk6XI0kJYYMEkDWcNzyVtegbc3K5ZUxsV04WpWQ+q3UZerxlph SFxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=IYm0xrEfQCLBvqWht5ahAv+lSz1UlH3ACTq5MZ064P0=; b=Iz4JuycmJ2q2wxy55bKbvYNj+wW7CW3Mjk+/M0uWRda1emhy0MyXm4/5/OtLbdhgVT Nc53LODtKt1lastUa8HYPR+LFNouL/8x/PKZtJ2ecaeah5tLSHOcoPWcXcd77pevxuUQ zatI0xTWhPCOpdJNq+l4e3c/whLQfyi7ztmfa7lSsL0drHtUQazlYwER2jD62FsrxDdt 1J4VGZUM8FMyol1YalGKf2JVvbQ5sCn/r/HC7EBBhqubR4Dst9YLGbSQv4qTI11i8miR 6jLBccib7dJ/rNRWWYz4/jmkDfXRmiGi8wrZ9teyF4WcARJZnIl/PmctMHt/wZFAamUC cuAw== X-Gm-Message-State: AOAM531Lq60t7aO5bkoNnlrSLWfQvJzwCqiJ/yNIInhWY9iXgqGrHc4L j411cuesKnplMi2YQWTx6+7FpnW1NGUZuQ== X-Google-Smtp-Source: ABdhPJy7B32pblCApiKkAOzLiApuuudNBtu1mpTgziskeRiR46aXmlZBLe6vmSdCGysgqjRkPinmDw== X-Received: by 2002:a17:903:1206:b0:151:7d67:2924 with SMTP id l6-20020a170903120600b001517d672924mr2635105plh.45.1647489348716; Wed, 16 Mar 2022 20:55:48 -0700 (PDT) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id e6-20020a056a001a8600b004f78e446ff5sm5096734pfv.15.2022.03.16.20.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 20:55:48 -0700 (PDT) Sender: Vincent Mailhol From: Vincent Mailhol To: Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Vincent Mailhol Subject: [PATCH v4 8/9] usb: remove third argument of usb_maxpacket() Date: Thu, 17 Mar 2022 12:55:13 +0900 Message-Id: <20220317035514.6378-9-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220317035514.6378-1-mailhol.vincent@wanadoo.fr> References: <20220304105420.1059585-1-mailhol.vincent@wanadoo.fr> <20220317035514.6378-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Now that all users of usb_maxpacket() have been migrated to only use two arguments, remove the third variadic argument which was introduced for the transition. Signed-off-by: Vincent Mailhol --- include/linux/usb.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/usb.h b/include/linux/usb.h index 572e136f6314..8127782aa7a1 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1969,8 +1969,7 @@ usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe) return eps[usb_pipeendpoint(pipe)]; } -static inline u16 usb_maxpacket(struct usb_device *udev, int pipe, - /* int is_out deprecated */ ...) +static inline u16 usb_maxpacket(struct usb_device *udev, int pipe) { struct usb_host_endpoint *ep; unsigned epnum = usb_pipeendpoint(pipe); From patchwork Thu Mar 17 03:55:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent MAILHOL X-Patchwork-Id: 553314 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9B12C433F5 for ; Thu, 17 Mar 2022 06:04:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbiCQGGG (ORCPT ); Thu, 17 Mar 2022 02:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbiCQGF4 (ORCPT ); Thu, 17 Mar 2022 02:05:56 -0400 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7859CDCA8F for ; Wed, 16 Mar 2022 22:37:40 -0700 (PDT) Received: by mail-oi1-x22a.google.com with SMTP id b188so4600189oia.13 for ; Wed, 16 Mar 2022 22:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ceem6RmP/yEqjGNLoTEsmJ4aPRMMWZNmndo0Vukg9II=; b=Uh0pYOZ0PGTaA5tApNxJCok5Q0c5eO0syIRU2q354Kx2FYqXqS3HLNn3A2YY9ZeTLU 5vwuslGlonqzGPngcr+DCrbVbvbHb3+URilfVGiXCKBFysFhCQzeGG/JKd/X1Uv1QPHC +Qpwfi8rB4pvGMNhTDWLXtROEOMlaYwyzNrSYmDTmqAXfavwiytTsS7YNpl6wf4+CLCY WdRlAcrnFlIyv5VVLLbMxPS0uhXQuts5qTHWg4re2BtsKOGFkZRq2vRyfewm3Q7zM//g aj5K2a6DWylFJvDs/GKpyUaTHKYhwQ+5TPubLWUEbsGTIgHfVcls6OOEyYS/AtdqKnU0 gRZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ceem6RmP/yEqjGNLoTEsmJ4aPRMMWZNmndo0Vukg9II=; b=ZPvW/SRDSyDIGbO88DCvLm4ceWSogIYpQWWoZMunvglaDYG6jNhOgNZKnecF0buEUs z6spErKNQicQ1xxy15Fiy+KCeqKOfNCGagpLANrBd7fmh8JXSIx8/kfINHf/QnZ7bHCz CLKukr/dTYK0rrR/Lr6pndhyamX1vlHGMgf80gWWWW5qMdr6XHZIb8mffk6V0N3iFJxq XeLGOYCWoDQARU5QyxjjQPzUec3urNYSges+qNVdtMRE2nXg2jCnn964hxJZk5boepMt S0g2URct3KfZJlfAlIVMQhjEArti1DNN1UEIqUTMSnm2RXQBbnEV60hrJvBGyf1UJCTd gAtw== X-Gm-Message-State: AOAM532UKC0K+h2pk2phIoqeRaLLdKJAIuDh+g9JZY43KGnIyMtjSIVi MOpw39gIeOteIF4PNtgV8QYSFOXUalU2qg== X-Google-Smtp-Source: ABdhPJzFBH8+ijIomMbZc5BqEdet4RmW3hQyc7e4TumYZZ90DTAH8P5feGg76Fpkamg1aSrh9AVqnA== X-Received: by 2002:a17:90a:5797:b0:1bc:56a9:f6c8 with SMTP id g23-20020a17090a579700b001bc56a9f6c8mr13853390pji.12.1647489350433; Wed, 16 Mar 2022 20:55:50 -0700 (PDT) Received: from localhost.localdomain (124x33x176x97.ap124.ftth.ucom.ne.jp. [124.33.176.97]) by smtp.gmail.com with ESMTPSA id e6-20020a056a001a8600b004f78e446ff5sm5096734pfv.15.2022.03.16.20.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 20:55:49 -0700 (PDT) Sender: Vincent Mailhol From: Vincent Mailhol To: Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Vincent Mailhol Subject: [PATCH v4 9/9] usb: rework usb_maxpacket() using usb_pipe_endpoint() Date: Thu, 17 Mar 2022 12:55:14 +0900 Message-Id: <20220317035514.6378-10-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220317035514.6378-1-mailhol.vincent@wanadoo.fr> References: <20220304105420.1059585-1-mailhol.vincent@wanadoo.fr> <20220317035514.6378-1-mailhol.vincent@wanadoo.fr> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Rework the body of usb_maxpacket() and just rely on the usb_pipe_endpoint() helper function to retrieve the host endpoint instead of doing it by hand. Signed-off-by: Vincent Mailhol --- include/linux/usb.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/include/linux/usb.h b/include/linux/usb.h index 8127782aa7a1..60bee864d897 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1971,13 +1971,7 @@ usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe) static inline u16 usb_maxpacket(struct usb_device *udev, int pipe) { - struct usb_host_endpoint *ep; - unsigned epnum = usb_pipeendpoint(pipe); - - if (usb_pipeout(pipe)) - ep = udev->ep_out[epnum]; - else - ep = udev->ep_in[epnum]; + struct usb_host_endpoint *ep = usb_pipe_endpoint(udev, pipe); if (!ep) return 0;