Commit 27b3f72f authored by William Stinson's avatar William Stinson Committed by Jeff Garzik

[janitor] update the optcd Optics Storage 8000 AT CDROM driver

        1) remove call to check_region 
        2) check the status of call to request_region 
        3) and return an error in case of problem.
parent 95101bcf
...@@ -2008,7 +2008,7 @@ int __init optcd_init(void) ...@@ -2008,7 +2008,7 @@ int __init optcd_init(void)
"optcd: no Optics Storage CDROM Initialization\n"); "optcd: no Optics Storage CDROM Initialization\n");
return -EIO; return -EIO;
} }
if (check_region(optcd_port, 4)) { if (!request_region(optcd_port, 4, "optcd")) {
printk(KERN_ERR "optcd: conflict, I/O port 0x%x already used\n", printk(KERN_ERR "optcd: conflict, I/O port 0x%x already used\n",
optcd_port); optcd_port);
return -EIO; return -EIO;
...@@ -2016,21 +2016,25 @@ int __init optcd_init(void) ...@@ -2016,21 +2016,25 @@ int __init optcd_init(void)
if (!reset_drive()) { if (!reset_drive()) {
printk(KERN_ERR "optcd: drive at 0x%x not ready\n", optcd_port); printk(KERN_ERR "optcd: drive at 0x%x not ready\n", optcd_port);
release_region(optcd_port, 4);
return -EIO; return -EIO;
} }
if (!version_ok()) { if (!version_ok()) {
printk(KERN_ERR "optcd: unknown drive detected; aborting\n"); printk(KERN_ERR "optcd: unknown drive detected; aborting\n");
release_region(optcd_port, 4);
return -EIO; return -EIO;
} }
status = exec_cmd(COMINITDOUBLE); status = exec_cmd(COMINITDOUBLE);
if (status < 0) { if (status < 0) {
printk(KERN_ERR "optcd: cannot init double speed mode\n"); printk(KERN_ERR "optcd: cannot init double speed mode\n");
release_region(optcd_port, 4);
DEBUG((DEBUG_VFS, "exec_cmd COMINITDOUBLE: %02x", -status)); DEBUG((DEBUG_VFS, "exec_cmd COMINITDOUBLE: %02x", -status));
return -EIO; return -EIO;
} }
if (devfs_register_blkdev(MAJOR_NR, "optcd", &opt_fops) != 0) if (devfs_register_blkdev(MAJOR_NR, "optcd", &opt_fops) != 0)
{ {
printk(KERN_ERR "optcd: unable to get major %d\n", MAJOR_NR); printk(KERN_ERR "optcd: unable to get major %d\n", MAJOR_NR);
release_region(optcd_port, 4);
return -EIO; return -EIO;
} }
devfs_register (NULL, "optcd", DEVFS_FL_DEFAULT, MAJOR_NR, 0, devfs_register (NULL, "optcd", DEVFS_FL_DEFAULT, MAJOR_NR, 0,
...@@ -2038,7 +2042,6 @@ int __init optcd_init(void) ...@@ -2038,7 +2042,6 @@ int __init optcd_init(void)
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_optcd_request, blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_optcd_request,
&optcd_lock); &optcd_lock);
blk_queue_hardsect_size(BLK_DEFAULT_QUEUE(MAJOR_NR), 2048); blk_queue_hardsect_size(BLK_DEFAULT_QUEUE(MAJOR_NR), 2048);
request_region(optcd_port, 4, "optcd");
register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &opt_fops, 0); register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &opt_fops, 0);
printk(KERN_INFO "optcd: DOLPHIN 8000 AT CDROM at 0x%x\n", optcd_port); printk(KERN_INFO "optcd: DOLPHIN 8000 AT CDROM at 0x%x\n", optcd_port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment