summaryrefslogtreecommitdiff
path: root/include/linux/usb/role.h
diff options
context:
space:
mode:
authorChunfeng Yun <chunfeng.yun@mediatek.com>2021-05-25 16:53:05 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-27 09:17:18 +0200
commit73e33008e865e5a7b79282331c2d6e920d5d47f8 (patch)
treec87cb860d513d1daf9143439ee66322dd21bd2fb /include/linux/usb/role.h
parenta0765597c986ad52c9bc93319987d41bc17f59ef (diff)
usb: roles: add helper usb_role_string()
Introduces usb_role_string() function, which returns a human-readable name of provided usb role, it's useful to make the log readable. Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1621932786-9335-1-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usb/role.h')
-rw-r--r--include/linux/usb/role.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/usb/role.h b/include/linux/usb/role.h
index 0164fed31b06..031f148ab373 100644
--- a/include/linux/usb/role.h
+++ b/include/linux/usb/role.h
@@ -65,6 +65,7 @@ void usb_role_switch_unregister(struct usb_role_switch *sw);
void usb_role_switch_set_drvdata(struct usb_role_switch *sw, void *data);
void *usb_role_switch_get_drvdata(struct usb_role_switch *sw);
+const char *usb_role_string(enum usb_role role);
#else
static inline int usb_role_switch_set_role(struct usb_role_switch *sw,
enum usb_role role)
@@ -109,6 +110,11 @@ static inline void *usb_role_switch_get_drvdata(struct usb_role_switch *sw)
return NULL;
}
+static inline const char *usb_role_string(enum usb_role role)
+{
+ return "unknown";
+}
+
#endif
#endif /* __LINUX_USB_ROLE_H */