From: Alexander Sverdlin <alexander.sverdlin-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
To: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Frank Rowand
<frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Pantelis Antoniou
<pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>,
Grant Likely
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH] of/platform: dynamic: Use of_platform_bus_create() to create devices
Date: Tue, 19 Sep 2017 17:13:27 +0200 [thread overview]
Message-ID: <43407912-3ecd-97c7-a90a-a9cd07a4b3ae@nokia.com> (raw)
In-Reply-To: <CAL_JsqJZ__mUwRT14BmNQKaa_mAPsJm0iWP8sb6Oqs+_-Gu5hw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hello Rob,
On 27/10/16 15:00, Rob Herring wrote:
> On Thu, Oct 20, 2016 at 6:02 AM, Alexander Sverdlin
> <alexander.sverdlin-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org> wrote:
>> of_platform_notify() requires parents to have OF_POPULATED_BUS to be set
>> (which is correct way to verify healthy platform bus), but uses
>> of_platform_device_create() to create devices, which never sets the above
>> flag. Therefore it's not possible to add platform buses via overlays.
> Can you create a unit test case that has the problem.
PING
The tests for the highlighted problem were presented here:
http://www.spinics.net/lists/devicetree/msg160016.html
>> Use of_platform_bus_create(), which is used in non-overlay case to populate
>> both buses and devices.
>> Signed-off-by: Alexander Sverdlin <alexander.sverdlin-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
>> Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>> Cc: Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Cc: Pantelis Antoniou <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
>> Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>>
>> ---
>> drivers/of/platform.c | 11 ++++++-----
>> 1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
>> index af98343..d2d6e74 100644
>> --- a/drivers/of/platform.c
>> +++ b/drivers/of/platform.c
>> @@ -521,6 +521,7 @@ static int of_platform_notify(struct notifier_block *nb,
>> struct of_reconfig_data *rd = arg;
>> struct platform_device *pdev_parent, *pdev;
>> bool children_left;
>> + int ret;
>>
>> switch (of_reconfig_get_state_change(action, rd)) {
>> case OF_RECONFIG_CHANGE_ADD:
>> @@ -534,15 +535,15 @@ static int of_platform_notify(struct notifier_block *nb,
>>
>> /* pdev_parent may be NULL when no bus platform device */
>> pdev_parent = of_find_device_by_node(rd->dn->parent);
>> - pdev = of_platform_device_create(rd->dn, NULL,
>> - pdev_parent ? &pdev_parent->dev : NULL);
>> + ret = of_platform_bus_create(rd->dn, of_default_bus_match_table,
>> + NULL, pdev_parent ?
>> + &pdev_parent->dev : NULL, true);
> I think this should be of_platform_default_populate() instead.
>
>> of_dev_put(pdev_parent);
>>
>> - if (pdev == NULL) {
>> + if (ret) {
>> pr_err("%s: failed to create for '%s'\n",
>> __func__, rd->dn->full_name);
>> - /* of_platform_device_create tosses the error code */
>> - return notifier_from_errno(-EINVAL);
>> + return notifier_from_errno(ret);
>> }
>> break;
--
Best regards,
Alexander Sverdlin.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-09-19 15:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-20 11:02 [PATCH] of/platform: dynamic: Use of_platform_bus_create() to create devices Alexander Sverdlin
[not found] ` <b317f693-98b5-ba1e-1184-83735a68db9b-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2016-10-27 13:00 ` Rob Herring
[not found] ` <CAL_JsqJZ__mUwRT14BmNQKaa_mAPsJm0iWP8sb6Oqs+_-Gu5hw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-20 17:38 ` Alexander Sverdlin
[not found] ` <3da6854d-8361-1724-2a8a-36f28449733e-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2017-01-21 19:51 ` Rob Herring
[not found] ` <CAL_JsqKb8KUgit-q_cOON8VgZBsrXEQd2EcC0iF=ou_271Vg_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-23 12:21 ` [PATCH] of/platform: Ignore disabled devices in of_platform_populate() Alexander Sverdlin
[not found] ` <20170123122151.21908-1-alexander.sverdlin-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2017-01-23 12:24 ` Alexander Sverdlin
2017-01-23 12:52 ` [PATCH v2] " Alexander Sverdlin
[not found] ` <20170123125204.22233-1-alexander.sverdlin-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2017-01-23 14:33 ` Alexander Sverdlin
[not found] ` <711e6067-ab41-8217-b947-2b4c356aaaba-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2017-01-23 15:09 ` Alexander Sverdlin
2017-09-19 15:23 ` Alexander Sverdlin
2017-01-23 15:07 ` [PATCH] of/platform: dynamic: Use of_platform_bus_create() to create devices Alexander Sverdlin
2017-01-20 20:57 ` [PATCH 0/2] Ensure that platform buses from overlays are functional Alexander Sverdlin
[not found] ` <20170120205745.11851-1-alexander.sverdlin-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2017-01-20 21:02 ` [PATCH 1/2] of/platform: dynamic: Use of_platform_bus_create() to create devices Alexander Sverdlin
[not found] ` <20170120210234.11924-1-alexander.sverdlin-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2017-01-20 21:02 ` [PATCH 2/2] of/unittest: Test platform bus added from overlay Alexander Sverdlin
2017-09-19 15:13 ` Alexander Sverdlin [this message]
[not found] ` <43407912-3ecd-97c7-a90a-a9cd07a4b3ae-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2017-09-19 16:27 ` [PATCH] of/platform: dynamic: Use of_platform_bus_create() to create devices Rob Herring
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=43407912-3ecd-97c7-a90a-a9cd07a4b3ae@nokia.com \
--to=alexander.sverdlin-xnzwkgviw5gavxtiumwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).