Commit 4dfdd90b authored by Linyu Yuan's avatar Linyu Yuan Committed by Greg Kroah-Hartman

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: default avatarLinyu Yuan <quic_linyyuan@quicinc.com>
Link: https://lore.kernel.org/r/20230803091053.9714-6-quic_linyyuan@quicinc.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 46decc82
...@@ -162,8 +162,6 @@ int usb_assign_descriptors(struct usb_function *f, ...@@ -162,8 +162,6 @@ int usb_assign_descriptors(struct usb_function *f,
struct usb_descriptor_header **ss, struct usb_descriptor_header **ss,
struct usb_descriptor_header **ssp) struct usb_descriptor_header **ssp)
{ {
struct usb_gadget *g = f->config->cdev->gadget;
/* super-speed-plus descriptor falls back to super-speed one, /* super-speed-plus descriptor falls back to super-speed one,
* if such a descriptor was provided, thus avoiding a NULL * if such a descriptor was provided, thus avoiding a NULL
* pointer dereference if a 5gbps capable gadget is used with * pointer dereference if a 5gbps capable gadget is used with
...@@ -177,17 +175,17 @@ int usb_assign_descriptors(struct usb_function *f, ...@@ -177,17 +175,17 @@ int usb_assign_descriptors(struct usb_function *f,
if (!f->fs_descriptors) if (!f->fs_descriptors)
goto err; goto err;
} }
if (hs && gadget_is_dualspeed(g)) { if (hs) {
f->hs_descriptors = usb_copy_descriptors(hs); f->hs_descriptors = usb_copy_descriptors(hs);
if (!f->hs_descriptors) if (!f->hs_descriptors)
goto err; goto err;
} }
if (ss && gadget_is_superspeed(g)) { if (ss) {
f->ss_descriptors = usb_copy_descriptors(ss); f->ss_descriptors = usb_copy_descriptors(ss);
if (!f->ss_descriptors) if (!f->ss_descriptors)
goto err; goto err;
} }
if (ssp && gadget_is_superspeed_plus(g)) { if (ssp) {
f->ssp_descriptors = usb_copy_descriptors(ssp); f->ssp_descriptors = usb_copy_descriptors(ssp);
if (!f->ssp_descriptors) if (!f->ssp_descriptors)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment