Commit 67d70567 authored by William Stinson's avatar William Stinson Committed by Jeff Garzik

[janitor] request_region cleanups for mcd and mcdx ancient cd-rom drivers

parent 27b3f72f
...@@ -1069,7 +1069,7 @@ int __init mcd_init(void) ...@@ -1069,7 +1069,7 @@ int __init mcd_init(void)
printk(KERN_ERR "mcd: Unable to get major %d for Mitsumi CD-ROM\n", MAJOR_NR); printk(KERN_ERR "mcd: Unable to get major %d for Mitsumi CD-ROM\n", MAJOR_NR);
return -EIO; return -EIO;
} }
if (check_region(mcd_port, 4)) { if (!request_region(mcd_port, 4, "mcd")) {
cleanup(1); cleanup(1);
printk(KERN_ERR "mcd: Initialization failed, I/O port (%X) already in use\n", mcd_port); printk(KERN_ERR "mcd: Initialization failed, I/O port (%X) already in use\n", mcd_port);
return -EIO; return -EIO;
...@@ -1092,7 +1092,7 @@ int __init mcd_init(void) ...@@ -1092,7 +1092,7 @@ int __init mcd_init(void)
if (count >= 2000000) { if (count >= 2000000) {
printk(KERN_INFO "mcd: initialisation failed - No mcd device at 0x%x irq %d\n", printk(KERN_INFO "mcd: initialisation failed - No mcd device at 0x%x irq %d\n",
mcd_port, mcd_irq); mcd_port, mcd_irq);
cleanup(1); cleanup(2);
return -EIO; return -EIO;
} }
count = inb(MCDPORT(0)); /* pick up the status */ count = inb(MCDPORT(0)); /* pick up the status */
...@@ -1102,12 +1102,12 @@ int __init mcd_init(void) ...@@ -1102,12 +1102,12 @@ int __init mcd_init(void)
if (getValue(result + count)) { if (getValue(result + count)) {
printk(KERN_ERR "mcd: mitsumi get version failed at 0x%x\n", printk(KERN_ERR "mcd: mitsumi get version failed at 0x%x\n",
mcd_port); mcd_port);
cleanup(1); cleanup(2);
return -EIO; return -EIO;
} }
if (result[0] == result[1] && result[1] == result[2]) { if (result[0] == result[1] && result[1] == result[2]) {
cleanup(1); cleanup(2);
return -EIO; return -EIO;
} }
...@@ -1120,7 +1120,7 @@ int __init mcd_init(void) ...@@ -1120,7 +1120,7 @@ int __init mcd_init(void)
if (request_irq(mcd_irq, mcd_interrupt, SA_INTERRUPT, "Mitsumi CD", NULL)) { if (request_irq(mcd_irq, mcd_interrupt, SA_INTERRUPT, "Mitsumi CD", NULL)) {
printk(KERN_ERR "mcd: Unable to get IRQ%d for Mitsumi CD-ROM\n", mcd_irq); printk(KERN_ERR "mcd: Unable to get IRQ%d for Mitsumi CD-ROM\n", mcd_irq);
cleanup(1); cleanup(2);
return -EIO; return -EIO;
} }
...@@ -1134,8 +1134,6 @@ int __init mcd_init(void) ...@@ -1134,8 +1134,6 @@ int __init mcd_init(void)
" irq=%d\n", mcd_info.speed == 1 ? "Single" : "Double", " irq=%d\n", mcd_info.speed == 1 ? "Single" : "Double",
mcd_port, mcd_irq); mcd_port, mcd_irq);
request_region(mcd_port, 4, "mcd");
outb(MCMD_CONFIG_DRIVE, MCDPORT(0)); outb(MCMD_CONFIG_DRIVE, MCDPORT(0));
outb(0x02, MCDPORT(0)); outb(0x02, MCDPORT(0));
outb(0x00, MCDPORT(0)); outb(0x00, MCDPORT(0));
......
...@@ -1105,7 +1105,8 @@ int __init mcdx_init_drive(int drive) ...@@ -1105,7 +1105,8 @@ int __init mcdx_init_drive(int drive)
init_waitqueue_head(&stuffp->sleepq); init_waitqueue_head(&stuffp->sleepq);
/* check if i/o addresses are available */ /* check if i/o addresses are available */
if (check_region((unsigned int) stuffp->wreg_data, MCDX_IO_SIZE)) { if (!request_region((unsigned int) stuffp->wreg_data, MCDX_IO_SIZE,
"mcdx")) {
xwarn("0x%3p,%d: Init failed. " xwarn("0x%3p,%d: Init failed. "
"I/O ports (0x%3p..0x%3p) already in use.\n", "I/O ports (0x%3p..0x%3p) already in use.\n",
stuffp->wreg_data, stuffp->irq, stuffp->wreg_data, stuffp->irq,
...@@ -1125,6 +1126,8 @@ int __init mcdx_init_drive(int drive) ...@@ -1125,6 +1126,8 @@ int __init mcdx_init_drive(int drive)
xtrace(INIT, "init() get version\n"); xtrace(INIT, "init() get version\n");
if (-1 == mcdx_requestversion(stuffp, &version, 4)) { if (-1 == mcdx_requestversion(stuffp, &version, 4)) {
/* failed, next drive */ /* failed, next drive */
release_region((unsigned long) stuffp->wreg_data,
MCDX_IO_SIZE);
xwarn("%s=0x%3p,%d: Init failed. Can't get version.\n", xwarn("%s=0x%3p,%d: Init failed. Can't get version.\n",
MCDX, stuffp->wreg_data, stuffp->irq); MCDX, stuffp->wreg_data, stuffp->irq);
xtrace(MALLOC, "init() free stuffp @ %p\n", stuffp); xtrace(MALLOC, "init() free stuffp @ %p\n", stuffp);
...@@ -1154,6 +1157,8 @@ int __init mcdx_init_drive(int drive) ...@@ -1154,6 +1157,8 @@ int __init mcdx_init_drive(int drive)
stuffp->playcmd = READ1X; stuffp->playcmd = READ1X;
if (!stuffp->present) { if (!stuffp->present) {
release_region((unsigned long) stuffp->wreg_data,
MCDX_IO_SIZE);
xwarn("%s=0x%3p,%d: Init failed. No Mitsumi CD-ROM?.\n", xwarn("%s=0x%3p,%d: Init failed. No Mitsumi CD-ROM?.\n",
MCDX, stuffp->wreg_data, stuffp->irq); MCDX, stuffp->wreg_data, stuffp->irq);
kfree(stuffp); kfree(stuffp);
...@@ -1162,6 +1167,8 @@ int __init mcdx_init_drive(int drive) ...@@ -1162,6 +1167,8 @@ int __init mcdx_init_drive(int drive)
xtrace(INIT, "init() register blkdev\n"); xtrace(INIT, "init() register blkdev\n");
if (devfs_register_blkdev(MAJOR_NR, "mcdx", &mcdx_bdops) != 0) { if (devfs_register_blkdev(MAJOR_NR, "mcdx", &mcdx_bdops) != 0) {
release_region((unsigned long) stuffp->wreg_data,
MCDX_IO_SIZE);
xwarn("%s=0x%3p,%d: Init failed. Can't get major %d.\n", xwarn("%s=0x%3p,%d: Init failed. Can't get major %d.\n",
MCDX, stuffp->wreg_data, stuffp->irq, MAJOR_NR); MCDX, stuffp->wreg_data, stuffp->irq, MAJOR_NR);
kfree(stuffp); kfree(stuffp);
...@@ -1174,6 +1181,8 @@ int __init mcdx_init_drive(int drive) ...@@ -1174,6 +1181,8 @@ int __init mcdx_init_drive(int drive)
xtrace(INIT, "init() subscribe irq and i/o\n"); xtrace(INIT, "init() subscribe irq and i/o\n");
mcdx_irq_map[stuffp->irq] = stuffp; mcdx_irq_map[stuffp->irq] = stuffp;
if (request_irq(stuffp->irq, mcdx_intr, SA_INTERRUPT, "mcdx", NULL)) { if (request_irq(stuffp->irq, mcdx_intr, SA_INTERRUPT, "mcdx", NULL)) {
release_region((unsigned long) stuffp->wreg_data,
MCDX_IO_SIZE);
xwarn("%s=0x%3p,%d: Init failed. Can't get irq (%d).\n", xwarn("%s=0x%3p,%d: Init failed. Can't get irq (%d).\n",
MCDX, stuffp->wreg_data, stuffp->irq, stuffp->irq); MCDX, stuffp->wreg_data, stuffp->irq, stuffp->irq);
stuffp->irq = 0; stuffp->irq = 0;
...@@ -1181,8 +1190,6 @@ int __init mcdx_init_drive(int drive) ...@@ -1181,8 +1190,6 @@ int __init mcdx_init_drive(int drive)
kfree(stuffp); kfree(stuffp);
return 0; return 0;
} }
request_region((unsigned int) stuffp->wreg_data,
MCDX_IO_SIZE, "mcdx");
xtrace(INIT, "init() get garbage\n"); xtrace(INIT, "init() get garbage\n");
{ {
......
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