> >(please send it as a formal patch from now on) I will send it. I think even today. > >Hi, > >Pawel Laszczak <pawell@xxxxxxxxxxx> writes: >> The prototype was added , but not all text was past. Sorry for that. >> >> Fixed version: with your changes. >> >> ///// v2 corrected >> commit 4553d48dd0500085d90c8280e28714072279c3dd (HEAD) >> Author: Pawel Laszczak <pawell@xxxxxxxxxxx> >> Date: Mon Jul 8 12:53:47 2019 +0200 >> >> usb: common: Add usb_get_dr_mode_from_string and usb_dr_mode_to_string. >> >> Patch introduces new function usb_dr_mode_to_string for converting dual role >> mod to string and removes static from usb_dr_mode_to_string definition. >> >> Both changes have made to avoid duplication of code by cdns3 driver. > >missing Signed-off-by > >> diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h >> index 69f1b6328532..c156817672c4 100644 >> --- a/include/linux/usb/otg.h >> +++ b/include/linux/usb/otg.h >> @@ -129,4 +129,20 @@ enum usb_dr_mode { >> */ >> extern enum usb_dr_mode usb_get_dr_mode(struct device *dev); >> >> +/** >> + * usb_get_dr_mode_from_string - Convert string to dual role mode. >> + * @str: Pointer to the given string >> + * >> + * The function gets string and returns the correspondig enum usb_dr_mode. >> + */ > >why duplicate the documentation? Perhaps put it only in the header, >otherwise we will need to update two locations whenever these functions >change. Ok, I've removed it from drviers/usb/common/common.c. > >> +extern enum usb_dr_mode usb_get_dr_mode_from_string(const char *str); >> + >> +/** >> + * usb_dr_mode_to_string - Convert dual role mode to string. >> + * @dr_mode: Pointer to the given dual role mode >> + * >> + * The function gets enum usb_dr_mode, and returns the correspondig string. >> + */ >> +extern const char *usb_dr_mode_to_string(const enum usb_dr_mode dr_mode); > >Don't you need a stub for builds when CONFIG_USB_COMMON=n? > We don't need it. It will be enabled when USB_GADGET or USB is enabled. It should cover all cases. menuconfig USB_GADGET tristate "USB Gadget Support" select USB_COMMON config USB tristate "Support for Host-side USB" depends on USB_ARCH_HAS_HCD select USB_COMMON Pawel >-- >balbi