linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2.6 patch] let elv_register() return void
@ 2007-12-12 17:47 Adrian Bunk
  2007-12-12 17:54 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2007-12-12 17:47 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel

elv_register() always returns 0, and there isn't anything it does where 
it should return an error (the only error condition is so grave that 
it's handled with a BUG_ON).

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

 block/as-iosched.c       |    4 +++-
 block/cfq-iosched.c      |    8 ++------
 block/deadline-iosched.c |    4 +++-
 block/elevator.c         |    3 +--
 block/noop-iosched.c     |    4 +++-
 include/linux/elevator.h |    2 +-
 6 files changed, 13 insertions(+), 12 deletions(-)

9db70d828b748473c55e2b8f61f993feebd7144e 
diff --git a/block/as-iosched.c b/block/as-iosched.c
index dc715a5..46f56ce 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -1463,7 +1463,9 @@ static struct elevator_type iosched_as = {
 
 static int __init as_init(void)
 {
-	return elv_register(&iosched_as);
+	elv_register(&iosched_as);
+
+	return 0;
 }
 
 static void __exit as_exit(void)
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 0b4a479..13553e0 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2279,8 +2279,6 @@ static struct elevator_type iosched_cfq = {
 
 static int __init cfq_init(void)
 {
-	int ret;
-
 	/*
 	 * could be 0 on HZ < 1000 setups
 	 */
@@ -2292,11 +2290,9 @@ static int __init cfq_init(void)
 	if (cfq_slab_setup())
 		return -ENOMEM;
 
-	ret = elv_register(&iosched_cfq);
-	if (ret)
-		cfq_slab_kill();
+	elv_register(&iosched_cfq);
 
-	return ret;
+	return 0;
 }
 
 static void __exit cfq_exit(void)
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index a054eef..342448c 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -467,7 +467,9 @@ static struct elevator_type iosched_deadline = {
 
 static int __init deadline_init(void)
 {
-	return elv_register(&iosched_deadline);
+	elv_register(&iosched_deadline);
+
+	return 0;
 }
 
 static void __exit deadline_exit(void)
diff --git a/block/elevator.c b/block/elevator.c
index 446aea2..e452deb 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -960,7 +960,7 @@ void elv_unregister_queue(struct request_queue *q)
 		__elv_unregister_queue(q->elevator);
 }
 
-int elv_register(struct elevator_type *e)
+void elv_register(struct elevator_type *e)
 {
 	char *def = "";
 
@@ -975,7 +975,6 @@ int elv_register(struct elevator_type *e)
 				def = " (default)";
 
 	printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
-	return 0;
 }
 EXPORT_SYMBOL_GPL(elv_register);
 
diff --git a/block/noop-iosched.c b/block/noop-iosched.c
index 7563d8a..c23e029 100644
--- a/block/noop-iosched.c
+++ b/block/noop-iosched.c
@@ -101,7 +101,9 @@ static struct elevator_type elevator_noop = {
 
 static int __init noop_init(void)
 {
-	return elv_register(&elevator_noop);
+	elv_register(&elevator_noop);
+
+	return 0;
 }
 
 static void __exit noop_exit(void)
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index e8f4213..639624b 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -119,7 +119,7 @@ extern void elv_put_request(struct request_queue *, struct request *);
 /*
  * io scheduler registration
  */
-extern int elv_register(struct elevator_type *);
+extern void elv_register(struct elevator_type *);
 extern void elv_unregister(struct elevator_type *);
 
 /*


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [2.6 patch] let elv_register() return void
  2007-12-12 17:47 [2.6 patch] let elv_register() return void Adrian Bunk
@ 2007-12-12 17:54 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2007-12-12 17:54 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel

On Wed, Dec 12 2007, Adrian Bunk wrote:
> elv_register() always returns 0, and there isn't anything it does where 
> it should return an error (the only error condition is so grave that 
> it's handled with a BUG_ON).

Principally it could return -EEXIST for the BUG_ON(), but there's little
point. I've applied your patch, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-12 17:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-12 17:47 [2.6 patch] let elv_register() return void Adrian Bunk
2007-12-12 17:54 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).