Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp487632imp; Wed, 20 Feb 2019 03:52:07 -0800 (PST) X-Google-Smtp-Source: AHgI3IZTFhxYxc0MYn3ADj/bGCZyCm/crY4RlOdsV5ECnqpV0xOFVfggub7vo8RSZnd+te0pwwQP X-Received: by 2002:a17:902:7d89:: with SMTP id a9mr20047665plm.33.1550663527491; Wed, 20 Feb 2019 03:52:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550663527; cv=none; d=google.com; s=arc-20160816; b=iwQQ8+VwJp3IyguhdfSuPx7LtN6M/resMhWRcVySAi7X4p93rAHqde76QScIS/VuQp DEaR5FRukJKc7lmreukFXKDG49Y/bBDy/sGEYYVen0i2es5c0emtUm+lcoVktKMEcbDw gCeMX/e5MLc5KQs3nef2usLB9t++efUGJv+lc0I3tet6s0f1FhElpVld5jPfnkrf6yCE A+PblHCMIO79kWYjlsnsBzZfn99+A6JVtDEct3An6/WoD7tBGn1f1rJHWVYwnTc6jrp5 XG30voYFfjfLgZwCnE5TYqLVKYF1ImHApcGeQ/Gy9b+806unlT+6ReM4NzAHyCCZIkjC Thtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ObCtWlCCUaEKXe6dR/Vv0KvJrO7uru38/f6Zl9kTejk=; b=aa6XUpo+pQ95cZ1CJ4n/06j1YvtHud5iUQXAsGwEjzArBy99q5T4yXSzFA5HCyDy3A btmduCaas2Re4zzfom0cO25BOTxmxolzuFx7ncrDfmpkBzH4Dfn5qAnCP6aK1pHMyqRr XLLCrZNbbvwORSUAYaZ8Vp2A3C9GhmZI+EtOR2ZxKLpcjDymwJ8b6YI/HmFF7PuRt53R Yqo2VRACsJsioZ37xz1ZqYTQxrw4sOs76wPX0frexVqOFVb39ISzTYCRoJ3LxUNmkkLK hNBAaBf9VEREL6ULl5QXM1ueZN94KuOE6fJiWWyhwnVdTmpRHrC09v6AOtVNsOi1jeEq 923Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o24si6561306pgh.114.2019.02.20.03.51.51; Wed, 20 Feb 2019 03:52:07 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727064AbfBTLvT (ORCPT + 99 others); Wed, 20 Feb 2019 06:51:19 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:33785 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbfBTLvT (ORCPT ); Wed, 20 Feb 2019 06:51:19 -0500 Received: by mail-lf1-f65.google.com with SMTP id q12so17381785lfm.0 for ; Wed, 20 Feb 2019 03:51:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ObCtWlCCUaEKXe6dR/Vv0KvJrO7uru38/f6Zl9kTejk=; b=piyTTvkf2FyTRun31MomvFr6GPwFyqAbyOy+UuDerdY7gElOyDEqOx05eQoUBQ21B9 q1meJKXUgVMN2zkQc+cCGZaBtEn8DF3VHZUC0S0efIBeM04RmuQ/kK7++YKATSZ253bl Jj4fjvP1srY5m8QhSGdnvb23O2xyCGpORQxpkcojpj887eAx3g2ZBiE+IqNm7eTkwdp9 TZdOjSs0CJDYNTa5SL/O3FWV/lSQgnYcjmQY8+/8Xb6MIj2PDMxZhRC537G78ekyRR55 sxdr+yn8wlmiBwLPO1ct8p4AKHc03ZzWzl8qHfpzQEkudoCNo/H1ZIgNZASZdABk2e88 /RAA== X-Gm-Message-State: AHQUAubTHHVB4gcj/52uEN1GVxsalukRAM8Zl/SWIqck0x3teP3vwdaV gnrKnuouEajRCZ4/sY5aRfk= X-Received: by 2002:a19:911c:: with SMTP id t28mr20662267lfd.78.1550663476727; Wed, 20 Feb 2019 03:51:16 -0800 (PST) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id e72sm1657225ljf.85.2019.02.20.03.51.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Feb 2019 03:51:15 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1gwQPF-0002OE-GQ; Wed, 20 Feb 2019 12:51:17 +0100 Date: Wed, 20 Feb 2019 12:51:17 +0100 From: Johan Hovold To: Mans Rullgard Cc: "Rafael J. Wysocki" , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: Re: [PATCH] platform: set of_node in platform_device_register_full() Message-ID: <20190220115117.GK4072@localhost> References: <20190216164512.9525-1-mans@mansr.com> <20190220113506.11009-1-mans@mansr.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190220113506.11009-1-mans@mansr.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 20, 2019 at 11:35:06AM +0000, Mans Rullgard wrote: > If the provided fwnode is an OF node, set dev.of_node as well. > > Some drivers are just shims that create extra "glue" devices with the > DT device as parent and have the real driver bind to these. In these > cases, the glue device needs to get a reference to the original DT node > in order for the main driver to access properties and child nodes. > > For example, the sunxi-musb driver creates such a glue device using > platform_device_register_full(). Consequently, devices attached to > this USB interface don't get associated with DT nodes, if present, > the way they do with EHCI. > > This change will allow sunxi-musb and similar driver to easily > propagate the DT node to child devices as required. Just a drive-by comment, didn't look to closely at this patch, but this all sounds familiar. Note that if both platform devices are bound to drivers you may end up with some resources like pinctrl which are handled automatically by driver core at probe time to be requested twice (and failing the second time). Take a look at 4e75e1d7dac9 ("driver core: add helper to reuse a device-tree node"), which provides a means to avoid this, and 49484abd93ab ("USB: musb: dsps: propagate device-tree node"). > Signed-off-by: Mans Rullgard > --- > drivers/base/platform.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index dff82a3c2caa..853a1d0e5845 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -512,6 +512,7 @@ struct platform_device *platform_device_register_full( > > pdev->dev.parent = pdevinfo->parent; > pdev->dev.fwnode = pdevinfo->fwnode; > + pdev->dev.of_node = of_node_get(to_of_node(pdev->dev.fwnode)); > > if (pdevinfo->dma_mask) { > /* Johan