When a function is added to a configuration with usb_add_function(), the
configuration speed flags are updated. These flags indicate for which
speeds the configuration is valid for.

This patch adds a flag in the configuration for SuperSpeedPlus and
also updates this based on the existence of ssp_descriptors.

Signed-off-by: John Youn <johny...@synopsys.com>
---
 drivers/usb/gadget/composite.c | 2 ++
 drivers/usb/gadget/configfs.c  | 1 +
 include/linux/usb/composite.h  | 1 +
 3 files changed, 4 insertions(+)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 11d2433..560330f 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -237,6 +237,8 @@ int usb_add_function(struct usb_configuration *config,
                config->highspeed = true;
        if (!config->superspeed && function->ss_descriptors)
                config->superspeed = true;
+       if (!config->superspeed_plus && function->ssp_descriptors)
+               config->superspeed_plus = true;
 
 done:
        if (value)
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 590c449..c6cc15e 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -1229,6 +1229,7 @@ static void purge_configs_funcs(struct gadget_info *gi)
                }
                c->next_interface_id = 0;
                memset(c->interface, 0, sizeof(c->interface));
+               c->superspeed_plus = 0;
                c->superspeed = 0;
                c->highspeed = 0;
                c->fullspeed = 0;
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 9ff1e46..2b81b24 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -322,6 +322,7 @@ struct usb_configuration {
        unsigned                superspeed:1;
        unsigned                highspeed:1;
        unsigned                fullspeed:1;
+       unsigned                superspeed_plus:1;
        struct usb_function     *interface[MAX_CONFIG_INTERFACES];
 };
 
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to