aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index b0556082179b..0e1d24c2ed41 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -16,6 +16,7 @@
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/klist.h> 17#include <linux/klist.h>
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/lockdep.h>
19#include <linux/compiler.h> 20#include <linux/compiler.h>
20#include <linux/types.h> 21#include <linux/types.h>
21#include <linux/module.h> 22#include <linux/module.h>
@@ -205,8 +206,18 @@ struct class {
205 206
206extern struct kobject *sysfs_dev_block_kobj; 207extern struct kobject *sysfs_dev_block_kobj;
207extern struct kobject *sysfs_dev_char_kobj; 208extern struct kobject *sysfs_dev_char_kobj;
208extern int __must_check class_register(struct class *class); 209extern int __must_check __class_register(struct class *class,
210 struct lock_class_key *key);
209extern void class_unregister(struct class *class); 211extern void class_unregister(struct class *class);
212
213/* This is a #define to keep the compiler from merging different
214 * instances of the __key variable */
215#define class_register(class) \
216({ \
217 static struct lock_class_key __key; \
218 __class_register(class, &__key); \
219})
220
210extern int class_for_each_device(struct class *class, struct device *start, 221extern int class_for_each_device(struct class *class, struct device *start,
211 void *data, 222 void *data,
212 int (*fn)(struct device *dev, void *data)); 223 int (*fn)(struct device *dev, void *data));
@@ -239,9 +250,19 @@ struct class_interface {
239extern int __must_check class_interface_register(struct class_interface *); 250extern int __must_check class_interface_register(struct class_interface *);
240extern void class_interface_unregister(struct class_interface *); 251extern void class_interface_unregister(struct class_interface *);
241 252
242extern struct class *class_create(struct module *owner, const char *name); 253extern struct class * __must_check __class_create(struct module *owner,
254 const char *name,
255 struct lock_class_key *key);
243extern void class_destroy(struct class *cls); 256extern void class_destroy(struct class *cls);
244 257
258/* This is a #define to keep the compiler from merging different
259 * instances of the __key variable */
260#define class_create(owner, name) \
261({ \
262 static struct lock_class_key __key; \
263 __class_create(owner, name, &__key); \
264})
265
245/* 266/*
246 * The type of device, "struct device" is embedded in. A class 267 * The type of device, "struct device" is embedded in. A class
247 * or bus can contain devices of different types 268 * or bus can contain devices of different types