[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 4 Apr 2019 16:25:28 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Yu Chen <chenyu56@...wei.com>
Cc: linux-usb@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, john.stultz@...aro.org,
suzhuangluan@...ilicon.com, kongfei@...ilicon.com,
liuyu712@...ilicon.com, wanghu17@...ilicon.com,
butao@...ilicon.com, chenyao11@...wei.com,
fangshengzhou@...ilicon.com, lipengcheng8@...wei.com,
songxiaowei@...ilicon.com, xuyiping@...ilicon.com,
xuyoujun4@...wei.com, yudongbin@...ilicon.com,
zangleigang@...ilicon.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Hans de Goede <hdegoede@...hat.com>,
Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [PATCH v5 08/13] usb: roles: Introduce stubs for the exiting
functions in role.h.
On Fri, Mar 29, 2019 at 12:14:04PM +0800, Yu Chen wrote:
> This patch adds stubs for the exiting functions while
> CONFIG_USB_ROLE_SWITCH does not enabled.
>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> Cc: Hans de Goede <hdegoede@...hat.com>
> Cc: Andy Shevchenko <andy.shevchenko@...il.com>
> Cc: John Stultz <john.stultz@...aro.org>
> Signed-off-by: Yu Chen <chenyu56@...wei.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> ---
> include/linux/usb/role.h | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/include/linux/usb/role.h b/include/linux/usb/role.h
> index c05ffa6abda9..da2b9641b877 100644
> --- a/include/linux/usb/role.h
> +++ b/include/linux/usb/role.h
> @@ -42,6 +42,8 @@ struct usb_role_switch_desc {
> bool allow_userspace_control;
> };
>
> +
> +#if IS_ENABLED(CONFIG_USB_ROLE_SWITCH)
> int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role);
> enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw);
> struct usb_role_switch *usb_role_switch_get(struct device *dev);
> @@ -51,5 +53,33 @@ struct usb_role_switch *
> usb_role_switch_register(struct device *parent,
> const struct usb_role_switch_desc *desc);
> void usb_role_switch_unregister(struct usb_role_switch *sw);
> +#else
> +static inline int usb_role_switch_set_role(struct usb_role_switch *sw,
> + enum usb_role role)
> +{
> + return 0;
> +}
> +
> +static inline enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw)
> +{
> + return USB_ROLE_NONE;
> +}
> +
> +static inline struct usb_role_switch *usb_role_switch_get(struct device *dev)
> +{
> + return ERR_PTR(-ENODEV);
> +}
> +
> +static inline void usb_role_switch_put(struct usb_role_switch *sw) { }
> +
> +static inline struct usb_role_switch *
> +usb_role_switch_register(struct device *parent,
> + const struct usb_role_switch_desc *desc)
> +{
> + return ERR_PTR(-ENODEV);
> +}
> +
> +static inline void usb_role_switch_unregister(struct usb_role_switch *sw) { }
> +#endif
>
> #endif /* __LINUX_USB_ROLE_H */
> --
> 2.15.0-rc2
thanks,
--
heikki
Powered by blists - more mailing lists