From: Eduardo Pereira Habkost <ehabkost@conectiva.com.br>
To: tim@cyberelk.net
Cc: grant@torque.net, linux-kernel@vger.kernel.org
Subject: [PATCH] pd.c: blk_init_queue() changes
Date: Fri, 15 Aug 2003 12:26:50 -0300 [thread overview]
Message-ID: <20030815152650.GR1685@duckman.distro.conectiva> (raw)
[-- Attachment #1: Type: text/plain, Size: 2148 bytes --]
The following patch against 2.6-bk changes pd.c to the new
blk_init_queue()/blk_cleanup_queue() interface, and makes the error
handling on pd_init() cleaner.
Without these changes, pd.c is unable to compile.
--
Eduardo
diff -Nru a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
--- a/drivers/block/paride/pd.c Fri Aug 15 12:15:46 2003
+++ b/drivers/block/paride/pd.c Fri Aug 15 12:15:46 2003
@@ -654,7 +654,7 @@
return pd_identify(disk);
}
-static struct request_queue pd_queue;
+static struct request_queue *pd_queue;
static int pd_detect(void)
{
@@ -704,7 +704,7 @@
set_capacity(p, disk->capacity);
disk->gd = p;
p->private_data = disk;
- p->queue = &pd_queue;
+ p->queue = pd_queue;
add_disk(p);
}
}
@@ -782,7 +782,7 @@
spin_lock_irqsave(&pd_lock, saved_flags);
end_request(pd_req, success);
pd_busy = 0;
- do_pd_request(&pd_queue);
+ do_pd_request(pd_queue);
spin_unlock_irqrestore(&pd_lock, saved_flags);
}
@@ -888,22 +888,37 @@
static int __init pd_init(void)
{
+ int ret = -EINVAL;
if (disable)
- return -1;
- if (register_blkdev(major, name))
- return -1;
+ goto err;
- blk_init_queue(&pd_queue, do_pd_request, &pd_lock);
- blk_queue_max_sectors(&pd_queue, cluster);
+ ret = register_blkdev(major, name);
+ if (ret < 0)
+ goto err;
+
+
+ pd_queue = blk_init_queue(do_pd_request, &pd_lock);
+ if (!pd_queue) {
+ ret = -ENOMEM;
+ goto err_unregister;
+ }
+ blk_queue_max_sectors(pd_queue, cluster);
printk("%s: %s version %s, major %d, cluster %d, nice %d\n",
name, name, PD_VERSION, major, cluster, nice);
pd_init_units();
if (!pd_detect()) {
- unregister_blkdev(major, name);
- return -1;
+ ret = -ENODEV;
+ goto err_freequeue;
}
return 0;
+
+err_freequeue:
+ blk_cleanup_queue(pd_queue);
+err_unregister:
+ unregister_blkdev(major, name);
+err:
+ return ret;
}
static void __exit pd_exit(void)
@@ -920,7 +935,7 @@
pi_release(disk->pi);
}
}
- blk_cleanup_queue(&pd_queue);
+ blk_cleanup_queue(pd_queue);
}
MODULE_LICENSE("GPL");
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
reply other threads:[~2003-08-15 16:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030815152650.GR1685@duckman.distro.conectiva \
--to=ehabkost@conectiva.com.br \
--cc=grant@torque.net \
--cc=linux-kernel@vger.kernel.org \
--cc=tim@cyberelk.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®