diff options
Diffstat (limited to 'drivers/usb/core/common.c')
-rw-r--r-- | drivers/usb/core/common.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/usb/core/common.c b/drivers/usb/core/common.c new file mode 100644 index 0000000000..690d5a39ea --- /dev/null +++ b/drivers/usb/core/common.c @@ -0,0 +1,19 @@ +#include <common.h> +#include <usb/ch9.h> + +static const char *const speed_names[] = { + [USB_SPEED_UNKNOWN] = "UNKNOWN", + [USB_SPEED_LOW] = "low-speed", + [USB_SPEED_FULL] = "full-speed", + [USB_SPEED_HIGH] = "high-speed", + [USB_SPEED_WIRELESS] = "wireless", + [USB_SPEED_SUPER] = "super-speed", +}; + +const char *usb_speed_string(enum usb_device_speed speed) +{ + if (speed < 0 || speed >= ARRAY_SIZE(speed_names)) + speed = USB_SPEED_UNKNOWN; + return speed_names[speed]; +} +EXPORT_SYMBOL_GPL(usb_speed_string); |