mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
Kobject: convert block/elevator.c to use kobject_init/add_ng()
This converts the code to use the new kobject functions, cleaning up the logic in doing so. Cc: Jens Axboe <axboe@kernel.dk> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
edfaa7c365
commit
29e3dd0df1
1 changed files with 2 additions and 6 deletions
|
@ -185,9 +185,7 @@ static elevator_t *elevator_alloc(struct request_queue *q,
|
||||||
|
|
||||||
eq->ops = &e->ops;
|
eq->ops = &e->ops;
|
||||||
eq->elevator_type = e;
|
eq->elevator_type = e;
|
||||||
kobject_init(&eq->kobj);
|
kobject_init_ng(&eq->kobj, &elv_ktype);
|
||||||
kobject_set_name(&eq->kobj, "%s", "iosched");
|
|
||||||
eq->kobj.ktype = &elv_ktype;
|
|
||||||
mutex_init(&eq->sysfs_lock);
|
mutex_init(&eq->sysfs_lock);
|
||||||
|
|
||||||
eq->hash = kmalloc_node(sizeof(struct hlist_head) * ELV_HASH_ENTRIES,
|
eq->hash = kmalloc_node(sizeof(struct hlist_head) * ELV_HASH_ENTRIES,
|
||||||
|
@ -931,9 +929,7 @@ int elv_register_queue(struct request_queue *q)
|
||||||
elevator_t *e = q->elevator;
|
elevator_t *e = q->elevator;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
e->kobj.parent = &q->kobj;
|
error = kobject_add_ng(&e->kobj, &q->kobj, "%s", "iosched");
|
||||||
|
|
||||||
error = kobject_add(&e->kobj);
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
struct elv_fs_entry *attr = e->elevator_type->elevator_attrs;
|
struct elv_fs_entry *attr = e->elevator_type->elevator_attrs;
|
||||||
if (attr) {
|
if (attr) {
|
||||||
|
|
Loading…
Reference in a new issue