Commit 4ece0843 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] net_pcnet32.c remove check_region

From:  Marcus Alanen <maalanen@ra.abo.fi>
parent 8ecf6d1a
...@@ -468,10 +468,13 @@ pcnet32_probe_vlbus(void) ...@@ -468,10 +468,13 @@ pcnet32_probe_vlbus(void)
/* search for PCnet32 VLB cards at known addresses */ /* search for PCnet32 VLB cards at known addresses */
for (port = pcnet32_portlist; (ioaddr = *port); port++) { for (port = pcnet32_portlist; (ioaddr = *port); port++) {
if (!check_region(ioaddr, PCNET32_TOTAL_SIZE)) { if (request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_vlbus")) {
/* check if there is really a pcnet chip on that ioaddr */ /* check if there is really a pcnet chip on that ioaddr */
if ((inb(ioaddr + 14) == 0x57) && (inb(ioaddr + 15) == 0x57)) if ((inb(ioaddr + 14) == 0x57) && (inb(ioaddr + 15) == 0x57)) {
pcnet32_probe1(ioaddr, 0, 0, NULL); pcnet32_probe1(ioaddr, 0, 0, NULL);
} else {
release_region(ioaddr, PCNET32_TOTAL_SIZE);
}
} }
} }
} }
...@@ -500,6 +503,10 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -500,6 +503,10 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
printk(KERN_ERR PFX "architecture does not support 32bit PCI busmaster DMA\n"); printk(KERN_ERR PFX "architecture does not support 32bit PCI busmaster DMA\n");
return -ENODEV; return -ENODEV;
} }
if (request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci") == NULL) {
printk(KERN_ERR PFX "io address range already allocated\n");
return -EBUSY;
}
return pcnet32_probe1(ioaddr, pdev->irq, 1, pdev); return pcnet32_probe1(ioaddr, pdev->irq, 1, pdev);
} }
...@@ -533,15 +540,19 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared, ...@@ -533,15 +540,19 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
pcnet32_dwio_reset(ioaddr); pcnet32_dwio_reset(ioaddr);
if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 && pcnet32_dwio_check(ioaddr)) { if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 && pcnet32_dwio_check(ioaddr)) {
a = &pcnet32_dwio; a = &pcnet32_dwio;
} else } else {
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENODEV; return -ENODEV;
} }
}
chip_version = a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr,89) << 16); chip_version = a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr,89) << 16);
if (pcnet32_debug > 2) if (pcnet32_debug > 2)
printk(KERN_INFO " PCnet chip version is %#x.\n", chip_version); printk(KERN_INFO " PCnet chip version is %#x.\n", chip_version);
if ((chip_version & 0xfff) != 0x003) if ((chip_version & 0xfff) != 0x003) {
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENODEV; return -ENODEV;
}
/* initialize variables */ /* initialize variables */
fdx = mii = fset = dxsuflo = ltint = 0; fdx = mii = fset = dxsuflo = ltint = 0;
...@@ -603,6 +614,7 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared, ...@@ -603,6 +614,7 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
default: default:
printk(KERN_INFO PFX "PCnet version %#x, no PCnet32 chip.\n", printk(KERN_INFO PFX "PCnet version %#x, no PCnet32 chip.\n",
chip_version); chip_version);
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENODEV; return -ENODEV;
} }
...@@ -622,8 +634,10 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared, ...@@ -622,8 +634,10 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
} }
dev = alloc_etherdev(0); dev = alloc_etherdev(0);
if(!dev) if(!dev) {
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENOMEM; return -ENOMEM;
}
printk(KERN_INFO PFX "%s at %#3lx,", chipname, ioaddr); printk(KERN_INFO PFX "%s at %#3lx,", chipname, ioaddr);
...@@ -691,9 +705,6 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared, ...@@ -691,9 +705,6 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
} }
dev->base_addr = ioaddr; dev->base_addr = ioaddr;
if (request_region(ioaddr, PCNET32_TOTAL_SIZE, chipname) == NULL)
return -EBUSY;
/* pci_alloc_consistent returns page-aligned memory, so we do not have to check the alignment */ /* pci_alloc_consistent returns page-aligned memory, so we do not have to check the alignment */
if ((lp = pci_alloc_consistent(pdev, sizeof(*lp), &lp_dma_addr)) == NULL) { if ((lp = pci_alloc_consistent(pdev, sizeof(*lp), &lp_dma_addr)) == NULL) {
release_region(ioaddr, PCNET32_TOTAL_SIZE); release_region(ioaddr, PCNET32_TOTAL_SIZE);
......
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