From: Robert P. J. Day Date: Thu, 27 Mar 2008 05:13:34 +0000 (-0400) Subject: Kobject: Replace list_for_each() with list_for_each_entry(). X-Git-Tag: v2.6.26-rc1~1126^2~10 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6a2a3dc26da72e431c293d02549593f9c041f63;p=linux-2.6 Kobject: Replace list_for_each() with list_for_each_entry(). Use the more concise list_for_each_entry(), which allows for the deletion of the to_kobj() routine at the same time. Signed-off-by: Robert P. J. Day Signed-off-by: Greg Kroah-Hartman --- diff --git a/lib/kobject.c b/lib/kobject.c index 60ae9e8176..2c64903709 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -58,11 +58,6 @@ static int create_dir(struct kobject *kobj) return error; } -static inline struct kobject *to_kobj(struct list_head *entry) -{ - return container_of(entry, struct kobject, entry); -} - static int get_kobj_path_length(struct kobject *kobj) { int length = 1; @@ -752,12 +747,11 @@ void kset_unregister(struct kset *k) */ struct kobject *kset_find_obj(struct kset *kset, const char *name) { - struct list_head *entry; + struct kobject *k; struct kobject *ret = NULL; spin_lock(&kset->list_lock); - list_for_each(entry, &kset->list) { - struct kobject *k = to_kobj(entry); + list_for_each_entry(k, &kset->list, entry) { if (kobject_name(k) && !strcmp(kobject_name(k), name)) { ret = kobject_get(k); break;