aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPantelis Antoniou <pantelis.antoniou@konsulko.com>2014-07-04 12:58:03 -0400
committerGrant Likely <grant.likely@linaro.org>2014-07-07 08:42:52 -0400
commitc05aba2bd5f9dd3f363611ff844513de1341ac60 (patch)
tree28775148c24996ac0069a17e852e507bc6a3fc44
parent75f353b61342b5847c7f6d8499fd6301dce09845 (diff)
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: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org>
-rw-r--r--drivers/of/base.c19
-rw-r--r--drivers/of/device.c4
-rw-r--r--drivers/of/of_private.h2
3 files changed, 12 insertions, 13 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index b9864806e9b8..e48a1b90a392 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -40,10 +40,9 @@ static struct device_node *of_stdout;
40static struct kset *of_kset; 40static struct kset *of_kset;
41 41
42/* 42/*
43 * Used to protect the of_aliases; but also overloaded to hold off addition of 43 * Used to protect the of_aliases, to hold off addition of nodes to sysfs
44 * nodes to sysfs
45 */ 44 */
46DEFINE_MUTEX(of_aliases_mutex); 45DEFINE_MUTEX(of_mutex);
47 46
48/* use when traversing tree through the allnext, child, sibling, 47/* use when traversing tree through the allnext, child, sibling,
49 * or parent members of struct device_node. 48 * or parent members of struct device_node.
@@ -255,13 +254,13 @@ int of_node_add(struct device_node *np)
255 * Grab the mutex here so that in a race condition between of_init() and 254 * Grab the mutex here so that in a race condition between of_init() and
256 * of_node_add(), node addition will still be consistent. 255 * of_node_add(), node addition will still be consistent.
257 */ 256 */
258 mutex_lock(&of_aliases_mutex); 257 mutex_lock(&of_mutex);
259 if (of_kset) 258 if (of_kset)
260 rc = __of_node_add(np); 259 rc = __of_node_add(np);
261 else 260 else
262 /* This scenario may be perfectly valid, but report it anyway */ 261 /* This scenario may be perfectly valid, but report it anyway */
263 pr_info("of_node_add(%s) before of_init()\n", np->full_name); 262 pr_info("of_node_add(%s) before of_init()\n", np->full_name);
264 mutex_unlock(&of_aliases_mutex); 263 mutex_unlock(&of_mutex);
265 return rc; 264 return rc;
266} 265}
267 266
@@ -289,15 +288,15 @@ static int __init of_init(void)
289 struct device_node *np; 288 struct device_node *np;
290 289
291 /* Create the kset, and register existing nodes */ 290 /* Create the kset, and register existing nodes */
292 mutex_lock(&of_aliases_mutex); 291 mutex_lock(&of_mutex);
293 of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj); 292 of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj);
294 if (!of_kset) { 293 if (!of_kset) {
295 mutex_unlock(&of_aliases_mutex); 294 mutex_unlock(&of_mutex);
296 return -ENOMEM; 295 return -ENOMEM;
297 } 296 }
298 for_each_of_allnodes(np) 297 for_each_of_allnodes(np)
299 __of_node_add(np); 298 __of_node_add(np);
300 mutex_unlock(&of_aliases_mutex); 299 mutex_unlock(&of_mutex);
301 300
302 /* Symlink in /proc as required by userspace ABI */ 301 /* Symlink in /proc as required by userspace ABI */
303 if (of_allnodes) 302 if (of_allnodes)
@@ -2122,7 +2121,7 @@ int of_alias_get_id(struct device_node *np, const char *stem)
2122 struct alias_prop *app; 2121 struct alias_prop *app;
2123 int id = -ENODEV; 2122 int id = -ENODEV;
2124 2123
2125 mutex_lock(&of_aliases_mutex); 2124 mutex_lock(&of_mutex);
2126 list_for_each_entry(app, &aliases_lookup, link) { 2125 list_for_each_entry(app, &aliases_lookup, link) {
2127 if (strcmp(app->stem, stem) != 0) 2126 if (strcmp(app->stem, stem) != 0)
2128 continue; 2127 continue;
@@ -2132,7 +2131,7 @@ int of_alias_get_id(struct device_node *np, const char *stem)
2132 break; 2131 break;
2133 } 2132 }
2134 } 2133 }
2135 mutex_unlock(&of_aliases_mutex); 2134 mutex_unlock(&of_mutex);
2136 2135
2137 return id; 2136 return id;
2138} 2137}
diff --git a/drivers/of/device.c b/drivers/of/device.c
index dafb9736ab9b..46d6c75c1404 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -160,7 +160,7 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
160 add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen); 160 add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen);
161 161
162 seen = 0; 162 seen = 0;
163 mutex_lock(&of_aliases_mutex); 163 mutex_lock(&of_mutex);
164 list_for_each_entry(app, &aliases_lookup, link) { 164 list_for_each_entry(app, &aliases_lookup, link) {
165 if (dev->of_node == app->np) { 165 if (dev->of_node == app->np) {
166 add_uevent_var(env, "OF_ALIAS_%d=%s", seen, 166 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 seen++; 168 seen++;
169 } 169 }
170 } 170 }
171 mutex_unlock(&of_aliases_mutex); 171 mutex_unlock(&of_mutex);
172} 172}
173 173
174int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env) 174int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env)
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index ff350c8fa7ac..fcc70e74dfe0 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -31,6 +31,6 @@ struct alias_prop {
31 char stem[0]; 31 char stem[0];
32}; 32};
33 33
34extern struct mutex of_aliases_mutex; 34extern struct mutex of_mutex;
35extern struct list_head aliases_lookup; 35extern struct list_head aliases_lookup;
36#endif /* _LINUX_OF_PRIVATE_H */ 36#endif /* _LINUX_OF_PRIVATE_H */