diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-06-28 08:45:13 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-07-18 07:14:12 +0200 |
commit | 9c88d8beb30df68a4fc84710de62f07486df30b8 (patch) | |
tree | 685b780e130f4a5477b8c19cb113de48e3abb4cf /drivers | |
parent | 44a012366d01a4cbbe1628998a203724cbf57aee (diff) | |
download | barebox-9c88d8beb30df68a4fc84710de62f07486df30b8.tar.gz barebox-9c88d8beb30df68a4fc84710de62f07486df30b8.tar.xz |
of: partition: implement of_partition_ensure_probed
The device tree nodes for both barebox environment and state can have
phandles that reference partitions. Environment runs at late_initcall
level, so deep probe will have populated the device by the time the
probe is called. barebox-state however is probed at device_initcall
level and thus must take care itself to ensure the partition provider is
probed. Add a new of_partition_ensure_probed that does this. It can
handle both legacy and new style (fixed) partitions.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210628064517.28636-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/of/partition.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/of/partition.c b/drivers/of/partition.c index b6d0523fd9..10081363de 100644 --- a/drivers/of/partition.c +++ b/drivers/of/partition.c @@ -118,6 +118,17 @@ int of_parse_partitions(struct cdev *cdev, struct device_node *node) return 0; } +int of_partition_ensure_probed(struct device_node *np) +{ + np = of_get_parent(np); + + if (of_device_is_compatible(np, "fixed-partitions")) + np = of_get_parent(np); + + return np ? of_device_ensure_probed(np) : -EINVAL; +} +EXPORT_SYMBOL_GPL(of_partition_ensure_probed); + static void delete_subnodes(struct device_node *np) { struct device_node *part, *tmp; |