Skip to content

Commit dc2e696

Browse files
Linyu Yuangregkh
authored andcommitted
usb: gadget: composite: cleanup function config_ep_by_speed_and_alt()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4dfdd90 commit dc2e696

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

drivers/usb/gadget/composite.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -170,33 +170,27 @@ int config_ep_by_speed_and_alt(struct usb_gadget *g,
170170
/* select desired speed */
171171
switch (g->speed) {
172172
case USB_SPEED_SUPER_PLUS:
173-
if (gadget_is_superspeed_plus(g)) {
174-
if (f->ssp_descriptors) {
175-
speed_desc = f->ssp_descriptors;
176-
want_comp_desc = 1;
177-
break;
178-
}
179-
incomplete_desc = true;
173+
if (f->ssp_descriptors) {
174+
speed_desc = f->ssp_descriptors;
175+
want_comp_desc = 1;
176+
break;
180177
}
178+
incomplete_desc = true;
181179
fallthrough;
182180
case USB_SPEED_SUPER:
183-
if (gadget_is_superspeed(g)) {
184-
if (f->ss_descriptors) {
185-
speed_desc = f->ss_descriptors;
186-
want_comp_desc = 1;
187-
break;
188-
}
189-
incomplete_desc = true;
181+
if (f->ss_descriptors) {
182+
speed_desc = f->ss_descriptors;
183+
want_comp_desc = 1;
184+
break;
190185
}
186+
incomplete_desc = true;
191187
fallthrough;
192188
case USB_SPEED_HIGH:
193-
if (gadget_is_dualspeed(g)) {
194-
if (f->hs_descriptors) {
195-
speed_desc = f->hs_descriptors;
196-
break;
197-
}
198-
incomplete_desc = true;
189+
if (f->hs_descriptors) {
190+
speed_desc = f->hs_descriptors;
191+
break;
199192
}
193+
incomplete_desc = true;
200194
fallthrough;
201195
default:
202196
speed_desc = f->fs_descriptors;

0 commit comments

Comments
 (0)