Commit c05aba2b authored by Pantelis Antoniou's avatar Pantelis Antoniou Committed by Grant Likely

of: rename of_aliases_mutex to just of_mutex

We're overloading usage of of_aliases_mutex for sysfs changes,
so rename to something that is more generic.
Signed-off-by: default avatarPantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
parent 75f353b6
...@@ -40,10 +40,9 @@ static struct device_node *of_stdout; ...@@ -40,10 +40,9 @@ static struct device_node *of_stdout;
static struct kset *of_kset; static struct kset *of_kset;
/* /*
* Used to protect the of_aliases; but also overloaded to hold off addition of * Used to protect the of_aliases, to hold off addition of nodes to sysfs
* nodes to sysfs
*/ */
DEFINE_MUTEX(of_aliases_mutex); DEFINE_MUTEX(of_mutex);
/* use when traversing tree through the allnext, child, sibling, /* use when traversing tree through the allnext, child, sibling,
* or parent members of struct device_node. * or parent members of struct device_node.
...@@ -255,13 +254,13 @@ int of_node_add(struct device_node *np) ...@@ -255,13 +254,13 @@ int of_node_add(struct device_node *np)
* Grab the mutex here so that in a race condition between of_init() and * Grab the mutex here so that in a race condition between of_init() and
* of_node_add(), node addition will still be consistent. * of_node_add(), node addition will still be consistent.
*/ */
mutex_lock(&of_aliases_mutex); mutex_lock(&of_mutex);
if (of_kset) if (of_kset)
rc = __of_node_add(np); rc = __of_node_add(np);
else else
/* This scenario may be perfectly valid, but report it anyway */ /* This scenario may be perfectly valid, but report it anyway */
pr_info("of_node_add(%s) before of_init()\n", np->full_name); pr_info("of_node_add(%s) before of_init()\n", np->full_name);
mutex_unlock(&of_aliases_mutex); mutex_unlock(&of_mutex);
return rc; return rc;
} }
...@@ -289,15 +288,15 @@ static int __init of_init(void) ...@@ -289,15 +288,15 @@ static int __init of_init(void)
struct device_node *np; struct device_node *np;
/* Create the kset, and register existing nodes */ /* Create the kset, and register existing nodes */
mutex_lock(&of_aliases_mutex); mutex_lock(&of_mutex);
of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj); of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj);
if (!of_kset) { if (!of_kset) {
mutex_unlock(&of_aliases_mutex); mutex_unlock(&of_mutex);
return -ENOMEM; return -ENOMEM;
} }
for_each_of_allnodes(np) for_each_of_allnodes(np)
__of_node_add(np); __of_node_add(np);
mutex_unlock(&of_aliases_mutex); mutex_unlock(&of_mutex);
/* Symlink in /proc as required by userspace ABI */ /* Symlink in /proc as required by userspace ABI */
if (of_allnodes) if (of_allnodes)
...@@ -2122,7 +2121,7 @@ int of_alias_get_id(struct device_node *np, const char *stem) ...@@ -2122,7 +2121,7 @@ int of_alias_get_id(struct device_node *np, const char *stem)
struct alias_prop *app; struct alias_prop *app;
int id = -ENODEV; int id = -ENODEV;
mutex_lock(&of_aliases_mutex); mutex_lock(&of_mutex);
list_for_each_entry(app, &aliases_lookup, link) { list_for_each_entry(app, &aliases_lookup, link) {
if (strcmp(app->stem, stem) != 0) if (strcmp(app->stem, stem) != 0)
continue; continue;
...@@ -2132,7 +2131,7 @@ int of_alias_get_id(struct device_node *np, const char *stem) ...@@ -2132,7 +2131,7 @@ int of_alias_get_id(struct device_node *np, const char *stem)
break; break;
} }
} }
mutex_unlock(&of_aliases_mutex); mutex_unlock(&of_mutex);
return id; return id;
} }
......
...@@ -160,7 +160,7 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -160,7 +160,7 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen); add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen);
seen = 0; seen = 0;
mutex_lock(&of_aliases_mutex); mutex_lock(&of_mutex);
list_for_each_entry(app, &aliases_lookup, link) { list_for_each_entry(app, &aliases_lookup, link) {
if (dev->of_node == app->np) { if (dev->of_node == app->np) {
add_uevent_var(env, "OF_ALIAS_%d=%s", seen, add_uevent_var(env, "OF_ALIAS_%d=%s", seen,
...@@ -168,7 +168,7 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -168,7 +168,7 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
seen++; seen++;
} }
} }
mutex_unlock(&of_aliases_mutex); mutex_unlock(&of_mutex);
} }
int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env) int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env)
......
...@@ -31,6 +31,6 @@ struct alias_prop { ...@@ -31,6 +31,6 @@ struct alias_prop {
char stem[0]; char stem[0];
}; };
extern struct mutex of_aliases_mutex; extern struct mutex of_mutex;
extern struct list_head aliases_lookup; extern struct list_head aliases_lookup;
#endif /* _LINUX_OF_PRIVATE_H */ #endif /* _LINUX_OF_PRIVATE_H */
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