Skip to content

Commit

Permalink
Kobject: convert mm/slub.c to use kobject_init/add_ng()
Browse files Browse the repository at this point in the history
This converts the code to use the new kobject functions, cleaning up the
logic in doing so.

Cc: Christoph Lameter <[email protected]>
Cc: Kay Sievers <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
gregkh committed Jan 25, 2008
1 parent cf15126 commit 1eada11
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -4025,13 +4025,12 @@ static int sysfs_slab_add(struct kmem_cache *s)
name = create_unique_id(s);
}

kobject_set_name(&s->kobj, name);
s->kobj.kset = slab_kset;
s->kobj.ktype = &slab_ktype;
kobject_init(&s->kobj);
err = kobject_add(&s->kobj);
if (err)
err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, name);
if (err) {
kobject_put(&s->kobj);
return err;
}

err = sysfs_create_group(&s->kobj, &slab_attr_group);
if (err)
Expand Down

0 comments on commit 1eada11

Please sign in to comment.