Skip to content

Commit b31cd8b

Browse files
author
Desnes Nunes
committed
usb: gadget: config: remove max speed check in usb_assign_descriptors()
JIRA: https://issues.redhat.com/browse/RHEL-122021 commit 4dfdd90 Author: Linyu Yuan <quic_linyyuan@quicinc.com> Date: Thu, 3 Aug 2023 17:10:51 +0800 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 <quic_linyyuan@quicinc.com> Link: https://lore.kernel.org/r/20230803091053.9714-6-quic_linyyuan@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Desnes Nunes <desnesn@redhat.com>
1 parent 9a1d2c7 commit b31cd8b

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)