Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp476022imp; Wed, 20 Feb 2019 03:37:04 -0800 (PST) X-Google-Smtp-Source: AHgI3IaS9ts8FdWH7vMq22vkqCJBrNiV4odgIq2veBXC54XJ/Z9Zj/sFryhnco5pzbklxBBOHaBU X-Received: by 2002:a62:53c7:: with SMTP id h190mr21463081pfb.204.1550662624678; Wed, 20 Feb 2019 03:37:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550662624; cv=none; d=google.com; s=arc-20160816; b=qzzmz/WyMk+Ji5gdmWfbNy+8lH1Eska67sxrMEde1q+JceNB3QeyM5aeRA70HGdl4u aTcFdMcSHQY7AvBzyVE1//5ZejhRcfEZa+hfOV4aggmNhUA6QQLzdiO+BlKxClO4JoU1 GQXG/RCZC78g48DDWADGRhKer8PWhc4wVCKzEJH3jPEg/rr+J2pE+alevCCcIpisoS+w S0HENh5SnP4Kh5dkOAP+6VLhjF9f2Y0pkfwkrxnA7bgr4whBRpvLc2lCsCofwKsSol1h xDP9vCvOnHECkuTNCYEsCegaJG9dYBTGYJLtHNZCv299M+7YPxO3MqqFt9ce1f3dpMBR 1yOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6apbI1zI9lxVMeeS5fjjHP3RkPkKzCcj/KvVkDmndeg=; b=nR9kyO+h+T2w4FDi4cMeoJHX40/1zvyVrFlP9NrefqI37Y1xHnE9S6tVTBcr3KoDsn ZY9fFYhtjseE42MakNxGuwyS2afGJ5N6y86Mw1dC2jIoDy0dJwrVn0N+t7FkzMvwwJHY 8JaDRRdjwCjoVHREn5V8PIXn33H9VXhUqZsrxYEa2y3vZDVSGxTNSjMvjZeh499NLHb6 o4GGoiDbp70nb7LqHL4sAAZi1wcwFwZqmxZ9/GosXbs4otyO0ZDDMlSOBJzgKWVTxvX5 RxY22BprhmhfQLqS8Oday8+dRn+Mj1j9ccILCJ0REWB3s9sF3RgwfjMy3dDOEaUPUM4/ CcRA== 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 y9si17456050pfm.36.2019.02.20.03.36.49; Wed, 20 Feb 2019 03:37:04 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727267AbfBTLfX (ORCPT + 99 others); Wed, 20 Feb 2019 06:35:23 -0500 Received: from unicorn.mansr.com ([81.2.72.234]:44572 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbfBTLfW (ORCPT ); Wed, 20 Feb 2019 06:35:22 -0500 Received: by unicorn.mansr.com (Postfix, from userid 51770) id 3AACF15632; Wed, 20 Feb 2019 11:35:21 +0000 (GMT) From: Mans Rullgard To: "Rafael J. Wysocki" Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: [PATCH] platform: set of_node in platform_device_register_full() Date: Wed, 20 Feb 2019 11:35:06 +0000 Message-Id: <20190220113506.11009-1-mans@mansr.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190216164512.9525-1-mans@mansr.com> References: <20190216164512.9525-1-mans@mansr.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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) { /* -- 2.20.1