Skip to content

Commit

Permalink
Kobject: convert block/elevator.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: Jens Axboe <[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 edfaa7c commit 29e3dd0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@ static elevator_t *elevator_alloc(struct request_queue *q,

eq->ops = &e->ops;
eq->elevator_type = e;
kobject_init(&eq->kobj);
kobject_set_name(&eq->kobj, "%s", "iosched");
eq->kobj.ktype = &elv_ktype;
kobject_init_ng(&eq->kobj, &elv_ktype);
mutex_init(&eq->sysfs_lock);

eq->hash = kmalloc_node(sizeof(struct hlist_head) * ELV_HASH_ENTRIES,
Expand Down Expand Up @@ -931,9 +929,7 @@ int elv_register_queue(struct request_queue *q)
elevator_t *e = q->elevator;
int error;

e->kobj.parent = &q->kobj;

error = kobject_add(&e->kobj);
error = kobject_add_ng(&e->kobj, &q->kobj, "%s", "iosched");
if (!error) {
struct elv_fs_entry *attr = e->elevator_type->elevator_attrs;
if (attr) {
Expand Down

0 comments on commit 29e3dd0

Please sign in to comment.