diff options
author | Chunfeng Yun <chunfeng.yun@mediatek.com> | 2019-03-21 10:27:56 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-26 16:45:03 +0900 |
commit | 4d537f37e0d39f64687be71087dca607ee507f5a (patch) | |
tree | 9135adefda02e372d0d0286098e05ddf6d301ff0 /include/linux/usb | |
parent | 2a738137b4c2dfddae03cd44f5b5f24f745c2864 (diff) |
usb: introduce usb_ep_type_string() function
In some places, the code prints a human-readable USB endpoint
transfer type (e.g. "bulk"). This involves a switch statement
sometimes wrapped around in ({ ... }) block leading to code
repetition.
To make this scenario easier, here introduces usb_ep_type_string()
function, which returns a human-readable name of provided
endpoint type.
It also changes a few places switch was used to use this
new function.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/ch9.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 523aa088f6ab..da82606be605 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -37,6 +37,14 @@ #include <uapi/linux/usb/ch9.h> /** + * usb_ep_type_string() - Returns human readable-name of the endpoint type. + * @ep_type: The endpoint type to return human-readable name for. If it's not + * any of the types: USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT}, + * usually got by usb_endpoint_type(), the string 'unknown' will be returned. + */ +extern const char *usb_ep_type_string(int ep_type); + +/** * usb_speed_string() - Returns human readable-name of the speed. * @speed: The speed to return human-readable name for. If it's not * any of the speeds defined in usb_device_speed enum, string for |