aboutsummaryrefslogtreecommitdiffstats
path: root/f1.patch
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-29 15:03:01 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2007-11-29 15:03:01 -0800
commitdcbf6a55ee50f87ed0ccb2d4ec334dba639d676a (patch)
tree4e3512f3d6add6d72cb70bb9fa9e9ebfa9a63065 /f1.patch
parent59f23e1d24855b75f3b467e71646b9616e702082 (diff)
downloadpatches-dcbf6a55ee50f87ed0ccb2d4ec334dba639d676a.tar.gz
another sysfs patch
Diffstat (limited to 'f1.patch')
-rw-r--r--f1.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/f1.patch b/f1.patch
new file mode 100644
index 00000000000000..b5b190d736b3b9
--- /dev/null
+++ b/f1.patch
@@ -0,0 +1,48 @@
+---
+ lib/kobject.c | 35 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 35 insertions(+)
+
+--- a/lib/kobject.c
++++ b/lib/kobject.c
+@@ -191,6 +191,41 @@ void kobject_init(struct kobject * kobj)
+ INIT_LIST_HEAD(&kobj->entry);
+ }
+
++/**
++ * kobject_init - initialize a kobject structure
++ * @kobj: pointer to the kobject to initialize
++ * @ktype: pointer to the ktype for this kobject.
++ * @fmt: the name of the kobject
++ *
++ * This function will properly initialize a kobject such that it can then
++ * be passed to the kobject_add() call.
++ *
++ * If the function returns an error, the memory allocated by the kobject
++ * can be safely freed, no other functions need to be called.
++ */
++int kobject_i(struct kobject *kobj, struct kobj_type *ktype, const char *fmt, ...)
++{
++ va_list args;
++ int retval;
++
++ if (!kobj)
++ return -EINVAL;
++
++ if (!ktype)
++ return -EINVAL;
++
++ WARN_ON(atomic_read(&kobj->kref.refcount));
++ kref_init(&kobj->kref);
++ INIT_LIST_HEAD(&kobj->entry);
++ kobj->ktype = ktype;
++
++ va_start(args, fmt);
++ retval = kobject_set_name_vargs(kobj, fmt, args);
++ va_end(args);
++
++ return retval;
++}
++
+
+ /**
+ * unlink - remove kobject from kset list.