From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12C2BC43381 for ; Fri, 15 Mar 2019 09:14:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF23F218B0 for ; Fri, 15 Mar 2019 09:14:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Db42HRCj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF23F218B0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rzVSb5nWIBewXeC+Geg6TzPayzsAmHOautUDQelBmCo=; b=Db42HRCjXn5vKi QHVrCXqMtzw6poVZSlp8hqOtVxshBmxtw7lchMOr+yvOQ2nwasYgTI2lOLalKG4Ma7WOXA0TBTqjJ giEhSR7ArbJOPYd3cCxoFfH/TJ2CW6MweX586wbn5/m/B+94Q/iZCU6rTN1qv8unMzqD94XOdt5gp FQmYFi9zNov5AxU6VM5PS9+Q9BhNCigKNGxRBKZZ4PkhHmMrYcEP5ujlr68Z3t3sVLxir6LmR5ALx 9bSjQpPCVYrstjYaz7cNAAAf4nuZwQV/7adQ7WtX+BqaxirNJPAWk5KMwomy8MC3QJW8rRuBeYYcF 21t4eA7Gfpwj2mky+N/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4iue-0004Cd-EB; Fri, 15 Mar 2019 09:14:00 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4iub-0004BR-D3; Fri, 15 Mar 2019 09:13:58 +0000 X-UUID: 9b8cc23d81414ad9ab3ac6a2126cc25f-20190315 X-UUID: 9b8cc23d81414ad9ab3ac6a2126cc25f-20190315 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 689548785; Fri, 15 Mar 2019 01:13:30 -0800 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 15 Mar 2019 02:13:28 -0700 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 15 Mar 2019 17:13:26 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 15 Mar 2019 17:13:24 +0800 Message-ID: <1552641204.10179.133.camel@mhfsdcap03> Subject: Re: [PATCH v2 4/6] usb: roles: add API to get usb_role_switch by node From: Chunfeng Yun To: Heikki Krogerus Date: Fri, 15 Mar 2019 17:13:24 +0800 In-Reply-To: <20190315081835.GD7752@kuha.fi.intel.com> References: <1552635513-2378-1-git-send-email-chunfeng.yun@mediatek.com> <1552635513-2378-5-git-send-email-chunfeng.yun@mediatek.com> <20190315081835.GD7752@kuha.fi.intel.com> X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190315_021357_450188_82E170CE X-CRM114-Status: GOOD ( 18.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Hans de Goede , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Badhri Jagan Sridharan , Andy Shevchenko , Rob Herring , linux-mediatek@lists.infradead.org, Min Guo , Matthias Brugger , Adam Thomson , linux-arm-kernel@lists.infradead.org, Li Jun Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Fri, 2019-03-15 at 10:18 +0200, Heikki Krogerus wrote: > On Fri, Mar 15, 2019 at 03:38:31PM +0800, Chunfeng Yun wrote: > > Add usb_role_switch_get_by_node() to make easier to get > > usb_role_switch by node which register it. > > It's useful when there is not device_connection registered > > between two drivers and only knows the node which register > > usb_role_switch. > > > > Signed-off-by: Chunfeng Yun > > --- > > drivers/usb/roles/class.c | 30 ++++++++++++++++++++++++++++++ > > include/linux/usb/role.h | 1 + > > 2 files changed, 31 insertions(+) > > > > diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c > > index 99116af07f1d..284b19856dc4 100644 > > --- a/drivers/usb/roles/class.c > > +++ b/drivers/usb/roles/class.c > > @@ -11,6 +11,7 @@ > > #include > > #include > > #include > > +#include > > #include > > > > static struct class *role_class; > > @@ -121,6 +122,35 @@ struct usb_role_switch *usb_role_switch_get(struct device *dev) > > } > > EXPORT_SYMBOL_GPL(usb_role_switch_get); > > > > +static int __switch_match_node(struct device *dev, const void *node) > > +{ > > + return dev->parent->of_node == (const struct device_node *)node; > > +} > > Andy already pointed out that you need to use fwnodes. > > Rule of thumb: You always use fwnodes. Only if there is something that > can't be done with fwnodes you use DT or ACPI nodes directly. > > In this case there is absolutely nothing that would prevent you from > using fwnodes. > Got it, will fix it in next version. BTW: I encounter a build error when CONFIG_USB_ROLE_SWITCH is not enabled, drivers/usb/mtu3/mtu3_dr.o: In function `ssusb_role_sw_register': ./drivers/usb/mtu3/mtu3_dr.c:460: undefined reference to `usb_role_switch_register' drivers/usb/mtu3/mtu3_dr.o: In function `ssusb_otg_switch_exit': ./drivers/usb/mtu3/mtu3_dr.c:491: undefined reference to `usb_role_switch_unregister' the following patch has fixed the issue, but seems not get into kernel, [v3,08/12] usb: roles: Add usb role switch notifier. https://patchwork.kernel.org/patch/10836525/ What should I do if I add a new API? Thanks > > thanks, > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel