From patchwork Fri Sep 16 11:12:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 9335491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EFE84607FF for ; Fri, 16 Sep 2016 11:15:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0D3E29F2B for ; Fri, 16 Sep 2016 11:15:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D53F229F3C; Fri, 16 Sep 2016 11:15:12 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AA18929F30 for ; Fri, 16 Sep 2016 11:15:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bkr5O-0004rN-QK; Fri, 16 Sep 2016 11:13:38 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bkr3x-0003Wi-PP for linux-arm-kernel@lists.infradead.org; Fri, 16 Sep 2016 11:12:12 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7B5A022E; Fri, 16 Sep 2016 04:11:48 -0700 (PDT) Received: from red-moon (red-moon.cambridge.arm.com [10.1.206.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 974533F21A; Fri, 16 Sep 2016 04:11:46 -0700 (PDT) Date: Fri, 16 Sep 2016 12:12:07 +0100 From: Lorenzo Pieralisi To: Rob Herring Subject: Re: [PATCH] of/platform: Initialise dev->fwnode appropriately Message-ID: <20160916111207.GA32342@red-moon> References: <38259ab3716da072fab37f06d034329244491c13.1473865096.git.robin.murphy@arm.com> <20160915133657.GB14424@rob-hp-laptop> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160915133657.GB14424@rob-hp-laptop> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160916_041210_083298_A27F1B59 X-CRM114-Status: GOOD ( 14.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, salil.mehta@huawei.com, Robin Murphy , linux-kernel@vger.kernel.org, okaya@codeaurora.org, yisen.zhuang@huawei.com, frowand.list@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Sep 15, 2016 at 08:36:57AM -0500, Rob Herring wrote: > On Wed, Sep 14, 2016 at 04:01:24PM +0100, Robin Murphy wrote: > > Whilst we're some of the way towards a universal firmware property > > interface, drivers which deal with both OF and ACPI probing end up > > having to do things like this: > > > > dev->of_node ? &dev->of_node->fwnode : dev->fwnode > > > > This seems unnecessary, when the OF code could instead simply fill in > > the device's fwnode when binding the of_node, and let the drivers use > > dev->fwnode either way. Let's give it a go and see what falls out. > > > > Signed-off-by: Robin Murphy > > --- > > drivers/of/platform.c | 2 ++ > > 1 file changed, 2 insertions(+) > > I've applied this, but what about non-platform devices such as i2c? Thanks ! Patch below should do for mfd and i2c (to be confirmed) but I am pretty certain it is still missing some devices, are we going to convert them on a case-by-case policy (ie when/if needed) ? Lorenzo -- >8 -- diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index da3a02e..667a393 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1574,6 +1574,7 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, info.addr = addr; info.of_node = of_node_get(node); + info.fwnode = &node->fwnode; info.archdata = &dev_ad; if (of_get_property(node, "wakeup-source", NULL)) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 3ac486a..c264bf5 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -179,6 +179,7 @@ static int mfd_add_device(struct device *parent, int id, for_each_child_of_node(parent->of_node, np) { if (of_device_is_compatible(np, cell->of_compatible)) { pdev->dev.of_node = np; + pdev->dev.fwnode = &np->fwnode; break; } }