Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp178715yba; Fri, 19 Apr 2019 23:42:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHK9wCxv1MOXO1avyZTg5LuOL7UbQmztaUvQVldhhQiVIm3eBilYuq1RqI8OKlVzdxhVkv X-Received: by 2002:a63:6e01:: with SMTP id j1mr7941654pgc.442.1555742550893; Fri, 19 Apr 2019 23:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555742550; cv=none; d=google.com; s=arc-20160816; b=bjWb0dzR98S4JB6t5bcPAhgOhEld8vJ+APddt0yTAtiNbQNgXcIuJDPlcy64cYM0IJ oWgN5F3tueqjqox9/VSozWUw/zdsH0Lj176I98wfMelNP1brF/d63AU7wfUTTLB8o1qc aSzahR1bAsJ3qqovHBMWkUAcA/c4ZJhwwgvabLtN/a1yFHkeuyUu2EB3hXYXAVbQ5+5z aZuwrNG1AAi1oBeszmGLR3TlBxWRIebYmxhkzOAR43bfjNEj6fnJ2Ct5z0HkWvaosZ9T uiLRe7WmCR2tTCfV7vEW0TyiU0geT4O9z9Sl/xqu4zhTJ/lu5rpt8KMGSgnjPlfXUYJr PxhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=s40TVnkIzwGPs57SLpnuiuwsePKLYP1ZsZStTkVlVsI=; b=Xlr+PnQEymisH1YtTCUI5WXvbOkozDrmX/1YcTB40hVZSe8mU+urIYiTWeY0sLv4Nd RXkCk10fpJbQeqXyPQiExZsCK8uX889x0Tn3+ZbUpjMvebPEci4B5bYRU59BeDKWFgJo AC86kUlD2fDkHOiBdnoRB6DzIw/M2Bjpbyw6zbV9DglPpImWSb/0HE8hDvM6L+sdRzNB IFZWjO+WTGffEt9Ocvs5uOJCuQpGHYl0SHgJukfQIV+vFozfANhb6WfWpmZYCGNr/NDD LS6/UOERqPBmSL37uZ2AHeGRBu7cKUHgkU9ggbfZYWMIou3SmtVn5NR3Ir3tK7MqHekc eC6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si7384972plf.416.2019.04.19.23.42.15; Fri, 19 Apr 2019 23:42:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728260AbfDTGlG (ORCPT + 99 others); Sat, 20 Apr 2019 02:41:06 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:39544 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728079AbfDTGkp (ORCPT ); Sat, 20 Apr 2019 02:40:45 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 8406C7FA3296301000AE; Sat, 20 Apr 2019 14:40:39 +0800 (CST) Received: from vm100-107-113-134.huawei.com (100.107.113.134) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.408.0; Sat, 20 Apr 2019 14:40:30 +0800 From: Yu Chen To: , , CC: , , , , , , , , , , , , , , Yu Chen , "Greg Kroah-Hartman" , Heikki Krogerus , Hans de Goede , "Andy Shevchenko" Subject: [PATCH v6 08/13] usb: roles: Introduce stubs for the exiting functions in role.h. Date: Sat, 20 Apr 2019 14:40:14 +0800 Message-ID: <20190420064019.57522-9-chenyu56@huawei.com> X-Mailer: git-send-email 2.15.0-rc2 In-Reply-To: <20190420064019.57522-1-chenyu56@huawei.com> References: <20190420064019.57522-1-chenyu56@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [100.107.113.134] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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