Commit c6a2a3dc authored by Robert P. J. Day's avatar Robert P. J. Day Committed by Greg Kroah-Hartman

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: default avatarRobert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c6f87733
...@@ -58,11 +58,6 @@ static int create_dir(struct kobject *kobj) ...@@ -58,11 +58,6 @@ static int create_dir(struct kobject *kobj)
return error; 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) static int get_kobj_path_length(struct kobject *kobj)
{ {
int length = 1; int length = 1;
...@@ -752,12 +747,11 @@ void kset_unregister(struct kset *k) ...@@ -752,12 +747,11 @@ void kset_unregister(struct kset *k)
*/ */
struct kobject *kset_find_obj(struct kset *kset, const char *name) struct kobject *kset_find_obj(struct kset *kset, const char *name)
{ {
struct list_head *entry; struct kobject *k;
struct kobject *ret = NULL; struct kobject *ret = NULL;
spin_lock(&kset->list_lock); spin_lock(&kset->list_lock);
list_for_each(entry, &kset->list) { list_for_each_entry(k, &kset->list, entry) {
struct kobject *k = to_kobj(entry);
if (kobject_name(k) && !strcmp(kobject_name(k), name)) { if (kobject_name(k) && !strcmp(kobject_name(k), name)) {
ret = kobject_get(k); ret = kobject_get(k);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment