summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-06 09:24:43 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-25 07:40:11 +0300
commit43968d2f1648f4dc92437dc0363a3e88377445b3 (patch)
treec9ba656e289bbbb5d5de32abc4181ae1d65dee00 /lib
parent4ff6abff832fbc6cb1d769f6106c841bc2b09f63 (diff)
downloadlinux-43968d2f1648f4dc92437dc0363a3e88377445b3.tar.xz
kobject: get rid of kobject_kset_add_dir
kobject_kset_add_dir is only called in one place so remove it and use kobject_create() instead. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/kobject.c37
1 files changed, 5 insertions, 32 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index 96b61d9a9284..67c3d38d48f0 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -629,15 +629,18 @@ static struct kobj_type dynamic_kobj_ktype = {
.release = dynamic_kobj_release,
};
-/*
+/**
* kobject_create - create a struct kobject dynamically
*
* This function creates a kobject structure dynamically and sets it up
* to be a "dynamic" kobject with a default release function set up.
*
* If the kobject was not able to be created, NULL will be returned.
+ * The kobject structure returned from here must be cleaned up with a
+ * call to kobject_put() and not kfree(), as kobject_init_ng() has
+ * already been called on this structure.
*/
-static struct kobject *kobject_create(void)
+struct kobject *kobject_create(void)
{
struct kobject *kobj;
@@ -683,36 +686,6 @@ struct kobject *kobject_create_and_add(const char *name, struct kobject *parent)
EXPORT_SYMBOL_GPL(kobject_create_and_add);
/**
- * kobject_kset_add_dir - add sub directory of object.
- * @kset: kset the directory is belongs to.
- * @parent: object in which a directory is created.
- * @name: directory name.
- *
- * Add a plain directory object as child of given object.
- */
-struct kobject *kobject_kset_add_dir(struct kset *kset,
- struct kobject *parent, const char *name)
-{
- struct kobject *k;
- int ret;
-
- k = kobject_create();
- if (!k)
- return NULL;
-
- k->kset = kset;
- ret = kobject_add_ng(k, parent, "%s", name);
- if (ret < 0) {
- printk(KERN_WARNING "%s: kobject_add error: %d\n",
- __func__, ret);
- kobject_put(k);
- k = NULL;
- }
-
- return k;
-}
-
-/**
* kset_init - initialize a kset for use
* @k: kset
*/