Skip to content

Commit 4dfdd90

Browse files
Linyu Yuangregkh
authored andcommitted
usb: gadget: config: remove max speed check in usb_assign_descriptors()
usb_assign_descriptors() usally called inside function bind operation, and gadget still have no working connection speed, let's support all speed at this point, it may possible allocate extra memory to store descriptors, but it is small and acceptable. Remove gadget_is_{*}speed() API checking to allow support all speed. 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 46decc8 commit 4dfdd90

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/usb/gadget/config.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ int usb_assign_descriptors(struct usb_function *f,
162162
struct usb_descriptor_header **ss,
163163
struct usb_descriptor_header **ssp)
164164
{
165-
struct usb_gadget *g = f->config->cdev->gadget;
166-
167165
/* super-speed-plus descriptor falls back to super-speed one,
168166
* if such a descriptor was provided, thus avoiding a NULL
169167
* pointer dereference if a 5gbps capable gadget is used with
@@ -177,17 +175,17 @@ int usb_assign_descriptors(struct usb_function *f,
177175
if (!f->fs_descriptors)
178176
goto err;
179177
}
180-
if (hs && gadget_is_dualspeed(g)) {
178+
if (hs) {
181179
f->hs_descriptors = usb_copy_descriptors(hs);
182180
if (!f->hs_descriptors)
183181
goto err;
184182
}
185-
if (ss && gadget_is_superspeed(g)) {
183+
if (ss) {
186184
f->ss_descriptors = usb_copy_descriptors(ss);
187185
if (!f->ss_descriptors)
188186
goto err;
189187
}
190-
if (ssp && gadget_is_superspeed_plus(g)) {
188+
if (ssp) {
191189
f->ssp_descriptors = usb_copy_descriptors(ssp);
192190
if (!f->ssp_descriptors)
193191
goto err;

0 commit comments

Comments
 (0)