Linux USB
 help / color / mirror / Atom feed
From: Linyu Yuan <quic_linyyuan@quicinc.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>, Linyu Yuan <quic_linyyuan@quicinc.com>
Subject: [PATCH v2 6/7] usb: gadget: composite: cleanup function config_ep_by_speed_and_alt()
Date: Thu, 3 Aug 2023 17:10:52 +0800	[thread overview]
Message-ID: <20230803091053.9714-7-quic_linyyuan@quicinc.com> (raw)
In-Reply-To: <20230803091053.9714-1-quic_linyyuan@quicinc.com>

When call this function, gadget already have working speed, if it is
USB_SPEED_SUPER_PLUS, in theroy gadget_is_superspeed_plus() checking
should be true, so there is no need to call it. it is same for other
working speed.

Remove all gadget_is_{*}speed_plus() API call to clean it up.

Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
---
v2: no change

 drivers/usb/gadget/composite.c | 34 ++++++++++++++--------------------
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index dd9b90481b4c..0ace45b66a31 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -170,33 +170,27 @@ int config_ep_by_speed_and_alt(struct usb_gadget *g,
 	/* select desired speed */
 	switch (g->speed) {
 	case USB_SPEED_SUPER_PLUS:
-		if (gadget_is_superspeed_plus(g)) {
-			if (f->ssp_descriptors) {
-				speed_desc = f->ssp_descriptors;
-				want_comp_desc = 1;
-				break;
-			}
-			incomplete_desc = true;
+		if (f->ssp_descriptors) {
+			speed_desc = f->ssp_descriptors;
+			want_comp_desc = 1;
+			break;
 		}
+		incomplete_desc = true;
 		fallthrough;
 	case USB_SPEED_SUPER:
-		if (gadget_is_superspeed(g)) {
-			if (f->ss_descriptors) {
-				speed_desc = f->ss_descriptors;
-				want_comp_desc = 1;
-				break;
-			}
-			incomplete_desc = true;
+		if (f->ss_descriptors) {
+			speed_desc = f->ss_descriptors;
+			want_comp_desc = 1;
+			break;
 		}
+		incomplete_desc = true;
 		fallthrough;
 	case USB_SPEED_HIGH:
-		if (gadget_is_dualspeed(g)) {
-			if (f->hs_descriptors) {
-				speed_desc = f->hs_descriptors;
-				break;
-			}
-			incomplete_desc = true;
+		if (f->hs_descriptors) {
+			speed_desc = f->hs_descriptors;
+			break;
 		}
+		incomplete_desc = true;
 		fallthrough;
 	default:
 		speed_desc = f->fs_descriptors;
-- 
2.17.1


  parent reply	other threads:[~2023-08-03  9:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03  9:10 [PATCH v2 0/7] remove some usage of gadget_is_{*}speed() API Linyu Yuan
2023-08-03  9:10 ` [PATCH v2 1/7] usb: gadget: use working speed to calcaulate network bitrate and qlen Linyu Yuan
2023-08-03  9:10 ` [PATCH v2 2/7] usb: gadget: add a inline function gether_bitrate() Linyu Yuan
2023-08-03  9:10 ` [PATCH v2 3/7] usb: gadget: f_uvc: change endpoint allocation in uvc_function_bind() Linyu Yuan
2023-12-19 16:17   ` Frank Li
2023-12-20 14:33     ` yuan linyu
2023-12-20 16:02       ` Frank Li
2023-12-21 14:14         ` yuan linyu
2023-12-21 14:57           ` Frank Li
2023-08-03  9:10 ` [PATCH v2 4/7] usb: gadget: unconditionally allocate hs/ss descriptor in bind operation Linyu Yuan
2023-08-03  9:10 ` [PATCH v2 5/7] usb: gadget: config: remove max speed check in usb_assign_descriptors() Linyu Yuan
2023-08-03  9:10 ` Linyu Yuan [this message]
2023-08-03  9:10 ` [PATCH v2 7/7] usb: gadget: remove max support speed info in bind operation Linyu Yuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230803091053.9714-7-quic_linyyuan@quicinc.com \
    --to=quic_linyyuan@quicinc.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox