[PATCH v2 06/19] of: of_path: always call of_partition_ensure_probed before resolving

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



of_find_path may be called on a partition, whose parent device is not
yet probed. state code solves that by calling of_partition_ensure_probed
before of_find_path_by_node, but really we should be doing that for all
calls to of_find_path. Do so.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
Reviewed-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
---
v1 -> v2:
  - note why we ignore the return code of of_partition_ensure_probed
    (Ulrich)
  - fix typo (Marco, Ulrich)
  - add Marco's Reviewed-by
---
 common/state/state.c | 10 ----------
 drivers/of/of_path.c | 10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/common/state/state.c b/common/state/state.c
index 85854f564d48..11cc86ff73be 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -618,16 +618,6 @@ struct state *state_new_from_node(struct device_node *node, bool readonly)
 	}
 
 #ifdef __BAREBOX__
-	/*
-	 * On EFI, where devices are not instantiated from device tree, the
-	 * state backend may point at a top-level fixed-partitions partition
-	 * subnode with a partuuid property, which will be looked up globally.
-	 *
-	 * In order to support this binding, we do not early exit when
-	 * of_partition_ensure_probed fails, but instead try the custom binding.
-	 */
-	(void)of_partition_ensure_probed(partition_node);
-
 	ret = of_find_path_by_node(partition_node, &state->backend_path, 0);
 #else
 	ret = of_get_devicepath(partition_node, &state->backend_path, &offset, &size);
diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index 1268cf36ee5b..d11cb2a524eb 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -43,6 +43,16 @@ static int __of_find_path(struct device_node *node, const char *part, char **out
 	struct cdev *cdev;
 	bool add_bb = false;
 
+	/*
+	 * On EFI, where devices are not instantiated from device tree, the
+	 * state backend may point at a top-level fixed-partitions partition
+	 * subnode with a partuuid property, which will be looked up globally.
+	 *
+	 * In order to support this binding, we do not early exit when
+	 * of_partition_ensure_probed fails, but instead try the custom binding.
+	 */
+	(void)of_partition_ensure_probed(node);
+
 	dev = of_find_device_by_node_path(node->full_name);
 	if (!dev) {
 		int ret;
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux