devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of/platform: dynamic: Use of_platform_bus_create() to create devices
@ 2016-10-20 11:02 Alexander Sverdlin
       [not found] ` <b317f693-98b5-ba1e-1184-83735a68db9b-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Alexander Sverdlin @ 2016-10-20 11:02 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Rob Herring, Frank Rowand, Pantelis Antoniou, Grant Likely

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.

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);
 		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;
 
--
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

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-09-19 16:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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       ` [PATCH] of/platform: dynamic: Use of_platform_bus_create() to create devices Alexander Sverdlin
     [not found]         ` <43407912-3ecd-97c7-a90a-a9cd07a4b3ae-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2017-09-19 16:27           ` Rob Herring

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).