aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/class.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2008-05-28 12:28:39 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-22 00:54:52 -0400
commitd2a3b9146e4f40c2e872d7567c996ef95083d802 (patch)
treec95bd0a155e1c868fcaffeb0949dd3441203f72a /drivers/base/class.c
parent1e41250863cd4de5ffa0678c405d001ca5b62796 (diff)
class: add lockdep infrastructure
This adds the infrastructure to properly handle lockdep issues when the internal class semaphore is changed to a mutex. Matthew wrote the original patch, and Greg fixed it up to work properly with the class_create() function. From: Matthew Wilcox <matthew@wil.cx> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Dave Young <hidave.darkstar@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/class.c')
-rw-r--r--drivers/base/class.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c
index d24d21114ccb..89000566690c 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -134,7 +134,7 @@ static void remove_class_attrs(struct class *cls)
134 } 134 }
135} 135}
136 136
137int class_register(struct class *cls) 137int __class_register(struct class *cls, struct lock_class_key *key)
138{ 138{
139 struct class_private *cp; 139 struct class_private *cp;
140 int error; 140 int error;
@@ -178,6 +178,7 @@ int class_register(struct class *cls)
178 class_put(cls); 178 class_put(cls);
179 return error; 179 return error;
180} 180}
181EXPORT_SYMBOL_GPL(__class_register);
181 182
182void class_unregister(struct class *cls) 183void class_unregister(struct class *cls)
183{ 184{
@@ -203,7 +204,8 @@ static void class_create_release(struct class *cls)
203 * Note, the pointer created here is to be destroyed when finished by 204 * Note, the pointer created here is to be destroyed when finished by
204 * making a call to class_destroy(). 205 * making a call to class_destroy().
205 */ 206 */
206struct class *class_create(struct module *owner, const char *name) 207struct class *__class_create(struct module *owner, const char *name,
208 struct lock_class_key *key)
207{ 209{
208 struct class *cls; 210 struct class *cls;
209 int retval; 211 int retval;
@@ -218,7 +220,7 @@ struct class *class_create(struct module *owner, const char *name)
218 cls->owner = owner; 220 cls->owner = owner;
219 cls->class_release = class_create_release; 221 cls->class_release = class_create_release;
220 222
221 retval = class_register(cls); 223 retval = __class_register(cls, key);
222 if (retval) 224 if (retval)
223 goto error; 225 goto error;
224 226
@@ -228,6 +230,7 @@ error:
228 kfree(cls); 230 kfree(cls);
229 return ERR_PTR(retval); 231 return ERR_PTR(retval);
230} 232}
233EXPORT_SYMBOL_GPL(__class_create);
231 234
232/** 235/**
233 * class_destroy - destroys a struct class structure 236 * class_destroy - destroys a struct class structure
@@ -412,9 +415,7 @@ int __init classes_init(void)
412 415
413EXPORT_SYMBOL_GPL(class_create_file); 416EXPORT_SYMBOL_GPL(class_create_file);
414EXPORT_SYMBOL_GPL(class_remove_file); 417EXPORT_SYMBOL_GPL(class_remove_file);
415EXPORT_SYMBOL_GPL(class_register);
416EXPORT_SYMBOL_GPL(class_unregister); 418EXPORT_SYMBOL_GPL(class_unregister);
417EXPORT_SYMBOL_GPL(class_create);
418EXPORT_SYMBOL_GPL(class_destroy); 419EXPORT_SYMBOL_GPL(class_destroy);
419 420
420EXPORT_SYMBOL_GPL(class_interface_register); 421EXPORT_SYMBOL_GPL(class_interface_register);