Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104760
b: refs/heads/master
c: d2a3b91
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Wilcox authored and Greg Kroah-Hartman committed Jul 22, 2008
1 parent bb438fb commit 10dc471
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1e41250863cd4de5ffa0678c405d001ca5b62796
refs/heads/master: d2a3b9146e4f40c2e872d7567c996ef95083d802
11 changes: 6 additions & 5 deletions trunk/drivers/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static void remove_class_attrs(struct class *cls)
}
}

int class_register(struct class *cls)
int __class_register(struct class *cls, struct lock_class_key *key)
{
struct class_private *cp;
int error;
Expand Down Expand Up @@ -178,6 +178,7 @@ int class_register(struct class *cls)
class_put(cls);
return error;
}
EXPORT_SYMBOL_GPL(__class_register);

void class_unregister(struct class *cls)
{
Expand All @@ -203,7 +204,8 @@ static void class_create_release(struct class *cls)
* Note, the pointer created here is to be destroyed when finished by
* making a call to class_destroy().
*/
struct class *class_create(struct module *owner, const char *name)
struct class *__class_create(struct module *owner, const char *name,
struct lock_class_key *key)
{
struct class *cls;
int retval;
Expand All @@ -218,7 +220,7 @@ struct class *class_create(struct module *owner, const char *name)
cls->owner = owner;
cls->class_release = class_create_release;

retval = class_register(cls);
retval = __class_register(cls, key);
if (retval)
goto error;

Expand All @@ -228,6 +230,7 @@ struct class *class_create(struct module *owner, const char *name)
kfree(cls);
return ERR_PTR(retval);
}
EXPORT_SYMBOL_GPL(__class_create);

/**
* class_destroy - destroys a struct class structure
Expand Down Expand Up @@ -412,9 +415,7 @@ int __init classes_init(void)

EXPORT_SYMBOL_GPL(class_create_file);
EXPORT_SYMBOL_GPL(class_remove_file);
EXPORT_SYMBOL_GPL(class_register);
EXPORT_SYMBOL_GPL(class_unregister);
EXPORT_SYMBOL_GPL(class_create);
EXPORT_SYMBOL_GPL(class_destroy);

EXPORT_SYMBOL_GPL(class_interface_register);
Expand Down
25 changes: 23 additions & 2 deletions trunk/include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/kobject.h>
#include <linux/klist.h>
#include <linux/list.h>
#include <linux/lockdep.h>
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/module.h>
Expand Down Expand Up @@ -205,8 +206,18 @@ struct class {

extern struct kobject *sysfs_dev_block_kobj;
extern struct kobject *sysfs_dev_char_kobj;
extern int __must_check class_register(struct class *class);
extern int __must_check __class_register(struct class *class,
struct lock_class_key *key);
extern void class_unregister(struct class *class);

/* This is a #define to keep the compiler from merging different
* instances of the __key variable */
#define class_register(class) \
({ \
static struct lock_class_key __key; \
__class_register(class, &__key); \
})

extern int class_for_each_device(struct class *class, struct device *start,
void *data,
int (*fn)(struct device *dev, void *data));
Expand Down Expand Up @@ -239,9 +250,19 @@ struct class_interface {
extern int __must_check class_interface_register(struct class_interface *);
extern void class_interface_unregister(struct class_interface *);

extern struct class *class_create(struct module *owner, const char *name);
extern struct class * __must_check __class_create(struct module *owner,
const char *name,
struct lock_class_key *key);
extern void class_destroy(struct class *cls);

/* This is a #define to keep the compiler from merging different
* instances of the __key variable */
#define class_create(owner, name) \
({ \
static struct lock_class_key __key; \
__class_create(owner, name, &__key); \
})

/*
* The type of device, "struct device" is embedded in. A class
* or bus can contain devices of different types
Expand Down

0 comments on commit 10dc471

Please sign in to comment.