lkml.org 
[lkml]   [2015]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH/RFC 2/3] of: Add of_alias_destroy()
Date
Add a helper function to find an alias, remove it from the list of
aliases, and destroy it.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/of/base.c | 14 ++++++++++++++
include/linux/of.h | 1 +
2 files changed, 15 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 390f9e2b7b65d54b..6aafee0cfb27bd5c 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1922,6 +1922,20 @@ void of_alias_create(struct property *pp,
of_alias_add(ap, np, id, start, len);
}

+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;
+ }
+}
+
/**
* of_alias_scan - Scan all properties of the 'aliases' node
*
diff --git a/include/linux/of.h b/include/linux/of.h
index 0852625e4cfb3dfe..1807a95a00a84a99 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -335,6 +335,7 @@ extern int of_count_phandle_with_args(const struct device_node *np,

extern void of_alias_create(struct property *pp,
void * (*dt_alloc)(u64 size, u64 align));
+extern void of_alias_destroy(const char *name, void (*dt_free)(void *));
extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
extern int of_alias_get_id(struct device_node *np, const char *stem);
extern int of_alias_get_highest_id(const char *stem);
--
1.9.1


\
 
 \ /
  Last update: 2015-06-30 17:01    [W:0.048 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site