Skip to content

Commit c05aba2

Browse files
pantoniouglikely
authored andcommitted
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>
1 parent 75f353b commit c05aba2

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

‎drivers/of/base.c‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@ static struct device_node *of_stdout;
4040
static struct kset *of_kset;
4141

4242
/*
43-
* Used to protect the of_aliases; but also overloaded to hold off addition of
44-
* nodes to sysfs
43+
* Used to protect the of_aliases, to hold off addition of nodes to sysfs
4544
*/
46-
DEFINE_MUTEX(of_aliases_mutex);
45+
DEFINE_MUTEX(of_mutex);
4746

4847
/* use when traversing tree through the allnext, child, sibling,
4948
* or parent members of struct device_node.
@@ -255,13 +254,13 @@ int of_node_add(struct device_node *np)
255254
* Grab the mutex here so that in a race condition between of_init() and
256255
* of_node_add(), node addition will still be consistent.
257256
*/
258-
mutex_lock(&of_aliases_mutex);
257+
mutex_lock(&of_mutex);
259258
if (of_kset)
260259
rc = __of_node_add(np);
261260
else
262261
/* This scenario may be perfectly valid, but report it anyway */
263262
pr_info("of_node_add(%s) before of_init()\n", np->full_name);
264-
mutex_unlock(&of_aliases_mutex);
263+
mutex_unlock(&of_mutex);
265264
return rc;
266265
}
267266

@@ -289,15 +288,15 @@ static int __init of_init(void)
289288
struct device_node *np;
290289

291290
/* Create the kset, and register existing nodes */
292-
mutex_lock(&of_aliases_mutex);
291+
mutex_lock(&of_mutex);
293292
of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj);
294293
if (!of_kset) {
295-
mutex_unlock(&of_aliases_mutex);
294+
mutex_unlock(&of_mutex);
296295
return -ENOMEM;
297296
}
298297
for_each_of_allnodes(np)
299298
__of_node_add(np);
300-
mutex_unlock(&of_aliases_mutex);
299+
mutex_unlock(&of_mutex);
301300

302301
/* Symlink in /proc as required by userspace ABI */
303302
if (of_allnodes)
@@ -2122,7 +2121,7 @@ int of_alias_get_id(struct device_node *np, const char *stem)
21222121
struct alias_prop *app;
21232122
int id = -ENODEV;
21242123

2125-
mutex_lock(&of_aliases_mutex);
2124+
mutex_lock(&of_mutex);
21262125
list_for_each_entry(app, &aliases_lookup, link) {
21272126
if (strcmp(app->stem, stem) != 0)
21282127
continue;
@@ -2132,7 +2131,7 @@ int of_alias_get_id(struct device_node *np, const char *stem)
21322131
break;
21332132
}
21342133
}
2135-
mutex_unlock(&of_aliases_mutex);
2134+
mutex_unlock(&of_mutex);
21362135

21372136
return id;
21382137
}

‎drivers/of/device.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
160160
add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen);
161161

162162
seen = 0;
163-
mutex_lock(&of_aliases_mutex);
163+
mutex_lock(&of_mutex);
164164
list_for_each_entry(app, &aliases_lookup, link) {
165165
if (dev->of_node == app->np) {
166166
add_uevent_var(env, "OF_ALIAS_%d=%s", seen,
167167
app->alias);
168168
seen++;
169169
}
170170
}
171-
mutex_unlock(&of_aliases_mutex);
171+
mutex_unlock(&of_mutex);
172172
}
173173

174174
int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env)

‎drivers/of/of_private.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ struct alias_prop {
3131
char stem[0];
3232
};
3333

34-
extern struct mutex of_aliases_mutex;
34+
extern struct mutex of_mutex;
3535
extern struct list_head aliases_lookup;
3636
#endif /* _LINUX_OF_PRIVATE_H */

0 commit comments

Comments
 (0)