From patchwork Wed Apr 24 09:22:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 10914369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF7761708 for ; Wed, 24 Apr 2019 09:29:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF15E289B5 for ; Wed, 24 Apr 2019 09:29:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2523289B8; Wed, 24 Apr 2019 09:29:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EC03289BC for ; Wed, 24 Apr 2019 09:29:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727875AbfDXJ3V (ORCPT ); Wed, 24 Apr 2019 05:29:21 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:57182 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726176AbfDXJ3V (ORCPT ); Wed, 24 Apr 2019 05:29:21 -0400 X-IronPort-AV: E=Sophos;i="5.60,389,1549897200"; d="scan'208";a="14200184" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 24 Apr 2019 18:29:19 +0900 Received: from be1yocto.ree.adwin.renesas.com (unknown [172.29.43.62]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D56DA42A01A9; Wed, 24 Apr 2019 18:29:16 +0900 (JST) From: Biju Das To: Greg Kroah-Hartman , Yu Chen Cc: linux-usb@vger.kernel.org, Heikki Krogerus , Simon Horman , Geert Uytterhoeven , Chris Paterson , Biju Das , Fabrizio Castro , linux-renesas-soc@vger.kernel.org, Hans de Goede , Andy Shevchenko , John Stultz Subject: [PATCH V5 1/9] usb: roles: Introduce stubs for the exiting functions in role.h. Date: Wed, 24 Apr 2019 10:22:15 +0100 Message-Id: <1556097743-12717-2-git-send-email-biju.das@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556097743-12717-1-git-send-email-biju.das@bp.renesas.com> References: <1556097743-12717-1-git-send-email-biju.das@bp.renesas.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yu Chen This patch adds stubs for the exiting functions while CONFIG_USB_ROLE_SWITCH does not enabled. Cc: Greg Kroah-Hartman Cc: Heikki Krogerus Cc: Hans de Goede Cc: Andy Shevchenko Cc: John Stultz Reviewed-by: Heikki Krogerus Signed-off-by: Yu Chen --- * This is a dependency patch for the next patch in this series Ref:(https://patchwork.kernel.org/patch/10909971/) Note:- This patch is added to this series to avoid compilation issues. --- 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 c05ffa6..da2b964 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 */