summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPawel Laszczak <pawell@cadence.com>2019-02-26 14:15:44 +0800
committerPeter Chen <peter.chen@nxp.com>2019-06-21 09:42:22 +0800
commit23b6fa07986fe96a322463dd8967d4051b9552a1 (patch)
treeecf847658fd5f61b5762028dd6ea8fe842b592d6 /include
parent9beab311dac757398a79f6ee33f8af1e2796dab8 (diff)
usb: common: change debug message API
It ported from below patch, and change for v4.14. https://www.spinics.net/lists/linux-usb/msg177137.html Signed-off-by: Pawel Laszczak <pawell@cadence.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/usb/ch9.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 523aa088f6ab..db21b11bec6e 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -62,4 +62,29 @@ extern enum usb_device_speed usb_get_maximum_speed(struct device *dev);
*/
extern const char *usb_state_string(enum usb_device_state state);
+/**
+ * usb_decode_ctrl - Returns human readable representation of control request.
+ * @str: buffer to return a human-readable representation of control request.
+ * This buffer should have about 200 bytes.
+ * @size: size of str buffer.
+ * @bRequestType: matches the USB bmRequestType field
+ * @bRequest: matches the USB bRequest field
+ * @wValue: matches the USB wValue field (CPU byte order)
+ * @wIndex: matches the USB wIndex field (CPU byte order)
+ * @wLength: matches the USB wLength field (CPU byte order)
+ *
+ * Function returns decoded, formatted and human-readable description of
+ * control request packet.
+ *
+ * The usage scenario for this is for tracepoints, so function as a return
+ * use the same value as in parameters. This approach allows to use this
+ * function in TP_printk
+ *
+ * Important: wValue, wIndex, wLength parameters before invoking this function
+ * should be processed by le16_to_cpu macro.
+ */
+const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType,
+ __u8 bRequest, __u16 wValue, __u16 wIndex,
+ __u16 wLength);
+
#endif /* __LINUX_USB_CH9_H */