Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp259066ybi; Fri, 31 May 2019 00:43:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqJEY7HvRYxw1s0tPzAeSlPPRAc+N7YRWLjo20FCct/9ESi0lxg2DPTKIOX7+Uvmw3bkOn X-Received: by 2002:a17:902:2ba9:: with SMTP id l38mr962105plb.300.1559288617590; Fri, 31 May 2019 00:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559288617; cv=none; d=google.com; s=arc-20160816; b=WY4DmSvrp/rDajbz4locKtRzrr+wg54fGW7u9kLriGOJJF0FC3O3tupCOJ/RhbISNa 9Rs0zWybrQAsNiH3pY3wtRZ101fryOn+B+X5BG3Ep2EJCS5b2r+zLRAcK6n084s5bnOh teh6qpgsA4qD+6djH71dHB+L2Bdy7GQSq9mLddfACaB+QyqTDZzjLmrdqdshamEynsN5 5e6Js/EppvwrXPXZScY9ccumFYx6rQwqTeq0OOpydsADXcG3Mj4T+3zxEyTY82q6FqjH iqPmOafDXRhi7Q23UgMAFaBq1ZPlzftUiwbpyQxjFyfLk1KO1/epCp/83J4ACe+/Pr32 H+TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=2JJfhjlChlsZblk494lEolIoahzYewRVgkt13gf0nWw=; b=Fz2peC45uLFnyKWdPBRCgrSsvModOdZMB5LIsKbrGou5IF51nl56xX1qiZYhk/GwQZ 0V7lrTLskA0AYv51BIAHpDtAzc3HdE0mpsS27ZbmG2Op+7CX8Iqjx0fiXVCDibKh0Geg VlDi8s0IVWE9rzGh3uMgcPKMwFkcirPWJXRTrsUPqm0Ahaz28u4+CjGaP7aGuwlosdEi ybScOPhNTgNMDMRWnbgAP3za8HtFwFHGfLKra+uU+NX8ztPRzR0CUT5lRT4QuHdys2DR Zfe4BbjLLT3DWSYq8iKOt/eXhD5e0dvrRI7CGFb3F2bysBXTn66pKSRiIMdtfij9nitt OjDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@renesasgroup.onmicrosoft.com header.s=selector2-renesasgroup-onmicrosoft-com header.b=UuI8pqta; 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 h15si4618226pju.84.2019.05.31.00.43.20; Fri, 31 May 2019 00:43:37 -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; dkim=pass header.i=@renesasgroup.onmicrosoft.com header.s=selector2-renesasgroup-onmicrosoft-com header.b=UuI8pqta; 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 S1726880AbfEaHlD (ORCPT + 99 others); Fri, 31 May 2019 03:41:03 -0400 Received: from mail-eopbgr1410120.outbound.protection.outlook.com ([40.107.141.120]:43006 "EHLO JPN01-OS2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726275AbfEaHlC (ORCPT ); Fri, 31 May 2019 03:41:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector2-renesasgroup-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2JJfhjlChlsZblk494lEolIoahzYewRVgkt13gf0nWw=; b=UuI8pqtaJug4kV9Uu/Oe/3rLCLNq7eiMY4k8vSVqL0yp2kn34OWbUyLri+F2I67YD2C4f6rdN6cRVi8PV4IZYEmMEzal8QtuafREC+3xfKedXeVm8UctCJCkwGFCbMP7wyNhtsYCeJXNji0p1CpPACp6jokK826sebNkCYGVx9w= Received: from OSBPR01MB2103.jpnprd01.prod.outlook.com (52.134.242.17) by OSBPR01MB3159.jpnprd01.prod.outlook.com (52.134.253.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.17; Fri, 31 May 2019 07:40:52 +0000 Received: from OSBPR01MB2103.jpnprd01.prod.outlook.com ([fe80::a146:39f0:5df9:11bc]) by OSBPR01MB2103.jpnprd01.prod.outlook.com ([fe80::a146:39f0:5df9:11bc%7]) with mapi id 15.20.1922.021; Fri, 31 May 2019 07:40:52 +0000 From: Biju Das To: Chunfeng Yun , Rob Herring , Greg Kroah-Hartman , Heikki Krogerus CC: Mark Rutland , Matthias Brugger , Adam Thomson , Li Jun , Badhri Jagan Sridharan , Hans de Goede , Andy Shevchenko , Min Guo , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mediatek@lists.infradead.org" , Linus Walleij , Yu Chen Subject: RE: [PATCH v6 06/10] device connection: Add fwnode_connection_find_match() Thread-Topic: [PATCH v6 06/10] device connection: Add fwnode_connection_find_match() Thread-Index: AQHVFfJUqUbU7Icg8UiVJq3QJgY4TaaE3Adg Date: Fri, 31 May 2019 07:40:52 +0000 Message-ID: References: <1559115828-19146-1-git-send-email-chunfeng.yun@mediatek.com> <1559115828-19146-7-git-send-email-chunfeng.yun@mediatek.com> In-Reply-To: <1559115828-19146-7-git-send-email-chunfeng.yun@mediatek.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=biju.das@bp.renesas.com; x-originating-ip: [193.141.220.21] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e226b5ac-0d7b-4e75-1332-08d6e59b4f1e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:OSBPR01MB3159; x-ms-traffictypediagnostic: OSBPR01MB3159: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 00540983E2 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(136003)(39860400002)(396003)(376002)(346002)(366004)(189003)(199004)(51914003)(305945005)(53936002)(33656002)(110136005)(99286004)(5660300002)(256004)(14444005)(76176011)(4326008)(25786009)(68736007)(6116002)(2906002)(7736002)(6246003)(86362001)(7696005)(74316002)(71200400001)(11346002)(71190400001)(7416002)(476003)(3846002)(54906003)(52536014)(9686003)(66066001)(55016002)(186003)(76116006)(26005)(14454004)(102836004)(64756008)(66946007)(44832011)(229853002)(81156014)(73956011)(6436002)(478600001)(6506007)(316002)(446003)(66556008)(8936002)(66476007)(66446008)(486006)(81166006)(8676002);DIR:OUT;SFP:1102;SCL:1;SRVR:OSBPR01MB3159;H:OSBPR01MB2103.jpnprd01.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:0; received-spf: None (protection.outlook.com: bp.renesas.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 9ve87iDhwS2Bv2t20CDXq8Lmym3IMLYLmUYuFGiVVhZDrG3GENrS7SgY7pnqrMT3/ZjRVbEDCvmoBaeUENs63lIDw7TKlli4dQ7R8gQO93Q6o1BwEbKkPZM4h+oLnAMB82hoB/8raodlNKKedS6veSvDqegQgbePg6vWFbZXkXSa9O8BxoX3oXr1s+DRjOdGTqj8Y7VW4xCSR2W022adb0g3eFiekoRIPHBAPCc0C92EpbxZgaO2qCnAO559QZESckJFltNM0dkP7Q9tY30XufQO5DiPAvOmuKCf+sCgSKbgMmx36D2CGLm+dKZ6ci/wfdOZa0PUuN3dIMhDzXmpwikBSw1No7LOGoAWbuMpfryrYXjOJdV1NKNRw0bK2z3zK8+jJuKVgqutNW0ICFaVTvV5+LLsk73NkjCaiMEtB9k= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: bp.renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: e226b5ac-0d7b-4e75-1332-08d6e59b4f1e X-MS-Exchange-CrossTenant-originalarrivaltime: 31 May 2019 07:40:52.6808 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: biju.das@bp.renesas.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSBPR01MB3159 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thanks for the patch > Subject: [PATCH v6 06/10] device connection: Add > fwnode_connection_find_match() >=20 > From: Heikki Krogerus >=20 > The fwnode_connection_find_match() function is exactly the same as > device_connection_find_match(), except it takes struct fwnode_handle as > parameter instead of struct device. > That allows locating device connections before the device entries have be= en > created. >=20 > Signed-off-by: Heikki Krogerus Tested-by: Biju Das > --- > v6: > new patch > --- > drivers/base/devcon.c | 33 +++++++++++++++++++++++++-------- > include/linux/device.h | 10 +++++++--- > 2 files changed, 32 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/base/devcon.c b/drivers/base/devcon.c index > 04db9ae235e4..8311b70bbca2 100644 > --- a/drivers/base/devcon.c > +++ b/drivers/base/devcon.c > @@ -12,9 +12,6 @@ > static DEFINE_MUTEX(devcon_lock); > static LIST_HEAD(devcon_list); >=20 > -typedef void *(*devcon_match_fn_t)(struct device_connection *con, int > ep, > - void *data); > - > static void * > fwnode_graph_devcon_match(struct fwnode_handle *fwnode, const char > *con_id, > void *data, devcon_match_fn_t match) @@ -38,6 > +35,28 @@ fwnode_graph_devcon_match(struct fwnode_handle *fwnode, > const char *con_id, > return NULL; > } >=20 > +/** > + * fwnode_connection_find_match - Find connection from a device node > + * @fwnode: Device node with the connection > + * @con_id: Identifier for the connection > + * @data: Data for the match function > + * @match: Function to check and convert the connection description > + * > + * Find a connection with unique identifier @con_id between @fwnode and > +another > + * device node. @match will be used to convert the connection > +description to > + * data the caller is expecting to be returned. > + */ > +void *fwnode_connection_find_match(struct fwnode_handle *fwnode, > + const char *con_id, void *data, > + devcon_match_fn_t match) > +{ > + if (!fwnode || !match) > + return NULL; > + > + return fwnode_graph_devcon_match(fwnode, con_id, data, match); > } > +EXPORT_SYMBOL_GPL(fwnode_connection_find_match); > + > /** > * device_connection_find_match - Find physical connection to a device > * @dev: Device with the connection > @@ -61,11 +80,9 @@ void *device_connection_find_match(struct device > *dev, const char *con_id, > if (!match) > return NULL; >=20 > - if (fwnode) { > - ret =3D fwnode_graph_devcon_match(fwnode, con_id, data, > match); > - if (ret) > - return ret; > - } > + ret =3D fwnode_connection_find_match(fwnode, con_id, data, > match); > + if (ret) > + return ret; >=20 > mutex_lock(&devcon_lock); >=20 > diff --git a/include/linux/device.h b/include/linux/device.h index > e85264fb6616..9445f068602f 100644 > --- a/include/linux/device.h > +++ b/include/linux/device.h > @@ -772,10 +772,14 @@ struct device_connection { > struct list_head list; > }; >=20 > +typedef void *(*devcon_match_fn_t)(struct device_connection *con, int > ep, > + void *data); > + > +void *fwnode_connection_find_match(struct fwnode_handle *fwnode, > + const char *con_id, void *data, > + devcon_match_fn_t match); > void *device_connection_find_match(struct device *dev, const char > *con_id, > - void *data, > - void *(*match)(struct device_connection > *con, > - int ep, void *data)); > + void *data, devcon_match_fn_t match); >=20 > struct device *device_connection_find(struct device *dev, const char > *con_id); >=20 > -- > 2.21.0