Merge citrix into master.
[sliver-openvswitch.git] / datapath / linux-2.6 / compat-2.6 / include / linux / kobject.h
index 7dbb010..4cf797e 100644 (file)
@@ -4,20 +4,27 @@
 #include_next <linux/kobject.h>
 
 #include <linux/version.h>
+
 #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 */