Commit 22de7638 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] drivers_cdrom_cm206.c check_region() fix

From: Trivial Patch Monkey <trivial@rustcorp.com.au>

From:  Omkhar Arasaratnam <omkhar@rogers.com>

check_region() fix
parent 4e9fbe87
...@@ -1389,7 +1389,7 @@ static struct gendisk *cm206_gendisk; ...@@ -1389,7 +1389,7 @@ static struct gendisk *cm206_gendisk;
Linus says it is too dangerous to use writes for probing, so we Linus says it is too dangerous to use writes for probing, so we
stick with pure reads for a while. Hope that 8 possible ranges, stick with pure reads for a while. Hope that 8 possible ranges,
check_region, 15 bits of one port and 6 of another make things request_region, 15 bits of one port and 6 of another make things
likely enough to accept the region on the first hit... likely enough to accept the region on the first hit...
*/ */
int __init probe_base_port(int base) int __init probe_base_port(int base)
...@@ -1400,13 +1400,15 @@ int __init probe_base_port(int base) ...@@ -1400,13 +1400,15 @@ int __init probe_base_port(int base)
if (base) if (base)
b = e = base; b = e = base;
for (base = b; base <= e; base += 0x10) { for (base = b; base <= e; base += 0x10) {
if (check_region(base, 0x10)) if (!request_region(base, 0x10,"cm206"))
continue; continue;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
fool = inw(base + 2); /* empty possibly uart_receive_buffer */ fool = inw(base + 2); /* empty possibly uart_receive_buffer */
if ((inw(base + 6) & 0xffef) != 0x0001 || /* line_status */ if ((inw(base + 6) & 0xffef) != 0x0001 || /* line_status */
(inw(base) & 0xad00) != 0) /* data status */ (inw(base) & 0xad00) != 0) { /* data status */
release_region(base,0x10);
continue; continue;
}
return (base); return (base);
} }
return 0; return 0;
...@@ -1444,7 +1446,6 @@ int __init cm206_init(void) ...@@ -1444,7 +1446,6 @@ int __init cm206_init(void)
return -EIO; return -EIO;
} }
printk(" adapter at 0x%x", cm206_base); printk(" adapter at 0x%x", cm206_base);
request_region(cm206_base, 16, "cm206");
cd = (struct cm206_struct *) kmalloc(size, GFP_KERNEL); cd = (struct cm206_struct *) kmalloc(size, GFP_KERNEL);
if (!cd) if (!cd)
goto out_base; goto out_base;
......
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