Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "usb:gadget Patch simplify usb_decode_set_clear_feature function."

This reverts commit ca888ce7495e4e1578c86c37b0c82f6709da477c.

It's broken.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+46 -43
+46 -43
drivers/usb/gadget/debug.c
··· 30 30 } 31 31 } 32 32 33 - static const char *usb_decode_device_feature(u16 wValue) 34 - { 35 - switch (wValue) { 36 - case USB_DEVICE_SELF_POWERED: 37 - return "Self Powered"; 38 - case USB_DEVICE_REMOTE_WAKEUP: 39 - return "Remote Wakeup"; 40 - case USB_DEVICE_TEST_MODE: 41 - return "Test Mode"; 42 - case USB_DEVICE_U1_ENABLE: 43 - return "U1 Enable"; 44 - case USB_DEVICE_U2_ENABLE: 45 - return "U2 Enable"; 46 - case USB_DEVICE_LTM_ENABLE: 47 - return "LTM Enable"; 48 - default: 49 - return "UNKNOWN"; 50 - } 51 - } 52 - 53 - static const char *usb_decode_test_mode(u16 wIndex) 54 - { 55 - switch (wIndex) { 56 - case TEST_J: 57 - return ": TEST_J"; 58 - case TEST_K: 59 - return ": TEST_K"; 60 - case TEST_SE0_NAK: 61 - return ": TEST_SE0_NAK"; 62 - case TEST_PACKET: 63 - return ": TEST_PACKET"; 64 - case TEST_FORCE_EN: 65 - return ": TEST_FORCE_EN"; 66 - default: 67 - return ": UNKNOWN"; 68 - } 69 - } 70 - 71 - static void usb_decode_set_clear_feature(__u8 bRequestType, 72 - __u8 bRequest, __u16 wValue, 73 - __u16 wIndex, char *str, size_t size) 33 + static void usb_decode_set_clear_feature(__u8 bRequestType, __u8 bRequest, 34 + __u16 wValue, __u16 wIndex, 35 + char *str, size_t size) 74 36 { 75 37 switch (bRequestType & USB_RECIP_MASK) { 76 38 case USB_RECIP_DEVICE: 77 39 snprintf(str, size, "%s Device Feature(%s%s)", 78 40 bRequest == USB_REQ_CLEAR_FEATURE ? "Clear" : "Set", 79 - usb_decode_device_feature(wValue), 41 + ({char *s; 42 + switch (wValue) { 43 + case USB_DEVICE_SELF_POWERED: 44 + s = "Self Powered"; 45 + break; 46 + case USB_DEVICE_REMOTE_WAKEUP: 47 + s = "Remote Wakeup"; 48 + break; 49 + case USB_DEVICE_TEST_MODE: 50 + s = "Test Mode"; 51 + break; 52 + case USB_DEVICE_U1_ENABLE: 53 + s = "U1 Enable"; 54 + break; 55 + case USB_DEVICE_U2_ENABLE: 56 + s = "U2 Enable"; 57 + break; 58 + case USB_DEVICE_LTM_ENABLE: 59 + s = "LTM Enable"; 60 + break; 61 + default: 62 + s = "UNKNOWN"; 63 + } s; }), 80 64 wValue == USB_DEVICE_TEST_MODE ? 81 - usb_decode_test_mode(wIndex) : ""); 65 + ({ char *s; 66 + switch (wIndex) { 67 + case TEST_J: 68 + s = ": TEST_J"; 69 + break; 70 + case TEST_K: 71 + s = ": TEST_K"; 72 + break; 73 + case TEST_SE0_NAK: 74 + s = ": TEST_SE0_NAK"; 75 + break; 76 + case TEST_PACKET: 77 + s = ": TEST_PACKET"; 78 + break; 79 + case TEST_FORCE_EN: 80 + s = ": TEST_FORCE_EN"; 81 + break; 82 + default: 83 + s = ": UNKNOWN"; 84 + } s; }) : ""); 82 85 break; 83 86 case USB_RECIP_INTERFACE: 84 87 snprintf(str, size, "%s Interface Feature(%s)",