Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0290c4ca authored by Frank Rowand's avatar Frank Rowand Committed by Rob Herring
Browse files

of: overlay: rename identifiers to more reflect what they do



This patch is aimed primarily at drivers/of/overlay.c, but those
changes also have a small impact in a few other files.

overlay.c is difficult to read and maintain.  Improve readability:
  - Rename functions, types and variables to better reflect what
    they do and to be consistent with names in other places,
    such as the device tree overlay FDT (flattened device tree),
    and make the algorithms more clear
  - Use the same names consistently throughout the file
  - Update comments for name changes
  - Fix incorrect comments

This patch is intended to not introduce any functional change.

Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
parent bbed8794
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -87,15 +87,15 @@ Overlay in-kernel API

The API is quite easy to use.

1. Call of_overlay_create() to create and apply an overlay. The return value
is a cookie identifying this overlay.
1. Call of_overlay_apply() to create and apply an overlay changeset. The return
value is an error or a cookie identifying this overlay.

2. Call of_overlay_destroy() to remove and cleanup the overlay previously
created via the call to of_overlay_create(). Removal of an overlay that
is stacked by another will not be permitted.
2. Call of_overlay_remove() to remove and cleanup the overlay changeset
previously created via the call to of_overlay_apply(). Removal of an overlay
changeset that is stacked by another will not be permitted.

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
of_overlay_remove_all() which will remove every single one in the correct
order.

Overlay DTS Format
+3 −2
Original line number Diff line number Diff line
@@ -247,9 +247,10 @@ static void __init tilcdc_convert_slave_node(void)

	tilcdc_node_disable(slave);

	ret = of_overlay_create(overlay);
	ret = of_overlay_apply(overlay);
	if (ret)
		pr_err("%s: Creating overlay failed: %d\n", __func__, ret);
		pr_err("%s: Applying overlay changeset failed: %d\n",
			__func__, ret);
	else
		pr_info("%s: ti,tilcdc,slave node successfully converted\n",
			__func__);
+1 −1
Original line number Diff line number Diff line
@@ -758,7 +758,7 @@ int of_changeset_revert(struct of_changeset *ocs)
EXPORT_SYMBOL_GPL(of_changeset_revert);

/**
 * of_changeset_action - Perform a changeset action
 * of_changeset_action - Add an action to the tail of the changeset list
 *
 * @ocs:	changeset pointer
 * @action:	action to perform
+284 −246

File changed.

Preview size limit exceeded, changes collapsed.

+10 −10
Original line number Diff line number Diff line
@@ -1230,7 +1230,7 @@ static void of_unittest_destroy_tracked_overlays(void)
			if (!(overlay_id_bits[BIT_WORD(id)] & BIT_MASK(id)))
				continue;

			ret = of_overlay_destroy(id + overlay_first_id);
			ret = of_overlay_remove(id + overlay_first_id);
			if (ret == -ENODEV) {
				pr_warn("%s: no overlay to destroy for #%d\n",
					__func__, id + overlay_first_id);
@@ -1262,7 +1262,7 @@ static int of_unittest_apply_overlay(int overlay_nr, int unittest_nr,
		goto out;
	}

	ret = of_overlay_create(np);
	ret = of_overlay_apply(np);
	if (ret < 0) {
		unittest(0, "could not create overlay from \"%s\"\n",
				overlay_path(overlay_nr));
@@ -1347,7 +1347,7 @@ static int of_unittest_apply_revert_overlay_check(int overlay_nr,
		return -EINVAL;
	}

	ret = of_overlay_destroy(ov_id);
	ret = of_overlay_remove(ov_id);
	if (ret != 0) {
		unittest(0, "overlay @\"%s\" failed to be destroyed @\"%s\"\n",
				overlay_path(overlay_nr),
@@ -1476,7 +1476,7 @@ static void of_unittest_overlay_6(void)
			return;
		}

		ret = of_overlay_create(np);
		ret = of_overlay_apply(np);
		if (ret < 0)  {
			unittest(0, "could not create overlay from \"%s\"\n",
					overlay_path(overlay_nr + i));
@@ -1500,7 +1500,7 @@ static void of_unittest_overlay_6(void)
	}

	for (i = 1; i >= 0; i--) {
		ret = of_overlay_destroy(ov_id[i]);
		ret = of_overlay_remove(ov_id[i]);
		if (ret != 0) {
			unittest(0, "overlay @\"%s\" failed destroy @\"%s\"\n",
					overlay_path(overlay_nr + i),
@@ -1546,7 +1546,7 @@ static void of_unittest_overlay_8(void)
			return;
		}

		ret = of_overlay_create(np);
		ret = of_overlay_apply(np);
		if (ret < 0)  {
			unittest(0, "could not create overlay from \"%s\"\n",
					overlay_path(overlay_nr + i));
@@ -1557,7 +1557,7 @@ static void of_unittest_overlay_8(void)
	}

	/* now try to remove first overlay (it should fail) */
	ret = of_overlay_destroy(ov_id[0]);
	ret = of_overlay_remove(ov_id[0]);
	if (ret == 0) {
		unittest(0, "overlay @\"%s\" was destroyed @\"%s\"\n",
				overlay_path(overlay_nr + 0),
@@ -1568,7 +1568,7 @@ static void of_unittest_overlay_8(void)

	/* removing them in order should work */
	for (i = 1; i >= 0; i--) {
		ret = of_overlay_destroy(ov_id[i]);
		ret = of_overlay_remove(ov_id[i]);
		if (ret != 0) {
			unittest(0, "overlay @\"%s\" not destroyed @\"%s\"\n",
					overlay_path(overlay_nr + i),
@@ -2149,9 +2149,9 @@ static int __init overlay_data_add(int onum)
		goto out_free_np_overlay;
	}

	ret = of_overlay_create(info->np_overlay);
	ret = of_overlay_apply(info->np_overlay);
	if (ret < 0) {
		pr_err("of_overlay_create() (ret=%d), %d\n", ret, onum);
		pr_err("of_overlay_apply() (ret=%d), %d\n", ret, onum);
		goto out_free_np_overlay;
	} else {
		info->overlay_id = ret;
Loading