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

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
......@@ -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
......
......@@ -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__);
......
......@@ -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
......
This diff is collapsed.
......@@ -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;
......
......@@ -1312,26 +1312,26 @@ struct of_overlay_notify_data {
#ifdef CONFIG_OF_OVERLAY
/* ID based overlays; the API for external users */
int of_overlay_create(struct device_node *tree);
int of_overlay_destroy(int id);
int of_overlay_destroy_all(void);
int of_overlay_apply(struct device_node *tree);
int of_overlay_remove(int id);
int of_overlay_remove_all(void);
int of_overlay_notifier_register(struct notifier_block *nb);
int of_overlay_notifier_unregister(struct notifier_block *nb);
#else
static inline int of_overlay_create(struct device_node *tree)
static inline int of_overlay_apply(struct device_node *tree)
{
return -ENOTSUPP;
}
static inline int of_overlay_destroy(int id)
static inline int of_overlay_remove(int id)
{
return -ENOTSUPP;
}
static inline int of_overlay_destroy_all(void)
static inline int of_overlay_remove_all(void)
{
return -ENOTSUPP;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment