[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180511162028.20616-9-brgl@bgdev.pl>
Date: Fri, 11 May 2018 18:20:24 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Sekhar Nori <nsekhar@...com>, Kevin Hilman <khilman@...nel.org>,
David Lechner <david@...hnology.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mark Rutland <mark.rutland@....com>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Marc Zyngier <marc.zyngier@....com>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Peter Rosin <peda@...ntia.se>, Jiri Slaby <jslaby@...e.com>,
Thomas Gleixner <tglx@...utronix.de>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Magnus Damm <magnus.damm@...il.com>,
Johan Hovold <johan@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, linux-arch@...r.kernel.org,
Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: [PATCH 08/12] of/platform: provide a separate routine for device initialization
From: Bartosz Golaszewski <bgolaszewski@...libre.com>
The early platform device framework will need to initialize the
platform device objects without them being allocated in
of_device_alloc(). Provide a routine that allows it.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
---
drivers/of/platform.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 24791e558ec5..0e554fe1f325 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -132,6 +132,19 @@ int of_device_init_resources(struct platform_device *pdev,
return 0;
}
+static void of_device_init(struct platform_device *pdev, struct device_node *np,
+ const char *bus_id, struct device *parent)
+{
+ pdev->dev.of_node = of_node_get(np);
+ pdev->dev.fwnode = &np->fwnode;
+ pdev->dev.parent = parent ? : &platform_bus;
+
+ if (bus_id)
+ dev_set_name(&pdev->dev, "%s", bus_id);
+ else
+ of_device_make_bus_id(&pdev->dev);
+}
+
/**
* of_device_alloc - Allocate and initialize an of_device
* @np: device node to assign to device
@@ -155,14 +168,7 @@ struct platform_device *of_device_alloc(struct device_node *np,
return NULL;
}
- dev->dev.of_node = of_node_get(np);
- dev->dev.fwnode = &np->fwnode;
- dev->dev.parent = parent ? : &platform_bus;
-
- if (bus_id)
- dev_set_name(&dev->dev, "%s", bus_id);
- else
- of_device_make_bus_id(&dev->dev);
+ of_device_init(dev, np, bus_id, parent);
return dev;
}
--
2.17.0
Powered by blists - more mailing lists