From: Ahmad Fatoum <a.fatoum@pengutronix.de> To: barebox@lists.infradead.org Cc: Ahmad Fatoum <a.fatoum@pengutronix.de> Subject: [PATCH 3/7] of: partition: implement of_partition_ensure_probed Date: Mon, 28 Jun 2021 08:45:13 +0200 Message-ID: <20210628064517.28636-4-a.fatoum@pengutronix.de> (raw) In-Reply-To: <20210628064517.28636-1-a.fatoum@pengutronix.de> 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> --- drivers/of/partition.c | 11 +++++++++++ include/of.h | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/of/partition.c b/drivers/of/partition.c index b6d0523fd960..10081363deee 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; diff --git a/include/of.h b/include/of.h index 677f48d0aba1..4042d8dee8d4 100644 --- a/include/of.h +++ b/include/of.h @@ -283,6 +283,7 @@ extern int of_device_ensure_probed(struct device_node *np); extern int of_device_ensure_probed_by_alias(const char *alias); extern int of_devices_ensure_probed_by_property(const char *property_name); extern int of_devices_ensure_probed_by_dev_id(const struct of_device_id *ids); +extern int of_partition_ensure_probed(struct device_node *np); struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node); int of_parse_partitions(struct cdev *cdev, struct device_node *node); @@ -398,6 +399,11 @@ of_devices_ensure_probed_by_dev_id(const struct of_device_id *ids) return 0; } +static inline int of_partition_ensure_probed(struct device_node *np) +{ + return 0; +} + static inline int of_bus_n_addr_cells(struct device_node *np) { return 0; -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-06-28 6:47 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-28 6:45 [PATCH 0/7] sandbox: turn into deep probe platform Ahmad Fatoum 2021-06-28 6:45 ` [PATCH 1/7] sandbox: power: set $global.system.reset=POR on poweroff Ahmad Fatoum 2021-06-28 6:45 ` [PATCH 2/7] sandbox: fix probe order dependency between watchdog and power Ahmad Fatoum 2021-06-28 6:45 ` Ahmad Fatoum [this message] 2021-06-28 6:45 ` [PATCH 4/7] state: support deep probe Ahmad Fatoum 2021-06-28 6:45 ` [PATCH 5/7] nvmem: " Ahmad Fatoum 2021-06-28 6:45 ` [PATCH 6/7] sandbox: turn into deep probe platform Ahmad Fatoum 2021-06-28 6:45 ` [PATCH 7/7] Revert "sandbox: hostfile: move initcall to earlier postcore level" Ahmad Fatoum 2021-07-18 5:14 ` [PATCH 0/7] sandbox: turn into deep probe platform Sascha Hauer
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=20210628064517.28636-4-a.fatoum@pengutronix.de \ --to=a.fatoum@pengutronix.de \ --cc=barebox@lists.infradead.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
mail archive of the barebox mailing list This inbox may be cloned and mirrored by anyone: git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \ barebox@lists.infradead.org barebox@lists.infradead.org public-inbox-index barebox Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git