X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=datapath%2Flinux-2.6%2Fcompat-2.6%2Finclude%2Flinux%2Fkobject.h;fp=datapath%2Flinux-2.6%2Fcompat-2.6%2Finclude%2Flinux%2Fkobject.h;h=4cf797e36c5711ff7ade7597490f628f3cb83b57;hb=8fef8c7121222233075a03d57db7e0b48d5f6be5;hp=7dbb010c2c6b19ebe4427cea252a01a519408aa2;hpb=6dd3fad481b5d801695c2b0529c7d37cac2c9b19;p=sliver-openvswitch.git diff --git a/datapath/linux-2.6/compat-2.6/include/linux/kobject.h b/datapath/linux-2.6/compat-2.6/include/linux/kobject.h index 7dbb010c2..4cf797e36 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/kobject.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/kobject.h @@ -4,20 +4,27 @@ #include_next #include + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) -static inline int kobject_init_and_add(struct kobject *kobj, - struct kobj_type *ktype, - struct kobject *parent, - const char *name) +#define kobject_init(kobj, ktype) rpl_kobject_init(kobj, ktype) +static inline void rpl_kobject_init(struct kobject *kobj, struct kobj_type *ktype) { - kobject_init(kobj); - kobject_set_name(kobj, "%s", name); kobj->ktype = ktype; - kobj->kset = NULL; - kobj->parent = parent; + (kobject_init)(kobj); +} - return kobject_add(kobj); +#define kobject_add(kobj, parent, name) rpl_kobject_add(kobj, parent, name) +static inline int rpl_kobject_add(struct kobject *kobj, + struct kobject *parent, + const char *name) +{ + int err = kobject_set_name(kobj, "%s", name); + if (err) + return err; + kobj->parent = parent; + return (kobject_add)(kobj); } #endif + #endif /* linux/kobject.h wrapper */