aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:49:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:49:58 -0400
commite80ab411e589e00550e2e6e5a6a02d59cc730357 (patch)
tree870225ff7b5b8d03e82a996963213a4bb9cce248 /lib
parent529a41e36673b518c9e091f3a8d932b6b9e3c461 (diff)
parentee959b00c335d7780136c5abda37809191fe52c3 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (36 commits) SCSI: convert struct class_device to struct device DRM: remove unused dev_class IB: rename "dev" to "srp_dev" in srp_host structure IB: convert struct class_device to struct device memstick: convert struct class_device to struct device driver core: replace remaining __FUNCTION__ occurrences sysfs: refill attribute buffer when reading from offset 0 PM: Remove destroy_suspended_device() Firmware: add iSCSI iBFT Support PM: Remove legacy PM (fix) Kobject: Replace list_for_each() with list_for_each_entry(). SYSFS: Explicitly include required header file slab.h. Driver core: make device_is_registered() work for class devices PM: Convert wakeup flag accessors to inline functions PM: Make wakeup flags available whenever CONFIG_PM is set PM: Fix misuse of wakeup flag accessors in serial core Driver core: Call device_pm_add() after bus_add_device() in device_add() PM: Handle device registrations during suspend/resume block: send disk "change" event for rescan_partitions() sysdev: detect multiple driver registrations ... Fixed trivial conflict in include/linux/memory.h due to semaphore header file change (made irrelevant by the change to mutex).
Diffstat (limited to 'lib')
-rw-r--r--lib/kobject.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index 0d03252f87a8..2c6490370922 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -58,11 +58,6 @@ static int create_dir(struct kobject *kobj)
58 return error; 58 return error;
59} 59}
60 60
61static inline struct kobject *to_kobj(struct list_head *entry)
62{
63 return container_of(entry, struct kobject, entry);
64}
65
66static int get_kobj_path_length(struct kobject *kobj) 61static int get_kobj_path_length(struct kobject *kobj)
67{ 62{
68 int length = 1; 63 int length = 1;
@@ -592,8 +587,15 @@ static void kobject_release(struct kref *kref)
592 */ 587 */
593void kobject_put(struct kobject *kobj) 588void kobject_put(struct kobject *kobj)
594{ 589{
595 if (kobj) 590 if (kobj) {
591 if (!kobj->state_initialized) {
592 printk(KERN_WARNING "kobject: '%s' (%p): is not "
593 "initialized, yet kobject_put() is being "
594 "called.\n", kobject_name(kobj), kobj);
595 WARN_ON(1);
596 }
596 kref_put(&kobj->kref, kobject_release); 597 kref_put(&kobj->kref, kobject_release);
598 }
597} 599}
598 600
599static void dynamic_kobj_release(struct kobject *kobj) 601static void dynamic_kobj_release(struct kobject *kobj)
@@ -745,12 +747,11 @@ void kset_unregister(struct kset *k)
745 */ 747 */
746struct kobject *kset_find_obj(struct kset *kset, const char *name) 748struct kobject *kset_find_obj(struct kset *kset, const char *name)
747{ 749{
748 struct list_head *entry; 750 struct kobject *k;
749 struct kobject *ret = NULL; 751 struct kobject *ret = NULL;
750 752
751 spin_lock(&kset->list_lock); 753 spin_lock(&kset->list_lock);
752 list_for_each(entry, &kset->list) { 754 list_for_each_entry(k, &kset->list, entry) {
753 struct kobject *k = to_kobj(entry);
754 if (kobject_name(k) && !strcmp(kobject_name(k), name)) { 755 if (kobject_name(k) && !strcmp(kobject_name(k), name)) {
755 ret = kobject_get(k); 756 ret = kobject_get(k);
756 break; 757 break;