RE: [PATCH v9 5/6] usb:cdns3 Add Cadence USB3 DRD Driver

From: Felipe Balbi
Date: Mon Jul 08 2019 - 07:59:28 EST



(please send it as a formal patch from now on)

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.

> +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?

--
balbi

Attachment: signature.asc
Description: PGP signature