summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/udc/aspeed-vhub/epn.c
diff options
context:
space:
mode:
authorChunfeng Yun <chunfeng.yun@mediatek.com>2019-03-21 10:27:56 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-26 16:45:03 +0900
commit4d537f37e0d39f64687be71087dca607ee507f5a (patch)
tree9135adefda02e372d0d0286098e05ddf6d301ff0 /drivers/usb/gadget/udc/aspeed-vhub/epn.c
parent2a738137b4c2dfddae03cd44f5b5f24f745c2864 (diff)
downloadlinux-4d537f37e0d39f64687be71087dca607ee507f5a.tar.bz2
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 'drivers/usb/gadget/udc/aspeed-vhub/epn.c')
-rw-r--r--drivers/usb/gadget/udc/aspeed-vhub/epn.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/usb/gadget/udc/aspeed-vhub/epn.c b/drivers/usb/gadget/udc/aspeed-vhub/epn.c
index 83340f4fdc6e..35941dc125f9 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/epn.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/epn.c
@@ -593,10 +593,6 @@ static int ast_vhub_epn_disable(struct usb_ep* u_ep)
static int ast_vhub_epn_enable(struct usb_ep* u_ep,
const struct usb_endpoint_descriptor *desc)
{
- static const char *ep_type_string[] __maybe_unused = { "ctrl",
- "isoc",
- "bulk",
- "intr" };
struct ast_vhub_ep *ep = to_ast_ep(u_ep);
struct ast_vhub_dev *dev;
struct ast_vhub *vhub;
@@ -646,7 +642,7 @@ static int ast_vhub_epn_enable(struct usb_ep* u_ep,
ep->epn.wedged = false;
EPDBG(ep, "Enabling [%s] %s num %d maxpacket=%d\n",
- ep->epn.is_in ? "in" : "out", ep_type_string[type],
+ ep->epn.is_in ? "in" : "out", usb_ep_type_string(type),
usb_endpoint_num(desc), maxpacket);
/* Can we use DMA descriptor mode ? */