Skip to content

Commit

Permalink
Kobject: Replace list_for_each() with list_for_each_entry().
Browse files Browse the repository at this point in the history
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 <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Robert P. J. Day authored and Greg Kroah-Hartman committed Apr 20, 2008
1 parent c6f8773 commit c6a2a3d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/kobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c6a2a3d

Please sign in to comment.