Michal Nazarewicz | e538dfd | 2011-08-30 17:11:19 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Provides code common for host and device side USB. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation, version 2. |
| 7 | * |
| 8 | * If either host side (ie. CONFIG_USB=y) or device side USB stack |
| 9 | * (ie. CONFIG_USB_GADGET=y) is compiled in the kernel, this module is |
| 10 | * compiled-in as well. Otherwise, if either of the two stacks is |
| 11 | * compiled as module, this file is compiled as module as well. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/module.h> |
| 16 | #include <linux/usb/ch9.h> |
| 17 | |
| 18 | const char *usb_speed_string(enum usb_device_speed speed) |
| 19 | { |
| 20 | static const char *const names[] = { |
| 21 | [USB_SPEED_UNKNOWN] = "UNKNOWN", |
| 22 | [USB_SPEED_LOW] = "low-speed", |
| 23 | [USB_SPEED_FULL] = "full-speed", |
| 24 | [USB_SPEED_HIGH] = "high-speed", |
| 25 | [USB_SPEED_WIRELESS] = "wireless", |
| 26 | [USB_SPEED_SUPER] = "super-speed", |
| 27 | }; |
| 28 | |
| 29 | if (speed < 0 || speed >= ARRAY_SIZE(names)) |
| 30 | speed = USB_SPEED_UNKNOWN; |
| 31 | return names[speed]; |
| 32 | } |
| 33 | EXPORT_SYMBOL_GPL(usb_speed_string); |
| 34 | |
| 35 | MODULE_LICENSE("GPL"); |