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