From patchwork Mon Dec 9 22:06:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 3313301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 86ECB9F37A for ; Mon, 9 Dec 2013 22:07:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ABB4C2015D for ; Mon, 9 Dec 2013 22:07:30 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B294E20158 for ; Mon, 9 Dec 2013 22:07:29 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vq8z8-0008Iz-2S; Mon, 09 Dec 2013 22:07:26 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vq8z5-0004In-P8; Mon, 09 Dec 2013 22:07:23 +0000 Received: from avon.wwwdotorg.org ([70.85.31.133]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vq8z2-0004I3-1i for linux-arm-kernel@lists.infradead.org; Mon, 09 Dec 2013 22:07:20 +0000 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 4934E6253; Mon, 9 Dec 2013 15:06:58 -0700 (MST) Received: from swarren-lx1.nvidia.com (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id B3C74E460E; Mon, 9 Dec 2013 15:06:41 -0700 (MST) From: Stephen Warren To: Lee Jones , Samuel Ortiz , Alessandro Zummo , Andrew Morton Subject: [PATCH 1/3] mfd: always assign of_node in mfd_add_device() Date: Mon, 9 Dec 2013 15:06:47 -0700 Message-Id: <1386626809-6251-1-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.8.1.5 X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.97.8 at avon.wwwdotorg.org X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131209_170720_172144_EAA0069E X-CRM114-Status: GOOD ( 14.39 ) X-Spam-Score: -1.9 (-) Cc: Mark Rutland , devicetree@vger.kernel.org, Stephen Warren , rtc-linux@googlegroups.com, Pawel Moll , Ian Campbell , Rob Herring , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Stephen Warren mfd_add_device() assigns .of_node in the device objects it creates only if the mfd_cell for the device has the .of_compatible field set and the DT node for the top-level MFD device contains a child whose compatible property matches the cell's .of_compatible field. This leaves .of_node unset in many cases. When this happens, entries in the DT /aliases property which refer to the top-level MFD DT node will never match the MFD child devices, hence causing the requested alias not to be honored. Solve this by setting each MFD child device's .of_node equal to the top- level MFD device's .of_node field in the cases where it would otherwise remain unset. The first use-case for this will be aliases for the TPS6586x's RTC device. Signed-off-by: Stephen Warren --- The 3 patches in this series are all independent; they can be applied to their respective subsystems in any order. I'm simply posting them as a series to make the use-case more obvious. --- drivers/mfd/mfd-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 267649244737..32e8d47d9002 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -117,6 +117,8 @@ static int mfd_add_device(struct device *parent, int id, } } } + if (!pdev->dev.of_node) + pdev->dev.of_node = parent->of_node; if (cell->pdata_size) { ret = platform_device_add_data(pdev,