Commit e8baf864 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] killed check_region() in ixj

Killed check_region(), fixed an old bug in ISA case (we checked the wrong
region before claiming the right one - dumb typo back in 2.4.early)
parent 6b6030a0
...@@ -7718,6 +7718,23 @@ static void __exit ixj_exit(void) ...@@ -7718,6 +7718,23 @@ static void __exit ixj_exit(void)
cleanup(); cleanup();
} }
static IXJ *new_ixj(unsigned long port)
{
IXJ *res;
if (!request_region(port, 16, "ixj DSP")) {
printk(KERN_INFO "ixj: can't get I/O address 0x%lx\n", port);
return NULL;
}
res = ixj_alloc();
if (!res) {
release_region(port, 16);
printk(KERN_INFO "ixj: out of memory\n");
return NULL;
}
res->DSPbase = port;
return res;
}
int __init ixj_probe_isapnp(int *cnt) int __init ixj_probe_isapnp(int *cnt)
{ {
int probe = 0; int probe = 0;
...@@ -7750,15 +7767,9 @@ int __init ixj_probe_isapnp(int *cnt) ...@@ -7750,15 +7767,9 @@ int __init ixj_probe_isapnp(int *cnt)
return -ENODEV; return -ENODEV;
} }
result = check_region(pnp_port_start(dev, 0), 16); j = new_ixj(pnp_port_start(dev, 0));
if (result) { if (!j)
printk(KERN_INFO "ixj: can't get I/O address 0x%lx\n", pnp_port_start(dev, 0));
break; break;
}
j = ixj_alloc();
j->DSPbase = pnp_port_start(dev,0);
request_region(j->DSPbase, 16, "ixj DSP");
if (func != 0x110) if (func != 0x110)
j->XILINXbase = pnp_port_start(dev, 1); /* get real port */ j->XILINXbase = pnp_port_start(dev, 1); /* get real port */
...@@ -7806,22 +7817,15 @@ int __init ixj_probe_isapnp(int *cnt) ...@@ -7806,22 +7817,15 @@ int __init ixj_probe_isapnp(int *cnt)
int __init ixj_probe_isa(int *cnt) int __init ixj_probe_isa(int *cnt)
{ {
int i, result, probe; int i, probe;
/* Use passed parameters for older kernels without PnP */ /* Use passed parameters for older kernels without PnP */
for (i = 0; i < IXJMAX; i++) { for (i = 0; i < IXJMAX; i++) {
if (dspio[i]) { if (dspio[i]) {
IXJ *j; IXJ *j = new_ixj(dspio[i]);
if ((result = check_region(ixj[*cnt].DSPbase, 16)) < 0) { if (!j)
printk(KERN_INFO "ixj: can't get I/O address 0x%x\n", ixj[*cnt].DSPbase);
break; break;
}
j = ixj_alloc();
j->DSPbase = dspio[i];
request_region(j->DSPbase, 16, "ixj DSP");
j->XILINXbase = xio[i]; j->XILINXbase = xio[i];
j->cardtype = 0; j->cardtype = 0;
...@@ -7840,7 +7844,6 @@ int __init ixj_probe_pci(int *cnt) ...@@ -7840,7 +7844,6 @@ int __init ixj_probe_pci(int *cnt)
struct pci_dev *pci = NULL; struct pci_dev *pci = NULL;
int i, probe = 0; int i, probe = 0;
IXJ *j = NULL; IXJ *j = NULL;
int result;
for (i = 0; i < IXJMAX - *cnt; i++) { for (i = 0; i < IXJMAX - *cnt; i++) {
pci = pci_find_device(0x15E2, 0x0500, pci); pci = pci_find_device(0x15E2, 0x0500, pci);
...@@ -7849,20 +7852,12 @@ int __init ixj_probe_pci(int *cnt) ...@@ -7849,20 +7852,12 @@ int __init ixj_probe_pci(int *cnt)
if (pci_enable_device(pci)) if (pci_enable_device(pci))
break; break;
if ((result = check_region(pci_resource_start(pci, 0), 16)) < 0) { j = new_ixj(pci_resource_start(pci, 0));
printk(KERN_INFO "ixj: can't get I/O address\n"); if (!j)
break; break;
}
/* Grab a device slot */
j = ixj_alloc();
if(j == NULL)
break;
j->DSPbase = pci_resource_start(pci, 0);
j->serial = (PCIEE_GetSerialNumber)pci_resource_start(pci, 2); j->serial = (PCIEE_GetSerialNumber)pci_resource_start(pci, 2);
j->XILINXbase = j->DSPbase + 0x10; j->XILINXbase = j->DSPbase + 0x10;
request_region(j->DSPbase, 16, "ixj DSP");
j->cardtype = QTI_PHONEJACK_PCI; j->cardtype = QTI_PHONEJACK_PCI;
j->board = *cnt; j->board = *cnt;
probe = ixj_selfprobe(j); probe = ixj_selfprobe(j);
......
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