usb: gadget: config: remove max speed check in usb_assign_descriptors()
authorLinyu Yuan <quic_linyyuan@quicinc.com>
Thu, 3 Aug 2023 09:10:51 +0000 (17:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Aug 2023 12:48:33 +0000 (14:48 +0200)
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>
drivers/usb/gadget/config.c

index 05507606b2b42ae5e65a992e3421821861d4e641..b1f625245713a47060094e341e076a80fd3225a8 100644 (file)
@@ -162,8 +162,6 @@ int usb_assign_descriptors(struct usb_function *f,
                struct usb_descriptor_header **ss,
                struct usb_descriptor_header **ssp)
 {
-       struct usb_gadget *g = f->config->cdev->gadget;
-
        /* super-speed-plus descriptor falls back to super-speed one,
         * if such a descriptor was provided, thus avoiding a NULL
         * pointer dereference if a 5gbps capable gadget is used with
@@ -177,17 +175,17 @@ int usb_assign_descriptors(struct usb_function *f,
                if (!f->fs_descriptors)
                        goto err;
        }
-       if (hs && gadget_is_dualspeed(g)) {
+       if (hs) {
                f->hs_descriptors = usb_copy_descriptors(hs);
                if (!f->hs_descriptors)
                        goto err;
        }
-       if (ss && gadget_is_superspeed(g)) {
+       if (ss) {
                f->ss_descriptors = usb_copy_descriptors(ss);
                if (!f->ss_descriptors)
                        goto err;
        }
-       if (ssp && gadget_is_superspeed_plus(g)) {
+       if (ssp) {
                f->ssp_descriptors = usb_copy_descriptors(ssp);
                if (!f->ssp_descriptors)
                        goto err;