summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorLucy Mielke <lucymielke@icloud.com>2024-12-10 11:29:09 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-23 18:40:26 +0100
commitfe021328dfc29ef617a969a04d8727d5a57ae6f9 (patch)
tree12c5ba67c603f247f77cc3f910c42f54971a1686 /drivers/usb
parentded71f07f92f83b7695f974db9951a8b014cbefc (diff)
downloadlinux-stable-fe021328dfc29ef617a969a04d8727d5a57ae6f9.tar.gz
linux-stable-fe021328dfc29ef617a969a04d8727d5a57ae6f9.tar.bz2
linux-stable-fe021328dfc29ef617a969a04d8727d5a57ae6f9.zip
usb: common: expand documentation for USB functions
This patch adds documentation for two USB functions: - usb_otg_state_string(), which returns a human-readable name for OTG states and - usb_get_dr_mode_from_string(), which returns the dual role mode for a given string. Signed-off-by: Lucy Mielke <lucymielke@icloud.com> Link: https://lore.kernel.org/r/6nvegfmo6d5ak4soaf5nyifsaasfts4qlsnnpsd4sgpnikc2jd@amfmgdr5n3bi Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/common/common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index 871cf199b6bf..fc0845f681be 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -41,6 +41,12 @@ const char *usb_ep_type_string(int ep_type)
}
EXPORT_SYMBOL_GPL(usb_ep_type_string);
+/**
+ * usb_otg_state_string() - returns human readable name of OTG state.
+ * @state: the OTG state to return the human readable name of. If it's not
+ * any of the states defined in usb_otg_state enum, 'UNDEFINED' will be
+ * returned.
+ */
const char *usb_otg_state_string(enum usb_otg_state state)
{
static const char *const names[] = {
@@ -179,6 +185,14 @@ static const char *const usb_dr_modes[] = {
[USB_DR_MODE_OTG] = "otg",
};
+/**
+ * usb_get_dr_mode_from_string() - Get dual role mode for given string
+ * @str: String to find the corresponding dual role mode for
+ *
+ * This function performs a lookup for the given string and returns the
+ * corresponding enum usb_dr_mode. If no match for the string could be found,
+ * 'USB_DR_MODE_UNKNOWN' is returned.
+ */
static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str)
{
int ret;