devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] of: overlays: New target methods
@ 2016-05-09 18:05 Pantelis Antoniou
  2016-05-09 18:05 ` [PATCH 1/6] of: overlay: Implement indirect target support Pantelis Antoniou
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Pantelis Antoniou @ 2016-05-09 18:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, Matt Porter, Grant Likely, Koen Kooi,
	Guenter Roeck, Marek Vasut, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Pantelis Antoniou,
	Pantelis Antoniou

This patchset implement two new target methods.
A target-indirect method which allows selecting different
targets according to an argument using an extended API and
a target root method that fences the target only
to a specific given root.

Documentation and unit-tests are included.

Pantelis Antoniou (6):
  of: overlay: Implement indirect target support
  of: unittest: Add indirect overlay target test
  doc: dt: Document the indirect overlay method.
  of: overlay: Introduce target root capability.
  of: unittest: Unit-tests for target root overlays.
  doc: dt: Document the target root overlay method

 Documentation/devicetree/overlay-notes.txt  |  21 +++
 drivers/of/overlay.c                        | 219 +++++++++++++++++++---
 drivers/of/unittest-data/testcases.dts      |  14 ++
 drivers/of/unittest-data/tests-overlay.dtsi |  67 +++++++
 drivers/of/unittest.c                       | 272 ++++++++++++++++++++++++++++
 include/linux/of.h                          |  16 ++
 6 files changed, 582 insertions(+), 27 deletions(-)

-- 
1.7.12

--
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	[flat|nested] 10+ messages in thread

* [PATCH 1/6] of: overlay: Implement indirect target support
  2016-05-09 18:05 [PATCH 0/6] of: overlays: New target methods Pantelis Antoniou
@ 2016-05-09 18:05 ` Pantelis Antoniou
  2016-05-09 18:05 ` [PATCH 2/6] of: unittest: Add indirect overlay target test Pantelis Antoniou
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Pantelis Antoniou @ 2016-05-09 18:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, Matt Porter, Grant Likely, Koen Kooi,
	Guenter Roeck, Marek Vasut, devicetree, linux-kernel,
	Pantelis Antoniou, Pantelis Antoniou

Some applications require applying the same overlay to a different
target according to some external condition (for instance depending
on the slot a card has been inserted, the overlay target is different).

The indirect target use requires using the new
of_overlay_create_indirect() API which uses a text selector.

The format requires the use of a target-indirect node as follows:

	fragment@0 {
		target-indirect {
			foo { target = <&foo_target>; };
			bar { target = <&bar_target>; };
		};
	};

Calling of_overlay_create_indirect() with a "foo" argument selects
the foo_target and so on.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
---
 drivers/of/overlay.c | 126 +++++++++++++++++++++++++++++++++++++++++----------
 include/linux/of.h   |   8 ++++
 2 files changed, 110 insertions(+), 24 deletions(-)

diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index fdfc487..364b619 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -75,6 +75,7 @@ struct of_overlay {
 	const struct attribute_group **attr_groups;
 	struct of_changeset cset;
 	struct kobject kobj;
+	char *indirect_id;
 };
 
 /* master enable switch; once set to 0 can't be re-enabled */
@@ -220,14 +221,8 @@ static int of_overlay_apply(struct of_overlay *ov)
 	return 0;
 }
 
-/*
- * Find the target node using a number of different strategies
- * in order of preference
- *
- * "target" property containing the phandle of the target
- * "target-path" property containing the path of the target
- */
-static struct device_node *find_target_node(struct device_node *info_node)
+static struct device_node *find_target_node_direct(struct of_overlay *ov,
+		struct device_node *info_node)
 {
 	const char *path;
 	u32 val;
@@ -238,17 +233,66 @@ static struct device_node *find_target_node(struct device_node *info_node)
 	if (ret == 0)
 		return of_find_node_by_phandle(val);
 
-	/* now try to locate by path */
+	/* failed, try to locate by path */
 	ret = of_property_read_string(info_node, "target-path", &path);
 	if (ret == 0)
 		return of_find_node_by_path(path);
 
-	pr_err("%s: Failed to find target for node %p (%s)\n", __func__,
-		info_node, info_node->name);
-
 	return NULL;
 }
 
+/*
+ * Find the target node using a number of different strategies
+ * in order of preference. Respects the indirect id if available.
+ *
+ * "target" property containing the phandle of the target
+ * "target-path" property containing the path of the target
+ */
+static struct device_node *find_target_node(struct of_overlay *ov,
+		struct device_node *info_node)
+{
+	struct device_node *target;
+	struct device_node *target_indirect;
+	struct device_node *indirect;
+
+	/* try direct target */
+	target = find_target_node_direct(ov, info_node);
+	if (target)
+		return target;
+
+	/* try indirect if there */
+	if (!ov->indirect_id)
+		return NULL;
+
+	target_indirect = of_get_child_by_name(info_node, "target-indirect");
+	if (!target_indirect) {
+		pr_err("%s: Failed to find target-indirect node at %s\n",
+				__func__,
+				of_node_full_name(info_node));
+		return NULL;
+	}
+
+	indirect = of_get_child_by_name(target_indirect, ov->indirect_id);
+	of_node_put(target_indirect);
+	if (!indirect) {
+		pr_err("%s: Failed to find indirect child node \"%s\" at %s\n",
+				__func__, ov->indirect_id,
+				of_node_full_name(info_node));
+		return NULL;
+	}
+
+	target = find_target_node_direct(ov, indirect);
+
+	if (!target) {
+		pr_err("%s: Failed to find target for \"%s\" at %s\n",
+				__func__, ov->indirect_id,
+				of_node_full_name(indirect));
+	}
+	of_node_put(indirect);
+
+	return target;
+}
+
 /**
  * of_fill_overlay_info() - Fill an overlay info structure
  * @ov		Overlay to fill
@@ -270,7 +314,7 @@ static int of_fill_overlay_info(struct of_overlay *ov,
 	if (ovinfo->overlay == NULL)
 		goto err_fail;
 
-	ovinfo->target = find_target_node(info_node);
+	ovinfo->target = find_target_node(ov, info_node);
 	if (ovinfo->target == NULL)
 		goto err_fail;
 
@@ -418,6 +462,7 @@ void of_overlay_release(struct kobject *kobj)
 {
 	struct of_overlay *ov = kobj_to_overlay(kobj);
 
+	kfree(ov->indirect_id);
 	kfree(ov);
 }
 
@@ -473,17 +518,8 @@ static struct kobj_type of_overlay_ktype = {
 
 static struct kset *ov_kset;
 
-/**
- * of_overlay_create() - Create and apply an overlay
- * @tree:	Device node containing all the overlays
- *
- * Creates and applies an overlay while also keeping track
- * of the overlay in a list. This list can be used to prevent
- * illegal overlay removals.
- *
- * Returns the id of the created overlay, or a negative error number
- */
-int of_overlay_create(struct device_node *tree)
+static int __of_overlay_create(struct device_node *tree,
+		const char *indirect_id)
 {
 	struct of_overlay *ov;
 	int err, id;
@@ -498,6 +534,14 @@ int of_overlay_create(struct device_node *tree)
 		return -ENOMEM;
 	ov->id = -1;
 
+	if (indirect_id) {
+		ov->indirect_id = kstrdup(indirect_id, GFP_KERNEL);
+		if (!ov->indirect_id) {
+			err = -ENOMEM;
+			goto err_no_mem;
+		}
+	}
+
 	INIT_LIST_HEAD(&ov->node);
 
 	of_changeset_init(&ov->cset);
@@ -572,13 +616,47 @@ err_free_idr:
 	idr_remove(&ov_idr, ov->id);
 err_destroy_trans:
 	of_changeset_destroy(&ov->cset);
+err_no_mem:
+	kfree(ov->indirect_id);
 	kfree(ov);
 	mutex_unlock(&of_mutex);
 
 	return err;
 }
+
+/**
+ * of_overlay_create() - Create and apply an overlay
+ * @tree:	Device node containing all the overlays
+ *
+ * Creates and applies an overlay while also keeping track
+ * of the overlay in a list. This list can be used to prevent
+ * illegal overlay removals.
+ *
+ * Returns the id of the created overlay, or a negative error number
+ */
+int of_overlay_create(struct device_node *tree)
+{
+	return __of_overlay_create(tree, NULL);
+}
 EXPORT_SYMBOL_GPL(of_overlay_create);
 
+/**
+ * of_overlay_create_indirect() - Create and apply an overlay
+ * @tree:	Device node containing all the overlays
+ * @id:		Indirect property phandle
+ *
+ * Creates and applies an overlay while also keeping track
+ * of the overlay in a list. This list can be used to prevent
+ * illegal overlay removals.
+ *
+ * Returns the id of the created overlay, or a negative error number
+ */
+int of_overlay_create_indirect(struct device_node *tree, const char *id)
+{
+	return __of_overlay_create(tree, id);
+}
+EXPORT_SYMBOL_GPL(of_overlay_create_indirect);
+
 /* check whether the given node, lies under the given tree */
 static int overlay_subtree_check(struct device_node *tree,
 		struct device_node *dn)
diff --git a/include/linux/of.h b/include/linux/of.h
index f015911..4c220fb 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1226,6 +1226,8 @@ int of_overlay_create(struct device_node *tree);
 int of_overlay_destroy(int id);
 int of_overlay_destroy_all(void);
 
+int of_overlay_create_indirect(struct device_node *tree, const char *id);
+
 #else
 
 static inline int of_overlay_create(struct device_node *tree)
@@ -1243,6 +1245,12 @@ static inline int of_overlay_destroy_all(void)
 	return -ENOTSUPP;
 }
 
+static inline int of_overlay_create_indirect(struct device_node *tree,
+		const char *id)
+{
+	return -ENOTSUPP;
+}
+
 #endif
 
 #endif /* _LINUX_OF_H */
-- 
1.7.12

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

* [PATCH 2/6] of: unittest: Add indirect overlay target test
  2016-05-09 18:05 [PATCH 0/6] of: overlays: New target methods Pantelis Antoniou
  2016-05-09 18:05 ` [PATCH 1/6] of: overlay: Implement indirect target support Pantelis Antoniou
@ 2016-05-09 18:05 ` Pantelis Antoniou
  2016-05-09 18:05 ` [PATCH 3/6] doc: dt: Document the indirect overlay method Pantelis Antoniou
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Pantelis Antoniou @ 2016-05-09 18:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, Matt Porter, Grant Likely, Koen Kooi,
	Guenter Roeck, Marek Vasut, devicetree, linux-kernel,
	Pantelis Antoniou, Pantelis Antoniou

Add a unittest for the indirect overlay target case.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
---
 drivers/of/unittest-data/testcases.dts      |  9 +++++
 drivers/of/unittest-data/tests-overlay.dtsi | 19 ++++++++++
 drivers/of/unittest.c                       | 59 +++++++++++++++++++++++++++++
 3 files changed, 87 insertions(+)

diff --git a/drivers/of/unittest-data/testcases.dts b/drivers/of/unittest-data/testcases.dts
index 12f7c3d..ec17ab7 100644
--- a/drivers/of/unittest-data/testcases.dts
+++ b/drivers/of/unittest-data/testcases.dts
@@ -75,5 +75,14 @@
 				target = <0x00000000>;
 			};
 		};
+		overlay16 {
+			fragment@0 {
+				target-indirect {
+					unittest16 {
+						target = <0x00000000>;
+					};
+				};
+			};
+		};
 	};
 }; };
diff --git a/drivers/of/unittest-data/tests-overlay.dtsi b/drivers/of/unittest-data/tests-overlay.dtsi
index 02ba56c..881d863 100644
--- a/drivers/of/unittest-data/tests-overlay.dtsi
+++ b/drivers/of/unittest-data/tests-overlay.dtsi
@@ -110,6 +110,12 @@
 						};
 					};
 				};
+
+				unittest16: test-unittest16 {
+					compatible = "unittest";
+					status = "disabled";
+					reg = <16>;
+				};
 			};
 		};
 
@@ -325,5 +331,18 @@
 			};
 		};
 
+		/* test enable using indirect functionality */
+		overlay16 {
+			fragment@0 {
+				target-indirect {
+					unittest16 {
+						target = <&unittest16>;
+					};
+				};
+				__overlay__ {
+					status = "okay";
+				};
+			};
+		};
 	};
 };
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index ff6939b..dd289c7 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1921,6 +1921,63 @@ static inline void of_unittest_overlay_i2c_15(void) { }
 
 #endif
 
+static void of_unittest_overlay_16(void)
+{
+	int ret;
+	int overlay_nr = 16;
+	int unittest_nr = 16;
+	enum overlay_type ovtype = PDEV_OVERLAY;
+	int before = 0;
+	int after = 1;
+	struct device_node *np = NULL;
+	int id = -1;
+
+	/* unittest device must not be in before state */
+	if (of_unittest_device_exists(unittest_nr, ovtype) != before) {
+		unittest(0, "overlay @\"%s\" with device @\"%s\" %s\n",
+				overlay_path(overlay_nr),
+				unittest_path(unittest_nr, ovtype),
+				!before ? "enabled" : "disabled");
+		return;
+	}
+
+	np = of_find_node_by_path(overlay_path(overlay_nr));
+	if (np == NULL) {
+		unittest(0, "could not find overlay node @\"%s\"\n",
+				overlay_path(overlay_nr));
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = of_overlay_create_indirect(np, "unittest16");
+	if (ret < 0) {
+		unittest(0, "could not create overlay from \"%s\"\n",
+				overlay_path(overlay_nr));
+		goto out;
+	}
+	id = ret;
+	of_unittest_track_overlay(id);
+
+	ret = 0;
+
+out:
+	of_node_put(np);
+
+	if (ret)
+		return;
+
+	/* unittest device must be to set to after state */
+	if (of_unittest_device_exists(unittest_nr, ovtype) != after) {
+		unittest(0, "overlay @\"%s\" failed to create @\"%s\" %s\n",
+				overlay_path(overlay_nr),
+				unittest_path(unittest_nr, ovtype),
+				!after ? "enabled" : "disabled");
+		return;
+	}
+
+	unittest(1, "overlay test %d passed\n", 16);
+}
+
 static void __init of_unittest_overlay(void)
 {
 	struct device_node *bus_np = NULL;
@@ -1972,6 +2029,8 @@ static void __init of_unittest_overlay(void)
 	of_unittest_overlay_10();
 	of_unittest_overlay_11();
 
+	of_unittest_overlay_16();
+
 #if IS_BUILTIN(CONFIG_I2C)
 	if (unittest(of_unittest_overlay_i2c_init() == 0, "i2c init failed\n"))
 		goto out;
-- 
1.7.12

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

* [PATCH 3/6] doc: dt: Document the indirect overlay method.
  2016-05-09 18:05 [PATCH 0/6] of: overlays: New target methods Pantelis Antoniou
  2016-05-09 18:05 ` [PATCH 1/6] of: overlay: Implement indirect target support Pantelis Antoniou
  2016-05-09 18:05 ` [PATCH 2/6] of: unittest: Add indirect overlay target test Pantelis Antoniou
@ 2016-05-09 18:05 ` Pantelis Antoniou
       [not found]   ` <1462817147-7620-4-git-send-email-pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
  2016-05-09 18:05 ` [PATCH 4/6] of: overlay: Introduce target root capability Pantelis Antoniou
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Pantelis Antoniou @ 2016-05-09 18:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, Matt Porter, Grant Likely, Koen Kooi,
	Guenter Roeck, Marek Vasut, devicetree, linux-kernel,
	Pantelis Antoniou, Pantelis Antoniou

Add a description of the indirect overlay method to the overlay
documention file.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
---
 Documentation/devicetree/overlay-notes.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Documentation/devicetree/overlay-notes.txt b/Documentation/devicetree/overlay-notes.txt
index d418a6c..dd595e6 100644
--- a/Documentation/devicetree/overlay-notes.txt
+++ b/Documentation/devicetree/overlay-notes.txt
@@ -100,6 +100,10 @@ Finally, if you need to remove all overlays in one-go, just call
 of_overlay_destroy_all() which will remove every single one in the correct
 order.
 
+If your board has multiple slots/places where a single overlay can work
+and each slot is defined by a node, you can use the of_overlay_create_indirect()
+method to select the target.
+
 Overlay DTS Format
 ------------------
 
@@ -113,6 +117,11 @@ The DTS of an overlay should have the following format:
 		target=<phandle>;	/* phandle target of the overlay */
 	or
 		target-path="/path";	/* target path of the overlay */
+	or
+		target-indirect {	/* indirect target selector */
+			foo { target|target-path ... };
+			bar { .... };
+		};
 
 		__overlay__ {
 			property-a;	/* add property-a to the target */
@@ -131,3 +140,7 @@ Using the non-phandle based target method allows one to use a base DT which does
 not contain a __symbols__ node, i.e. it was not compiled with the -@ option.
 The __symbols__ node is only required for the target=<phandle> method, since it
 contains the information required to map from a phandle to a tree location.
+
+The indirect target requires the use of a selector target on the call to
+of_overlay_create_indirect(). I.e. passing the "foo" id will select the target
+in the foo node, "bar" in bar node, etc.
-- 
1.7.12

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

* [PATCH 4/6] of: overlay: Introduce target root capability.
  2016-05-09 18:05 [PATCH 0/6] of: overlays: New target methods Pantelis Antoniou
                   ` (2 preceding siblings ...)
  2016-05-09 18:05 ` [PATCH 3/6] doc: dt: Document the indirect overlay method Pantelis Antoniou
@ 2016-05-09 18:05 ` Pantelis Antoniou
  2016-05-09 18:05 ` [PATCH 5/6] of: unittest: Unit-tests for target root overlays Pantelis Antoniou
  2016-05-09 18:05 ` [PATCH 6/6] doc: dt: Document the target root overlay method Pantelis Antoniou
  5 siblings, 0 replies; 10+ messages in thread
From: Pantelis Antoniou @ 2016-05-09 18:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, Matt Porter, Grant Likely, Koen Kooi,
	Guenter Roeck, Marek Vasut, devicetree, linux-kernel,
	Pantelis Antoniou, Pantelis Antoniou

The target facility of an overlay allows the target to be any point
in the live kernel tree, since it usually that's required when
creating overlays for internal SoC devices. The target ends up
to be a single node in the tree.

However when we're dealing with probeable busses this is a problem
since the target node differs according to the bus the plugged
device lies.

Using an overlay creating method using a target root node allows
us to use a single overlay for those cases.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
---
 drivers/of/overlay.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++----
 include/linux/of.h   |   8 ++++
 2 files changed, 102 insertions(+), 7 deletions(-)

diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 364b619..a274d65 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -76,6 +76,7 @@ struct of_overlay {
 	struct of_changeset cset;
 	struct kobject kobj;
 	char *indirect_id;
+	struct device_node *target_root;
 };
 
 /* master enable switch; once set to 0 can't be re-enabled */
@@ -224,20 +225,83 @@ static int of_overlay_apply(struct of_overlay *ov)
 static struct device_node *find_target_node_direct(struct of_overlay *ov,
 		struct device_node *info_node)
 {
+	struct device_node *target = NULL, *np;
 	const char *path;
+	char *newpath;
 	u32 val;
 	int ret;
 
 	/* first try to go by using the target as a phandle */
 	ret = of_property_read_u32(info_node, "target", &val);
-	if (ret == 0)
-		return of_find_node_by_phandle(val);
+	if (ret == 0) {
+		target = of_find_node_by_phandle(val);
+		if (!target) {
+			pr_err("%s: Could not find target phandle 0x%x\n",
+					__func__, val);
+			return NULL;
+		}
+		goto check_root;
+	}
 
 	/* failed, try to locate by path */
 	ret = of_property_read_string(info_node, "target-path", &path);
-	if (ret == 0)
-		return of_find_node_by_path(path);
+	if (ret == 0) {
+
+		if (!ov->target_root) {
+			target = of_find_node_by_path(path);
+			if (!target)
+				pr_err("%s: Could not find target path \"%s\"\n",
+						__func__, path);
+			return target;
+		}
+
+		/* remove preceding '/' from path; relative path */
+		if (*path == '/') {
+			while (*path == '/')
+				path++;
+
+			newpath = kasprintf(GFP_KERNEL, "%s%s%s",
+					of_node_full_name(ov->target_root),
+					*path ? "/" : "", path);
+			if (!newpath) {
+				pr_err("%s: Could not allocate \"%s%s%s\"\n",
+					__func__,
+					of_node_full_name(ov->target_root),
+					*path ? "/" : "", path);
+				return NULL;
+			}
+			target = of_find_node_by_path(newpath);
+			kfree(newpath);
+
+			return target;
+
+		}
+		/* target is an alias, need to check */
+		target = of_find_node_by_path(path);
+		if (!target) {
+			pr_err("%s: Could not find alias \"%s\"\n",
+					__func__, path);
+			return NULL;
+		}
+		goto check_root;
+	}
+
+	return NULL;
 
+check_root:
+	if (!ov->target_root)
+		return target;
+
+	/* got a target, but we have to check it's under target root */
+	for (np = target; np; np = np->parent) {
+		if (np == ov->target_root)
+			return target;
+	}
+	pr_err("%s: target \"%s\" not under target_root \"%s\"\n",
+			__func__, of_node_full_name(target),
+			of_node_full_name(ov->target_root));
+	/* target is not under target_root */
+	of_node_put(target);
 	return NULL;
 }
 
@@ -462,6 +526,7 @@ void of_overlay_release(struct kobject *kobj)
 {
 	struct of_overlay *ov = kobj_to_overlay(kobj);
 
+	of_node_put(ov->target_root);
 	kfree(ov->indirect_id);
 	kfree(ov);
 }
@@ -519,7 +584,7 @@ static struct kobj_type of_overlay_ktype = {
 static struct kset *ov_kset;
 
 static int __of_overlay_create(struct device_node *tree,
-		const char *indirect_id)
+		const char *indirect_id, struct device_node *target_root)
 {
 	struct of_overlay *ov;
 	int err, id;
@@ -541,6 +606,7 @@ static int __of_overlay_create(struct device_node *tree,
 			goto err_no_mem;
 		}
 	}
+	ov->target_root = of_node_get(target_root);
 
 	INIT_LIST_HEAD(&ov->node);
 
@@ -617,6 +683,7 @@ err_free_idr:
 err_destroy_trans:
 	of_changeset_destroy(&ov->cset);
 err_no_mem:
+	of_node_put(ov->target_root);
 	kfree(ov->indirect_id);
 	kfree(ov);
 	mutex_unlock(&of_mutex);
@@ -636,7 +703,7 @@ err_no_mem:
  */
 int of_overlay_create(struct device_node *tree)
 {
-	return __of_overlay_create(tree, NULL);
+	return __of_overlay_create(tree, NULL, NULL);
 }
 EXPORT_SYMBOL_GPL(of_overlay_create);
 
@@ -653,10 +720,30 @@ EXPORT_SYMBOL_GPL(of_overlay_create);
  */
 int of_overlay_create_indirect(struct device_node *tree, const char *id)
 {
-	return __of_overlay_create(tree, id);
+	return __of_overlay_create(tree, id, NULL);
 }
 EXPORT_SYMBOL_GPL(of_overlay_create_indirect);
 
+/**
+ * of_overlay_create_target_root() - Create and apply an overlay
+ *			under which will be limited to target_root
+ * @tree:		Device node containing all the overlays
+ * @target_root:	Target root for the overlay.
+ *
+ * Creates and applies an overlay while also keeping track
+ * of the overlay in a list. This list can be used to prevent
+ * illegal overlay removals. The overlay is only allowed to
+ * target nodes under the target_root node.
+ *
+ * Returns the id of the created overlay, or an negative error number
+ */
+int of_overlay_create_target_root(struct device_node *tree,
+		struct device_node *target_root)
+{
+	return __of_overlay_create(tree, NULL, target_root);
+}
+EXPORT_SYMBOL_GPL(of_overlay_create_target_root);
+
 /* check whether the given node, lies under the given tree */
 static int overlay_subtree_check(struct device_node *tree,
 		struct device_node *dn)
diff --git a/include/linux/of.h b/include/linux/of.h
index 4c220fb..582bc45 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1227,6 +1227,8 @@ int of_overlay_destroy(int id);
 int of_overlay_destroy_all(void);
 
 int of_overlay_create_indirect(struct device_node *tree, const char *id);
+int of_overlay_create_target_root(struct device_node *tree,
+		struct device_node *target_root);
 
 #else
 
@@ -1251,6 +1253,12 @@ static inline int of_overlay_create_indirect(struct device_node *tree,
 	return -ENOTSUPP;
 }
 
+static inline int of_overlay_create_target_root(struct device_node *tree,
+		struct device_node *target_root)
+{
+	return -ENOTSUPP;
+}
+
 #endif
 
 #endif /* _LINUX_OF_H */
-- 
1.7.12

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

* [PATCH 5/6] of: unittest: Unit-tests for target root overlays.
  2016-05-09 18:05 [PATCH 0/6] of: overlays: New target methods Pantelis Antoniou
                   ` (3 preceding siblings ...)
  2016-05-09 18:05 ` [PATCH 4/6] of: overlay: Introduce target root capability Pantelis Antoniou
@ 2016-05-09 18:05 ` Pantelis Antoniou
  2016-05-09 18:05 ` [PATCH 6/6] doc: dt: Document the target root overlay method Pantelis Antoniou
  5 siblings, 0 replies; 10+ messages in thread
From: Pantelis Antoniou @ 2016-05-09 18:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, Matt Porter, Grant Likely, Koen Kooi,
	Guenter Roeck, Marek Vasut, devicetree, linux-kernel,
	Pantelis Antoniou, Pantelis Antoniou

Add unittests for target-root based overlays.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
---
 drivers/of/unittest-data/testcases.dts      |   5 +
 drivers/of/unittest-data/tests-overlay.dtsi |  48 +++++++
 drivers/of/unittest.c                       | 213 ++++++++++++++++++++++++++++
 3 files changed, 266 insertions(+)

diff --git a/drivers/of/unittest-data/testcases.dts b/drivers/of/unittest-data/testcases.dts
index ec17ab7..8052b96 100644
--- a/drivers/of/unittest-data/testcases.dts
+++ b/drivers/of/unittest-data/testcases.dts
@@ -84,5 +84,10 @@
 				};
 			};
 		};
+		overlay18 {
+			fragment@0 {
+				target = <0x00000000>;
+			};
+		};
 	};
 }; };
diff --git a/drivers/of/unittest-data/tests-overlay.dtsi b/drivers/of/unittest-data/tests-overlay.dtsi
index 881d863..e10ff5a 100644
--- a/drivers/of/unittest-data/tests-overlay.dtsi
+++ b/drivers/of/unittest-data/tests-overlay.dtsi
@@ -116,6 +116,24 @@
 					status = "disabled";
 					reg = <16>;
 				};
+
+				unittest17: test-unittest17 {
+					compatible = "unittest";
+					status = "disabled";
+					reg = <17>;
+				};
+
+				unittest18: test-unittest18 {
+					compatible = "unittest";
+					status = "disabled";
+					reg = <18>;
+				};
+
+				unittest19: test-unittest19 {
+					compatible = "unittest";
+					status = "disabled";
+					reg = <19>;
+				};
 			};
 		};
 
@@ -344,5 +362,35 @@
 				};
 			};
 		};
+
+		/* test enable using target root (relative path) */
+		overlay17 {
+			fragment@0 {
+				target-path = "/";
+				__overlay__ {
+					status = "okay";
+				};
+			};
+		};
+
+		/* test enable using target phandle */
+		overlay18 {
+			fragment@0 {
+				target = <&unittest18>;
+				__overlay__ {
+					status = "okay";
+				};
+			};
+		};
+
+		/* test trying to enable out of root (should fail) */
+		overlay19 {
+			fragment@0 {
+				target = <&unittest19>;
+				__overlay__ {
+					status = "okay";
+				};
+			};
+		};
 	};
 };
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index dd289c7..e5a5ec0 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1978,6 +1978,215 @@ out:
 	unittest(1, "overlay test %d passed\n", 16);
 }
 
+static void of_unittest_overlay_17(void)
+{
+	int ret;
+	int overlay_nr = 17;
+	int unittest_nr = 17;
+	enum overlay_type ovtype = PDEV_OVERLAY;
+	int before = 0;
+	int after = 1;
+	const char *root_path;
+	struct device_node *np = NULL, *target_root = NULL;
+	int id = -1;
+
+	/* unittest device must not be in before state */
+	if (of_unittest_device_exists(unittest_nr, ovtype) != before) {
+		unittest(0, "overlay @\"%s\" with device @\"%s\" %s\n",
+				overlay_path(overlay_nr),
+				unittest_path(unittest_nr, ovtype),
+				!before ? "enabled" : "disabled");
+		return;
+	}
+
+	np = of_find_node_by_path(overlay_path(overlay_nr));
+	if (np == NULL) {
+		unittest(0, "could not find overlay node @\"%s\"\n",
+				overlay_path(overlay_nr));
+		ret = -EINVAL;
+		goto out;
+	}
+
+	root_path = "/testcase-data/overlay-node/test-bus/test-unittest17";
+	target_root = of_find_node_by_path(root_path);
+	if (!target_root) {
+		unittest(0, "could not find target_root node @\"%s\"\n",
+				root_path);
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = of_overlay_create_target_root(np, target_root);
+	of_node_put(target_root);
+
+	if (ret < 0) {
+		unittest(0, "could not create overlay from \"%s\"\n",
+				overlay_path(overlay_nr));
+		goto out;
+	}
+	id = ret;
+	of_unittest_track_overlay(id);
+
+	ret = 0;
+
+out:
+	of_node_put(np);
+
+	if (ret)
+		return;
+
+	/* unittest device must be to set to after state */
+	if (of_unittest_device_exists(unittest_nr, ovtype) != after) {
+		unittest(0, "overlay @\"%s\" failed to create @\"%s\" %s\n",
+				overlay_path(overlay_nr),
+				unittest_path(unittest_nr, ovtype),
+				!after ? "enabled" : "disabled");
+		return;
+	}
+
+	unittest(1, "overlay test %d passed\n", 17);
+}
+
+static void of_unittest_overlay_18(void)
+{
+	int ret;
+	int overlay_nr = 18;
+	int unittest_nr = 18;
+	enum overlay_type ovtype = PDEV_OVERLAY;
+	int before = 0;
+	int after = 1;
+	const char *root_path;
+	struct device_node *np = NULL, *target_root = NULL;
+	int id = -1;
+
+	/* unittest device must not be in before state */
+	if (of_unittest_device_exists(unittest_nr, ovtype) != before) {
+		unittest(0, "overlay @\"%s\" with device @\"%s\" %s\n",
+				overlay_path(overlay_nr),
+				unittest_path(unittest_nr, ovtype),
+				!before ? "enabled" : "disabled");
+		return;
+	}
+
+	np = of_find_node_by_path(overlay_path(overlay_nr));
+	if (np == NULL) {
+		unittest(0, "could not find overlay node @\"%s\"\n",
+				overlay_path(overlay_nr));
+		ret = -EINVAL;
+		goto out;
+	}
+
+	root_path = "/testcase-data/overlay-node/test-bus/test-unittest18";
+	target_root = of_find_node_by_path(root_path);
+	if (!target_root) {
+		unittest(0, "could not find target_root node @\"%s\"\n",
+				root_path);
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = of_overlay_create_target_root(np, target_root);
+	of_node_put(target_root);
+
+	if (ret < 0) {
+		unittest(0, "could not create overlay from \"%s\"\n",
+				overlay_path(overlay_nr));
+		goto out;
+	}
+	id = ret;
+	of_unittest_track_overlay(id);
+
+	ret = 0;
+
+out:
+	of_node_put(np);
+
+	if (ret)
+		return;
+
+	/* unittest device must be to set to after state */
+	if (of_unittest_device_exists(unittest_nr, ovtype) != after) {
+		unittest(0, "overlay @\"%s\" failed to create @\"%s\" %s\n",
+				overlay_path(overlay_nr),
+				unittest_path(unittest_nr, ovtype),
+				!after ? "enabled" : "disabled");
+		return;
+	}
+
+	unittest(1, "overlay test %d passed\n", 18);
+}
+
+static void of_unittest_overlay_19(void)
+{
+	int ret;
+	int overlay_nr = 19;
+	int unittest_nr = 19;
+	enum overlay_type ovtype = PDEV_OVERLAY;
+	int before = 0;
+	int after = 0;
+	const char *root_path;
+	struct device_node *np = NULL, *target_root = NULL;
+	int id = -1;
+
+	/* unittest device must not be in before state */
+	if (of_unittest_device_exists(unittest_nr, ovtype) != before) {
+		unittest(0, "overlay @\"%s\" with device @\"%s\" %s\n",
+				overlay_path(overlay_nr),
+				unittest_path(unittest_nr, ovtype),
+				!before ? "enabled" : "disabled");
+		return;
+	}
+
+	np = of_find_node_by_path(overlay_path(overlay_nr));
+	if (np == NULL) {
+		unittest(0, "could not find overlay node @\"%s\"\n",
+				overlay_path(overlay_nr));
+		ret = -EINVAL;
+		goto out;
+	}
+
+	root_path = "/testcase-data/overlay-node/test-bus/test-unittest19";
+	target_root = of_find_node_by_path(root_path);
+	if (!target_root) {
+		unittest(0, "could not find target_root node @\"%s\"\n",
+				root_path);
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = of_overlay_create_target_root(np, target_root);
+	of_node_put(target_root);
+
+	if (ret >= 0) {
+		unittest(0, "created overlay from \"%s\" while we shouldn't\n",
+				overlay_path(overlay_nr));
+		id = ret;
+		of_unittest_track_overlay(id);
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = 0;
+
+out:
+	of_node_put(np);
+
+	if (ret)
+		return;
+
+	/* unittest device must be to set to after state */
+	if (of_unittest_device_exists(unittest_nr, ovtype) != after) {
+		unittest(0, "overlay @\"%s\" failed to create @\"%s\" %s\n",
+				overlay_path(overlay_nr),
+				unittest_path(unittest_nr, ovtype),
+				!after ? "enabled" : "disabled");
+		return;
+	}
+
+	unittest(1, "overlay test %d passed\n", 16);
+}
+
+
 static void __init of_unittest_overlay(void)
 {
 	struct device_node *bus_np = NULL;
@@ -2031,6 +2240,10 @@ static void __init of_unittest_overlay(void)
 
 	of_unittest_overlay_16();
 
+	of_unittest_overlay_17();
+	of_unittest_overlay_18();
+	of_unittest_overlay_19();
+
 #if IS_BUILTIN(CONFIG_I2C)
 	if (unittest(of_unittest_overlay_i2c_init() == 0, "i2c init failed\n"))
 		goto out;
-- 
1.7.12

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

* [PATCH 6/6] doc: dt: Document the target root overlay method
  2016-05-09 18:05 [PATCH 0/6] of: overlays: New target methods Pantelis Antoniou
                   ` (4 preceding siblings ...)
  2016-05-09 18:05 ` [PATCH 5/6] of: unittest: Unit-tests for target root overlays Pantelis Antoniou
@ 2016-05-09 18:05 ` Pantelis Antoniou
  5 siblings, 0 replies; 10+ messages in thread
From: Pantelis Antoniou @ 2016-05-09 18:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, Matt Porter, Grant Likely, Koen Kooi,
	Guenter Roeck, Marek Vasut, devicetree, linux-kernel,
	Pantelis Antoniou, Pantelis Antoniou

Add a description of the target root overlay method to the overlay
documention file.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
---
 Documentation/devicetree/overlay-notes.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/overlay-notes.txt b/Documentation/devicetree/overlay-notes.txt
index dd595e6..00ede57 100644
--- a/Documentation/devicetree/overlay-notes.txt
+++ b/Documentation/devicetree/overlay-notes.txt
@@ -104,6 +104,10 @@ If your board has multiple slots/places where a single overlay can work
 and each slot is defined by a node, you can use the of_overlay_create_indirect()
 method to select the target.
 
+For overlays on probeable busses, use the of_overlay_create_target_root() method
+in which you supply a device node as a target root, and which all target
+references in the overlay are performed relative to that node.
+
 Overlay DTS Format
 ------------------
 
@@ -144,3 +148,7 @@ contains the information required to map from a phandle to a tree location.
 The indirect target requires the use of a selector target on the call to
 of_overlay_create_indirect(). I.e. passing the "foo" id will select the target
 in the foo node, "bar" in bar node, etc.
+
+Note that when using the target root create method all target references must
+lie under the target root node. I.e. the overlay is not allowed to 'break' out
+of the root.
-- 
1.7.12

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

* Re: [PATCH 3/6] doc: dt: Document the indirect overlay method.
       [not found]   ` <1462817147-7620-4-git-send-email-pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
@ 2016-05-09 21:59     ` Rob Herring
  2016-05-10 13:59       ` Pantelis Antoniou
  0 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2016-05-09 21:59 UTC (permalink / raw)
  To: Pantelis Antoniou
  Cc: Frank Rowand, Matt Porter, Grant Likely, Koen Kooi,
	Guenter Roeck, Marek Vasut, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Pantelis Antoniou

On Mon, May 9, 2016 at 1:05 PM, Pantelis Antoniou
<pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> wrote:
> Add a description of the indirect overlay method to the overlay
> documention file.

Why? Please write some decent commit messages.

> Signed-off-by: Pantelis Antoniou <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
> ---
>  Documentation/devicetree/overlay-notes.txt | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/Documentation/devicetree/overlay-notes.txt b/Documentation/devicetree/overlay-notes.txt
> index d418a6c..dd595e6 100644
> --- a/Documentation/devicetree/overlay-notes.txt
> +++ b/Documentation/devicetree/overlay-notes.txt
> @@ -100,6 +100,10 @@ Finally, if you need to remove all overlays in one-go, just call
>  of_overlay_destroy_all() which will remove every single one in the correct
>  order.
>
> +If your board has multiple slots/places where a single overlay can work
> +and each slot is defined by a node, you can use the of_overlay_create_indirect()
> +method to select the target.
> +
>  Overlay DTS Format
>  ------------------
>
> @@ -113,6 +117,11 @@ The DTS of an overlay should have the following format:
>                 target=<phandle>;       /* phandle target of the overlay */
>         or
>                 target-path="/path";    /* target path of the overlay */

Why not just let these take multiple values and the user just selects index?

> +       or
> +               target-indirect {       /* indirect target selector */
> +                       foo { target|target-path ... };
> +                       bar { .... };
> +               };
>
>                 __overlay__ {
>                         property-a;     /* add property-a to the target */
> @@ -131,3 +140,7 @@ Using the non-phandle based target method allows one to use a base DT which does
>  not contain a __symbols__ node, i.e. it was not compiled with the -@ option.
>  The __symbols__ node is only required for the target=<phandle> method, since it
>  contains the information required to map from a phandle to a tree location.
> +
> +The indirect target requires the use of a selector target on the call to
> +of_overlay_create_indirect(). I.e. passing the "foo" id will select the target
> +in the foo node, "bar" in bar node, etc.
> --
> 1.7.12
>
--
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	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/6] doc: dt: Document the indirect overlay method.
  2016-05-09 21:59     ` Rob Herring
@ 2016-05-10 13:59       ` Pantelis Antoniou
       [not found]         ` <2A7DBC29-2A70-4076-8229-E2F517BFDE10-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Pantelis Antoniou @ 2016-05-10 13:59 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, Matt Porter, Grant Likely, Koen Kooi,
	Guenter Roeck, Marek Vasut, devicetree, linux-kernel

Hi Rob,

> On May 10, 2016, at 00:59 , Rob Herring <robherring2@gmail.com> wrote:
> 
> On Mon, May 9, 2016 at 1:05 PM, Pantelis Antoniou
> <pantelis.antoniou@konsulko.com> wrote:
>> Add a description of the indirect overlay method to the overlay
>> documention file.
> 
> Why? Please write some decent commit messages.
> 
>> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
>> ---
>> Documentation/devicetree/overlay-notes.txt | 13 +++++++++++++
>> 1 file changed, 13 insertions(+)
>> 
>> diff --git a/Documentation/devicetree/overlay-notes.txt b/Documentation/devicetree/overlay-notes.txt
>> index d418a6c..dd595e6 100644
>> --- a/Documentation/devicetree/overlay-notes.txt
>> +++ b/Documentation/devicetree/overlay-notes.txt
>> @@ -100,6 +100,10 @@ Finally, if you need to remove all overlays in one-go, just call
>> of_overlay_destroy_all() which will remove every single one in the correct
>> order.
>> 
>> +If your board has multiple slots/places where a single overlay can work
>> +and each slot is defined by a node, you can use the of_overlay_create_indirect()
>> +method to select the target.
>> +
>> Overlay DTS Format
>> ------------------
>> 
>> @@ -113,6 +117,11 @@ The DTS of an overlay should have the following format:
>>                target=<phandle>;       /* phandle target of the overlay */
>>        or
>>                target-path="/path";    /* target path of the overlay */
> 
> Why not just let these take multiple values and the user just selects index?
> 

Implementation details. Usually there’s a descriptive label used for each
different target point. It could be a slot# or it could be a label…

A string selector maps better IMO.


>> +       or
>> +               target-indirect {       /* indirect target selector */
>> +                       foo { target|target-path ... };
>> +                       bar { .... };
>> +               };
>> 
>>                __overlay__ {
>>                        property-a;     /* add property-a to the target */
>> @@ -131,3 +140,7 @@ Using the non-phandle based target method allows one to use a base DT which does
>> not contain a __symbols__ node, i.e. it was not compiled with the -@ option.
>> The __symbols__ node is only required for the target=<phandle> method, since it
>> contains the information required to map from a phandle to a tree location.
>> +
>> +The indirect target requires the use of a selector target on the call to
>> +of_overlay_create_indirect(). I.e. passing the "foo" id will select the target
>> +in the foo node, "bar" in bar node, etc.
>> --
>> 1.7.12
>> 

Regards

— Pantelis

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

* Re: [PATCH 3/6] doc: dt: Document the indirect overlay method.
       [not found]         ` <2A7DBC29-2A70-4076-8229-E2F517BFDE10-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
@ 2016-05-10 14:36           ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2016-05-10 14:36 UTC (permalink / raw)
  To: Pantelis Antoniou
  Cc: Frank Rowand, Matt Porter, Grant Likely, Koen Kooi,
	Guenter Roeck, Marek Vasut, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Tue, May 10, 2016 at 8:59 AM, Pantelis Antoniou
<pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> wrote:
> Hi Rob,
>
>> On May 10, 2016, at 00:59 , Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>> On Mon, May 9, 2016 at 1:05 PM, Pantelis Antoniou
>> <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> wrote:
>>> Add a description of the indirect overlay method to the overlay
>>> documention file.
>>
>> Why? Please write some decent commit messages.
>>
>>> Signed-off-by: Pantelis Antoniou <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
>>> ---
>>> Documentation/devicetree/overlay-notes.txt | 13 +++++++++++++
>>> 1 file changed, 13 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/overlay-notes.txt b/Documentation/devicetree/overlay-notes.txt
>>> index d418a6c..dd595e6 100644
>>> --- a/Documentation/devicetree/overlay-notes.txt
>>> +++ b/Documentation/devicetree/overlay-notes.txt
>>> @@ -100,6 +100,10 @@ Finally, if you need to remove all overlays in one-go, just call
>>> of_overlay_destroy_all() which will remove every single one in the correct
>>> order.
>>>
>>> +If your board has multiple slots/places where a single overlay can work
>>> +and each slot is defined by a node, you can use the of_overlay_create_indirect()
>>> +method to select the target.
>>> +
>>> Overlay DTS Format
>>> ------------------
>>>
>>> @@ -113,6 +117,11 @@ The DTS of an overlay should have the following format:
>>>                target=<phandle>;       /* phandle target of the overlay */
>>>        or
>>>                target-path="/path";    /* target path of the overlay */
>>
>> Why not just let these take multiple values and the user just selects index?
>>
>
> Implementation details. Usually there’s a descriptive label used for each
> different target point. It could be a slot# or it could be a label…
>
> A string selector maps better IMO.

Then add "target-names" perhaps.

What I really don't like is 3 different ways to specify the target and
having to maintain them (I'm not sure why we allowed 2 to start
with.). Come up with a single way that works for 1 or more targets. If
that is different than the current way, then let's deprecate the old
way.

Rob
--
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	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-05-10 14:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 18:05 [PATCH 0/6] of: overlays: New target methods Pantelis Antoniou
2016-05-09 18:05 ` [PATCH 1/6] of: overlay: Implement indirect target support Pantelis Antoniou
2016-05-09 18:05 ` [PATCH 2/6] of: unittest: Add indirect overlay target test Pantelis Antoniou
2016-05-09 18:05 ` [PATCH 3/6] doc: dt: Document the indirect overlay method Pantelis Antoniou
     [not found]   ` <1462817147-7620-4-git-send-email-pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-05-09 21:59     ` Rob Herring
2016-05-10 13:59       ` Pantelis Antoniou
     [not found]         ` <2A7DBC29-2A70-4076-8229-E2F517BFDE10-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
2016-05-10 14:36           ` Rob Herring
2016-05-09 18:05 ` [PATCH 4/6] of: overlay: Introduce target root capability Pantelis Antoniou
2016-05-09 18:05 ` [PATCH 5/6] of: unittest: Unit-tests for target root overlays Pantelis Antoniou
2016-05-09 18:05 ` [PATCH 6/6] doc: dt: Document the target root overlay method Pantelis Antoniou

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