[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241110-of-alias-v2-2-16da9844a93e@beagleboard.org>
Date: Sun, 10 Nov 2024 01:21:34 +0530
From: Ayush Singh <ayush@...gleboard.org>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
d-gole@...com, jkridner@...gleboard.org, lorforlinux@...gleboard.org,
Geert Uytterhoeven <geert@...ux-m68k.org>, Andrew Davis <afd@...com>,
robertcnelson@...gleboard.org
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Ayush Singh <ayush@...gleboard.org>
Subject: [PATCH v2 2/3] of: Add of_alias_destroy()
Add a helper function to find an alias, remove it from the list of
aliases, and destroy it.
Co-developed-by: Geert Uytterhoeven <geert@...ux-m68k.org>
Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
Signed-off-by: Ayush Singh <ayush@...gleboard.org>
---
drivers/of/base.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index e5cd75fca95132060334aa8547c58951d2132cfb..1cfb3cd4493e17d16868981288115798c6a6a151 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -221,6 +221,20 @@ static void of_alias_create(const struct property *pp,
of_alias_add(ap, np, id, start, len);
}
+static void of_alias_destroy(const char *name, void (*dt_free)(void *))
+{
+ struct alias_prop *ap;
+
+ list_for_each_entry(ap, &aliases_lookup, link) {
+ if (strcmp(ap->alias, name))
+ continue;
+
+ list_del(&ap->link);
+ dt_free(ap);
+ return;
+ }
+}
+
void __init of_core_init(void)
{
struct device_node *np;
--
2.47.0
Powered by blists - more mailing lists