]>
Commit | Line | Data |
---|---|---|
58c342f6 BP |
1 | #ifndef __LINUX_KOBJECT_WRAPPER_H |
2 | #define __LINUX_KOBJECT_WRAPPER_H 1 | |
3 | ||
4 | #include_next <linux/kobject.h> | |
5 | ||
6 | #include <linux/version.h> | |
8fef8c71 | 7 | |
58c342f6 BP |
8 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) |
9 | #define kobject_init(kobj, ktype) rpl_kobject_init(kobj, ktype) | |
10 | static inline void rpl_kobject_init(struct kobject *kobj, struct kobj_type *ktype) | |
11 | { | |
12 | kobj->ktype = ktype; | |
13 | (kobject_init)(kobj); | |
14 | } | |
806e39cf | 15 | |
8fef8c71 BP |
16 | #define kobject_add(kobj, parent, name) rpl_kobject_add(kobj, parent, name) |
17 | static inline int rpl_kobject_add(struct kobject *kobj, | |
18 | struct kobject *parent, | |
19 | const char *name) | |
20 | { | |
21 | int err = kobject_set_name(kobj, "%s", name); | |
22 | if (err) | |
23 | return err; | |
24 | kobj->parent = parent; | |
25 | return (kobject_add)(kobj); | |
806e39cf | 26 | } |
58c342f6 BP |
27 | #endif |
28 | ||
8fef8c71 | 29 | |
58c342f6 | 30 | #endif /* linux/kobject.h wrapper */ |