mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
usb: common: Simplify usb_decode_get_set_descriptor function.
Patch moves switch responsible for decoding descriptor type outside snprintf. It improves code readability a little. Signed-off-by: Pawel Laszczak <pawell@cadence.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
parent
010665b44d
commit
f72429fc88
1 changed files with 58 additions and 55 deletions
|
@ -105,9 +105,8 @@ static void usb_decode_get_set_descriptor(__u8 bRequestType, __u8 bRequest,
|
||||||
__u16 wValue, __u16 wIndex,
|
__u16 wValue, __u16 wIndex,
|
||||||
__u16 wLength, char *str, size_t size)
|
__u16 wLength, char *str, size_t size)
|
||||||
{
|
{
|
||||||
snprintf(str, size, "%s %s Descriptor(Index = %d, Length = %d)",
|
char *s;
|
||||||
bRequest == USB_REQ_GET_DESCRIPTOR ? "Get" : "Set",
|
|
||||||
({ char *s;
|
|
||||||
switch (wValue >> 8) {
|
switch (wValue >> 8) {
|
||||||
case USB_DT_DEVICE:
|
case USB_DT_DEVICE:
|
||||||
s = "Device";
|
s = "Device";
|
||||||
|
@ -160,7 +159,11 @@ static void usb_decode_get_set_descriptor(__u8 bRequestType, __u8 bRequest,
|
||||||
default:
|
default:
|
||||||
s = "UNKNOWN";
|
s = "UNKNOWN";
|
||||||
break;
|
break;
|
||||||
} s; }), wValue & 0xff, wLength);
|
}
|
||||||
|
|
||||||
|
snprintf(str, size, "%s %s Descriptor(Index = %d, Length = %d)",
|
||||||
|
bRequest == USB_REQ_GET_DESCRIPTOR ? "Get" : "Set",
|
||||||
|
s, wValue & 0xff, wLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usb_decode_get_configuration(__u16 wLength, char *str, size_t size)
|
static void usb_decode_get_configuration(__u16 wLength, char *str, size_t size)
|
||||||
|
|
Loading…
Reference in a new issue