* [PATCH] pd.c: blk_init_queue() changes
@ 2003-08-15 15:26 Eduardo Pereira Habkost
0 siblings, 0 replies; only message in thread
From: Eduardo Pereira Habkost @ 2003-08-15 15:26 UTC (permalink / raw)
To: tim; +Cc: grant, linux-kernel
[-- 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 --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-08-15 16:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-15 15:26 [PATCH] pd.c: blk_init_queue() changes Eduardo Pereira Habkost
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®