From patchwork Tue Nov 4 10:45:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 5225201 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 6430D9F430 for ; Tue, 4 Nov 2014 10:48:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 858FC20166 for ; Tue, 4 Nov 2014 10:48:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 A81CA20136 for ; Tue, 4 Nov 2014 10:48:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xlbct-0002gE-Hh; Tue, 04 Nov 2014 10:46:15 +0000 Received: from mail-wi0-f171.google.com ([209.85.212.171]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xlbcq-0002ZO-0I for linux-arm-kernel@lists.infradead.org; Tue, 04 Nov 2014 10:46:13 +0000 Received: by mail-wi0-f171.google.com with SMTP id q5so8989833wiv.4 for ; Tue, 04 Nov 2014 02:45:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=UMG9FHNi+DCBb7lByfjHe1NdPre5UxbQsj5T9YlgSPk=; b=KPRM+BTPZfwS2tPcQkgBrjkyeysdIsfoNoQMq9t8olWsHF5QfzGlaZeeBJipIsrzAW S6jmkfYC7PsAWu7zSrSCZecs/cmqZ7hnnNMjD8EY3RohV9PSJ0TqWbp9UjQBgyg2ajrO yDdoMSgky385GUq2ZcdPBBAEjgPOHw6CBV6NF/tNBrKV58idC/sGcWjZbRYkNqqwlpVo Ao9s6Y6jYkUyyWGcxRvom6sawHKGSNIGfZpwehS/C2LTlND3ObI7fJ7q6Fe/mIQFULPW Zva20G8ZAt1aZuj+lmAJ895uPzcKrzz0ulW2HBkCNXYbdwMOXwPB+yqnoeO2MAv7Sybk Qs0w== X-Gm-Message-State: ALoCoQml1fviVVWSMllgYrHb6iDlk9326tPewgpc3h7m+FsHRw99Y4rY8+1z8AHlG+8/evDgS65v X-Received: by 10.180.73.45 with SMTP id i13mr16064297wiv.32.1415097949830; Tue, 04 Nov 2014 02:45:49 -0800 (PST) Received: from trevor.secretlab.ca (host81-159-9-229.range81-159.btcentralplus.com. [81.159.9.229]) by mx.google.com with ESMTPSA id vq1sm69647wjc.29.2014.11.04.02.45.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Nov 2014 02:45:48 -0800 (PST) Received: by trevor.secretlab.ca (Postfix, from userid 1000) id 9BE39C409C2; Tue, 4 Nov 2014 10:45:34 +0000 (GMT) From: Grant Likely To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] of/platform: Move platform devices under /sys/devices/platform Date: Tue, 4 Nov 2014 10:45:20 +0000 Message-Id: <1415097920-30014-1-git-send-email-grant.likely@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141104_024612_195864_B6536200 X-CRM114-Status: GOOD ( 13.28 ) X-Spam-Score: -0.7 (/) Cc: Grant Likely , Greg Kroah-Hartman , Rob Herring , Arnd Bergmann , Benjamin Herrenschmidt X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 Currently the devices created by drivers/of/platform.c get created at the root of /sys/devices. This goes against the typical pattern for sysfs where the top level /sys/devices structure contains categories of devices, and the structure of devices is placed below that. To fix this, make the code in drivers/of/platform.c follow the drivers/base/platform.c behaviour, and use &platform_bus as the default parent for all new platform_devices and amba_devices. This change has been discussed for a long time, but nobody has actually acted on it. Userspace code that expects to find devices under a fixed /sys/devices/... path will be affected. It isn't /supposed/ to do that, but if anyone complains then I'll add a default-off workaround option to put them back into the root. Signed-off-by: Grant Likely Cc: Rob Herring Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Benjamin Herrenschmidt Acked-by: Greg Kroah-Hartman --- drivers/of/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 3b64d0bf5bba..7c6771986c06 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -138,7 +138,7 @@ struct platform_device *of_device_alloc(struct device_node *np, } dev->dev.of_node = of_node_get(np); - dev->dev.parent = parent; + dev->dev.parent = parent ? : &platform_bus; if (bus_id) dev_set_name(&dev->dev, "%s", bus_id); @@ -291,7 +291,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node, /* setup generic device info */ dev->dev.of_node = of_node_get(node); - dev->dev.parent = parent; + dev->dev.parent = parent ? : &platform_bus; dev->dev.platform_data = platform_data; if (bus_id) dev_set_name(&dev->dev, "%s", bus_id);