diff options
author | Tejun Heo <tj@kernel.org> | 2012-03-05 16:14:57 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-06 15:27:21 -0500 |
commit | b2fab5acd28ead6f0dd6c3996ba23f0ef1772f15 (patch) | |
tree | b0b96984e1a4d9c856edc9ddfc36e427951c5a86 /block/elevator.c | |
parent | 5a5bafdc396b1da7570f84fb96a0f8a288970c5e (diff) |
elevator: make elevator_init_fn() return 0/-errno
elevator_ops->elevator_init_fn() has a weird return value. It returns
a void * which the caller should assign to q->elevator->elevator_data
and %NULL return denotes init failure.
Update such that it returns integer 0/-errno and sets elevator_data
directly as necessary.
This makes the interface more conventional and eases further cleanup.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/elevator.c')
-rw-r--r-- | block/elevator.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/block/elevator.c b/block/elevator.c index f8c08e1bff2b..f81c061dad15 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -121,14 +121,6 @@ static struct elevator_type *elevator_get(const char *name) | |||
121 | return e; | 121 | return e; |
122 | } | 122 | } |
123 | 123 | ||
124 | static int elevator_init_queue(struct request_queue *q) | ||
125 | { | ||
126 | q->elevator->elevator_data = q->elevator->type->ops.elevator_init_fn(q); | ||
127 | if (q->elevator->elevator_data) | ||
128 | return 0; | ||
129 | return -ENOMEM; | ||
130 | } | ||
131 | |||
132 | static char chosen_elevator[ELV_NAME_MAX]; | 124 | static char chosen_elevator[ELV_NAME_MAX]; |
133 | 125 | ||
134 | static int __init elevator_setup(char *str) | 126 | static int __init elevator_setup(char *str) |
@@ -224,7 +216,7 @@ int elevator_init(struct request_queue *q, char *name) | |||
224 | if (!q->elevator) | 216 | if (!q->elevator) |
225 | return -ENOMEM; | 217 | return -ENOMEM; |
226 | 218 | ||
227 | err = elevator_init_queue(q); | 219 | err = e->ops.elevator_init_fn(q); |
228 | if (err) { | 220 | if (err) { |
229 | kobject_put(&q->elevator->kobj); | 221 | kobject_put(&q->elevator->kobj); |
230 | return err; | 222 | return err; |
@@ -927,7 +919,7 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) | |||
927 | if (!q->elevator) | 919 | if (!q->elevator) |
928 | goto fail_init; | 920 | goto fail_init; |
929 | 921 | ||
930 | err = elevator_init_queue(q); | 922 | err = new_e->ops.elevator_init_fn(q); |
931 | if (err) { | 923 | if (err) { |
932 | kobject_put(&q->elevator->kobj); | 924 | kobject_put(&q->elevator->kobj); |
933 | goto fail_init; | 925 | goto fail_init; |