diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-06 01:24:43 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:11 -0500 |
commit | 43968d2f1648f4dc92437dc0363a3e88377445b3 (patch) | |
tree | c9ba656e289bbbb5d5de32abc4181ae1d65dee00 /lib/kobject.c | |
parent | 4ff6abff832fbc6cb1d769f6106c841bc2b09f63 (diff) |
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/kobject.c')
-rw-r--r-- | lib/kobject.c | 37 |
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 = { | |||
629 | .release = dynamic_kobj_release, | 629 | .release = dynamic_kobj_release, |
630 | }; | 630 | }; |
631 | 631 | ||
632 | /* | 632 | /** |
633 | * kobject_create - create a struct kobject dynamically | 633 | * kobject_create - create a struct kobject dynamically |
634 | * | 634 | * |
635 | * This function creates a kobject structure dynamically and sets it up | 635 | * This function creates a kobject structure dynamically and sets it up |
636 | * to be a "dynamic" kobject with a default release function set up. | 636 | * to be a "dynamic" kobject with a default release function set up. |
637 | * | 637 | * |
638 | * If the kobject was not able to be created, NULL will be returned. | 638 | * If the kobject was not able to be created, NULL will be returned. |
639 | * The kobject structure returned from here must be cleaned up with a | ||
640 | * call to kobject_put() and not kfree(), as kobject_init_ng() has | ||
641 | * already been called on this structure. | ||
639 | */ | 642 | */ |
640 | static struct kobject *kobject_create(void) | 643 | struct kobject *kobject_create(void) |
641 | { | 644 | { |
642 | struct kobject *kobj; | 645 | struct kobject *kobj; |
643 | 646 | ||
@@ -683,36 +686,6 @@ struct kobject *kobject_create_and_add(const char *name, struct kobject *parent) | |||
683 | EXPORT_SYMBOL_GPL(kobject_create_and_add); | 686 | EXPORT_SYMBOL_GPL(kobject_create_and_add); |
684 | 687 | ||
685 | /** | 688 | /** |
686 | * kobject_kset_add_dir - add sub directory of object. | ||
687 | * @kset: kset the directory is belongs to. | ||
688 | * @parent: object in which a directory is created. | ||
689 | * @name: directory name. | ||
690 | * | ||
691 | * Add a plain directory object as child of given object. | ||
692 | */ | ||
693 | struct kobject *kobject_kset_add_dir(struct kset *kset, | ||
694 | struct kobject *parent, const char *name) | ||
695 | { | ||
696 | struct kobject *k; | ||
697 | int ret; | ||
698 | |||
699 | k = kobject_create(); | ||
700 | if (!k) | ||
701 | return NULL; | ||
702 | |||
703 | k->kset = kset; | ||
704 | ret = kobject_add_ng(k, parent, "%s", name); | ||
705 | if (ret < 0) { | ||
706 | printk(KERN_WARNING "%s: kobject_add error: %d\n", | ||
707 | __func__, ret); | ||
708 | kobject_put(k); | ||
709 | k = NULL; | ||
710 | } | ||
711 | |||
712 | return k; | ||
713 | } | ||
714 | |||
715 | /** | ||
716 | * kset_init - initialize a kset for use | 689 | * kset_init - initialize a kset for use |
717 | * @k: kset | 690 | * @k: kset |
718 | */ | 691 | */ |