Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5990432ybi; Wed, 29 May 2019 00:47:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4jxjam628nnNg56oZHJ4OrG9KrhjaqVBsSS2eaW6juZ7ny1NPXmjBb922eNC2cn41IEyi X-Received: by 2002:a63:158:: with SMTP id 85mr36788119pgb.101.1559116038273; Wed, 29 May 2019 00:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559116038; cv=none; d=google.com; s=arc-20160816; b=Uy58a5s9MLenXJeU/NmiMmPlq98SouqWD20a0w81/APDrzfkJ7Yjbzaiay/7VsFZ2y aSdrnRzeOoG9arSgx3AbL3hYqTe2yk8HVcm/LujcTRLK7GDCRGCdMk0A2RW4Cmb9Ak/r osbTZ+Hn8vE8AplwmnbGB3jVPBrjmk3V1lhb09tJGq/vAojWl0gXt1BPr05YnFTmm6+C XuImVKmRDAAsWH7Xl+QuwGARrwmw+baKIBIuAqcECFv/BAgtJ0Z/j6jD66NE5SOaz7Db qcSH/JFLi1922sLuscHq9iRpqmh1hktB2vB+Y6h0+A5MHYEJx3GMJhtkxZFAi5tDIN3R W1dg== 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=017mT2B5QuN4b84+iaIA3wpxh9kFEqP9KKJ1icD7KyE=; b=tBiRMAj/8eYVm9B8Lg1RsiICbfJTHy+7+tp49scN1zMaCPA1sBH+N15LmFScpm9Kn+ UMkCsJiB8RKuISGxZOmwBmnfPVVcuQy/w2f1Y0I9gCGBnknb/ZA9KUocPi5N2QV7VdZy mfbGWUsrY2k6Mz9dWwJYLe1uUUbmQaDOXPU/t72KaM+iiaFZzRdSYKAn5JzHap8WSieU HnVCsXZ8NcJ0gGW1lb1QqJnmk0Aa4TFXSG/CeET1BcWIreBwCYTQOXwaL9+pSo2yxNZo Nmu5y0uS7vILdaI7scy3jC2y8BiGq8/VtvgSOC/8/glkK4BKPce0A0EqcVk7wAsMvC0B mkyw== 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 186si24345140pfc.247.2019.05.29.00.47.03; Wed, 29 May 2019 00:47:18 -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 S1727033AbfE2Hoa (ORCPT + 99 others); Wed, 29 May 2019 03:44:30 -0400 Received: from mailgw02.mediatek.com ([1.203.163.81]:55921 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726921AbfE2HoW (ORCPT ); Wed, 29 May 2019 03:44:22 -0400 X-UUID: 36f4f3e940a84842b2446b41e12d397b-20190529 X-UUID: 36f4f3e940a84842b2446b41e12d397b-20190529 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1033746821; Wed, 29 May 2019 15:44:15 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 29 May 2019 15:44:13 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 29 May 2019 15:44:12 +0800 From: Chunfeng Yun To: Rob Herring , Greg Kroah-Hartman , Heikki Krogerus CC: Mark Rutland , Chunfeng Yun , Matthias Brugger , Adam Thomson , Li Jun , Badhri Jagan Sridharan , Hans de Goede , Andy Shevchenko , Min Guo , , , , , , Biju Das , Linus Walleij , Yu Chen , John Stultz Subject: [PATCH v6 05/10] usb: roles: Introduce stubs for the exiting functions in role.h. Date: Wed, 29 May 2019 15:43:43 +0800 Message-ID: <1559115828-19146-6-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1559115828-19146-1-git-send-email-chunfeng.yun@mediatek.com> References: <1559115828-19146-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- v6: merge this patch [1] into this series to add new API [1] https://patchwork.kernel.org/patch/10909971/ --- 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.21.0