public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Rob Herring <robh+dt@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Arnd Bergmann <arnd@arndb.de>, "Shawn Guo" <shawnguo@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	"Grant Likely" <grant.likely@linaro.org>,
	Olof Johansson <olof@lixom.net>,
	"Russell King - ARM Linux" <linux@arm.linux.org.uk>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Hanjun Guo <guohanjun@huawei.com>,
	"Frank Rowand" <frowand.list@gmail.com>
Subject: Re: [PATCH v4 01/18] of/platform: Add common method to populate default bus
Date: Thu, 26 May 2016 15:43:00 +0800	[thread overview]
Message-ID: <5746A904.6080003@huawei.com> (raw)
In-Reply-To: <CAL_JsqJt9qa+3eAO95kvM7h2beRfq3q1Bi39K7uhURTp=f_DtQ@mail.gmail.com>



On 2016/5/25 22:46, Rob Herring wrote:
> On Thu, May 12, 2016 at 7:05 AM, Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>> The arch code calls of_platform_populate() with default match table
>> when it want to populate default bus.
>>
>> This patch introduce a new of_platform_default_populate_init() and make it
>> arch_initcall_sync(it should be later than some iommu configration, eg,
>> of_iommu_init() and swiotlb_late_init in arm64), then we can finish above
>> job in common method.
>>
>> In order to avoid the default bus being populated twice, simply checking
>> the flag of bus node whether has be set OF_POPULATED_BUS or not.
>>
>> After that, we can safely remove the caller in arch code.
>>
>> Btw, add debug print in of_platform_populate(), and use __func__ to
>> print function's name of of_platform_bus_create().
>>
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: Frank Rowand <frowand.list@gmail.com>
>> Cc: Grant Likely <grant.likely@linaro.org>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
>>  drivers/of/platform.c | 23 ++++++++++++++++++++++-
>>  1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
>> index 8d103e4..f601b30 100644
>> --- a/drivers/of/platform.c
>> +++ b/drivers/of/platform.c
>> @@ -11,6 +11,7 @@
>>   *  2 of the License, or (at your option) any later version.
>>   *
>>   */
>> +#include <linux/acpi.h>
>>  #include <linux/errno.h>
>>  #include <linux/module.h>
>>  #include <linux/amba/bus.h>
>> @@ -345,6 +346,12 @@ static int of_platform_bus_create(struct device_node *bus,
>>                 return 0;
>>         }
>>
>> +       if (of_node_check_flag(bus, OF_POPULATED_BUS)) {
>> +               pr_debug("%s() - skipping %s, already populated\n",
>> +                       __func__, bus->full_name);
>> +               return 0;
>> +       }
>> +
>>         auxdata = of_dev_lookup(lookup, bus);
>>         if (auxdata) {
>>                 bus_id = auxdata->name;
>> @@ -396,7 +403,7 @@ int of_platform_bus_probe(struct device_node *root,
>>         if (!root)
>>                 return -EINVAL;
>>
>> -       pr_debug("of_platform_bus_probe()\n");
>> +       pr_debug("%s()\n", __func__);
>>         pr_debug(" starting at: %s\n", root->full_name);
>>
>>         /* Do a self check of bus type, if there's a match, create children */
>> @@ -448,6 +455,9 @@ int of_platform_populate(struct device_node *root,
>>         if (!root)
>>                 return -EINVAL;
>>
>> +       pr_debug("%s()\n", __func__);
>> +       pr_debug(" starting at: %s\n", root->full_name);
>> +
>>         for_each_child_of_node(root, child) {
>>                 rc = of_platform_bus_create(child, matches, lookup, parent, true);
>>                 if (rc) {
>> @@ -471,6 +481,17 @@ int of_platform_default_populate(struct device_node *root,
>>  }
>>  EXPORT_SYMBOL_GPL(of_platform_default_populate);
>>
>> +static int __init of_platform_default_populate_init(void)
>> +{
>> +       if (of_have_populated_dt())
>> +               of_platform_default_populate(NULL, NULL, NULL);
>> +       else if (acpi_disabled)
> 
> This ACPI dependency needs to go. The error msg is somewhat pointless
> as if both DT and ACPI are not used, the boot will be horribly broken
> and I'm not sure that you would actually see the message given you
> have no information to setup a console.

Fair enough, will update and rebase patches after 4.7-rc1.

Thanks,
Kefeng

> 
> Rob
> 
> .
> 

  reply	other threads:[~2016-05-26  7:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 12:05 [PATCH v4 00/18] Cleanup for populate default bus Kefeng Wang
2016-05-12 12:05 ` [PATCH v4 01/18] of/platform: Add common method to " Kefeng Wang
2016-05-25 14:46   ` Rob Herring
2016-05-26  7:43     ` Kefeng Wang [this message]
2016-05-12 12:05 ` [PATCH v4 02/18] arc: Remove unnecessary of_platform_populate with default match table Kefeng Wang
2016-05-13  3:03   ` Vineet Gupta
2016-05-12 12:06 ` [PATCH v4 03/18] arm: " Kefeng Wang
2016-05-13  2:58   ` Viresh Kumar
2016-05-12 12:06 ` [PATCH v4 04/18] arm64: " Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 05/18] c6x: " Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 06/18] cris: " Kefeng Wang
2016-05-16  8:00   ` Jesper Nilsson
2016-05-12 12:06 ` [PATCH v4 07/18] metag: " Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 08/18] mips: " Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 09/18] nios2: " Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 10/18] sh: " Kefeng Wang
2016-05-12 18:38   ` Rich Felker
2016-05-13  1:44     ` Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 11/18] xtensa: " Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 12/18] arm: use of_platform_default_populate() to populate Kefeng Wang
2016-05-13  2:59   ` Viresh Kumar
2016-05-17  7:59   ` Sekhar Nori
2016-05-17  9:14   ` Nicolas Ferre
2016-05-12 12:06 ` [PATCH v4 13/18] mips: use of_platform_default_populate() to populate default bus Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 14/18] bus: imx-weim: " Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 15/18] bus: uniphier-system-bus: " Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 16/18] memory: omap-gpmc: " Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 17/18] of: unittest: " Kefeng Wang
2016-05-12 12:06 ` [PATCH v4 18/18] Revert "of/platform: export of_default_bus_match_table" Kefeng Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5746A904.6080003@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=frowand.list@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=guohanjun@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=olof@lixom.net \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox