Skip to content

Commit

Permalink
Kobject: convert kernel/user.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: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
gregkh committed Jan 25, 2008
1 parent e43b919 commit cf15126
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kernel/user.c
Expand Up @@ -181,13 +181,12 @@ static int uids_user_create(struct user_struct *up)
int error;

memset(kobj, 0, sizeof(struct kobject));
kobj->ktype = &uids_ktype;
kobj->kset = uids_kset;
kobject_init(kobj);
kobject_set_name(&up->kobj, "%d", up->uid);
error = kobject_add(kobj);
if (error)
error = kobject_init_and_add(kobj, &uids_ktype, NULL, "%d", up->uid);
if (error) {
kobject_put(kobj);
goto done;
}

kobject_uevent(kobj, KOBJ_ADD);
done:
Expand Down

0 comments on commit cf15126

Please sign in to comment.