From patchwork Fri Jul 25 14:23:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Moll X-Patchwork-Id: 34286 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 83FAA235AB for ; Fri, 25 Jul 2014 14:24:54 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id h18sf3129181igc.9 for ; Fri, 25 Jul 2014 07:24:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=jMVR7JDlBFueuchc74pzp+flXH+TdhTLGHdXWGBcCMs=; b=VLxn5YPcn4mF583/C89ey8zhX/YXg/dCcibPqlJrUJdQb4fq0iKUhkBtJ5ceRoQ/6H MVG1IFS/fACbSQUPe84TyxH70rw5Cc1SjCsjgSLkl9Z0gK1UcmO+cQ/P5F6nbMvpCzUs 6lXIQAbxAaYMqeDqvUK14TR48wGX0iMsihzGFW+r6qhbnyE358yQKtht8/lTqaRs8pTu uGNqbwA67Y0XPY0477DdxV7ReclNjWDs8cJn4ZgDSpxbVGBJNNP0yYDvH2cnxZWz+CFi IZw9fharU1ZZrkidpz57RPej/ABmHFfeuUaoU4+yakY7X/2Bi2KYyaoHEyQTPcxLNH5t JWiQ== X-Gm-Message-State: ALoCoQmCfS+K7fWAW2jT6JqizAZvZTiMTvv6Wq2jCBDJvxDhU6ymtCpMXSAucnEKW0VCeOKshHSu X-Received: by 10.50.171.233 with SMTP id ax9mr2319249igc.6.1406298294072; Fri, 25 Jul 2014 07:24:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.17 with SMTP id z17ls1198778qge.74.gmail; Fri, 25 Jul 2014 07:24:53 -0700 (PDT) X-Received: by 10.52.120.38 with SMTP id kz6mr1674829vdb.86.1406298293910; Fri, 25 Jul 2014 07:24:53 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id 13si7456251vdg.106.2014.07.25.07.24.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Jul 2014 07:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id hq11so7451033vcb.30 for ; Fri, 25 Jul 2014 07:24:53 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr21539884vcb.0.1406298293790; Fri, 25 Jul 2014 07:24:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp42030vcb; Fri, 25 Jul 2014 07:24:53 -0700 (PDT) X-Received: by 10.66.184.79 with SMTP id es15mr18987606pac.57.1406298292227; Fri, 25 Jul 2014 07:24:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rc17si9384966pab.87.2014.07.25.07.24.51 for ; Fri, 25 Jul 2014 07:24:52 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760606AbaGYOYh (ORCPT + 14 others); Fri, 25 Jul 2014 10:24:37 -0400 Received: from fw-tnat.austin.arm.com ([217.140.110.23]:54116 "EHLO collaborate-mta1.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752994AbaGYOYV (ORCPT ); Fri, 25 Jul 2014 10:24:21 -0400 Received: from hornet.Cambridge.Arm.com (hornet.cambridge.arm.com [10.2.201.42]) by collaborate-mta1.arm.com (Postfix) with ESMTP id E39A013FABF; Fri, 25 Jul 2014 09:24:19 -0500 (CDT) From: Pawel Moll To: Greg Kroah-Hartman Cc: Olof Johansson , Stephen Warren , Catalin Marinas , paul@pwsan.com, Arnd Bergmann , Peter De Schrijver , arm@kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Pawel Moll Subject: [PATCH 5/5] platform: Make platform_bus device a platform device Date: Fri, 25 Jul 2014 15:23:53 +0100 Message-Id: <1406298233-27876-5-git-send-email-pawel.moll@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1406298233-27876-1-git-send-email-pawel.moll@arm.com> References: <1406298233-27876-1-git-send-email-pawel.moll@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pawel.moll@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , ... describing the root of the device tree, so one can write a platform driver initializing the platform. Signed-off-by: Pawel Moll --- drivers/base/platform.c | 20 ++++++++++++++------ include/linux/platform_device.h | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index eee48c4..9caffa7 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -30,8 +30,8 @@ /* For automatically allocated device IDs */ static DEFINE_IDA(platform_devid_ida); -struct device platform_bus = { - .init_name = "platform", +struct platform_device platform_bus = { + .name = "platform", }; EXPORT_SYMBOL_GPL(platform_bus); @@ -300,7 +300,7 @@ int platform_device_add(struct platform_device *pdev) return -EINVAL; if (!pdev->dev.parent) - pdev->dev.parent = &platform_bus; + pdev->dev.parent = &platform_bus.dev; pdev->dev.bus = &platform_bus_type; @@ -946,12 +946,20 @@ int __init platform_bus_init(void) early_platform_cleanup(); - error = device_register(&platform_bus); + dev_set_name(&platform_bus.dev, "%s", platform_bus.name); + error = device_register(&platform_bus.dev); if (error) return error; error = bus_register(&platform_bus_type); - if (error) - device_unregister(&platform_bus); + if (!error) { +#ifdef CONFIG_OF + platform_bus.dev.of_node = of_allnodes; +#endif + platform_bus.dev.bus = &platform_bus_type; + bus_add_device(&platform_bus.dev); + } else { + device_unregister(&platform_bus.dev); + } return error; } diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 16f6654..a99032a 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -44,7 +44,7 @@ extern int platform_device_register(struct platform_device *); extern void platform_device_unregister(struct platform_device *); extern struct bus_type platform_bus_type; -extern struct device platform_bus; +extern struct platform_device platform_bus; extern void arch_setup_pdev_archdata(struct platform_device *); extern struct resource *platform_get_resource(struct platform_device *,