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: Felipe Balbi <felipe.balbi@linux.intel.com>
这个提交包含在:
@@ -617,21 +617,7 @@ static int dummy_enable(struct usb_ep *_ep,
|
||||
_ep->name,
|
||||
desc->bEndpointAddress & 0x0f,
|
||||
(desc->bEndpointAddress & USB_DIR_IN) ? "in" : "out",
|
||||
({ char *val;
|
||||
switch (usb_endpoint_type(desc)) {
|
||||
case USB_ENDPOINT_XFER_BULK:
|
||||
val = "bulk";
|
||||
break;
|
||||
case USB_ENDPOINT_XFER_ISOC:
|
||||
val = "iso";
|
||||
break;
|
||||
case USB_ENDPOINT_XFER_INT:
|
||||
val = "intr";
|
||||
break;
|
||||
default:
|
||||
val = "ctrl";
|
||||
break;
|
||||
} val; }),
|
||||
usb_ep_type_string(usb_endpoint_type(desc)),
|
||||
max, ep->stream_en ? "enabled" : "disabled");
|
||||
|
||||
/* at this point real hardware should be NAKing transfers
|
||||
|
在新工单中引用
屏蔽一个用户