Commit 9dfdc016 authored by Dave Jones's avatar Dave Jones

[PATCH] Cyclades driver region cleanup

parent a1146f52
...@@ -4965,6 +4965,8 @@ cy_detect_pci(void) ...@@ -4965,6 +4965,8 @@ cy_detect_pci(void)
uclong Ze_addr0[NR_CARDS], Ze_addr2[NR_CARDS], ZeIndex = 0; uclong Ze_addr0[NR_CARDS], Ze_addr2[NR_CARDS], ZeIndex = 0;
uclong Ze_phys0[NR_CARDS], Ze_phys2[NR_CARDS]; uclong Ze_phys0[NR_CARDS], Ze_phys2[NR_CARDS];
unsigned char Ze_irq[NR_CARDS]; unsigned char Ze_irq[NR_CARDS];
struct resource *resource;
unsigned long res_start, res_len;
for (i = 0; i < NR_CARDS; i++) { for (i = 0; i < NR_CARDS; i++) {
/* look for a Cyclades card by vendor and device id */ /* look for a Cyclades card by vendor and device id */
...@@ -5012,7 +5014,15 @@ cy_detect_pci(void) ...@@ -5012,7 +5014,15 @@ cy_detect_pci(void)
/* Although we don't use this I/O region, we should /* Although we don't use this I/O region, we should
request it from the kernel anyway, to avoid problems request it from the kernel anyway, to avoid problems
with other drivers accessing it. */ with other drivers accessing it. */
request_region(cy_pci_phys1, CyPCI_Yctl, "Cyclom-Y"); resource = request_region(cy_pci_phys1,
CyPCI_Yctl, "Cyclom-Y");
if (resource == NULL) {
printk(KERN_ERR "cyclades: failed to allocate IO "
"resource at 0x%lx\n", cy_pci_phys1);
continue;
}
res_start = cy_pci_phys1;
res_len = CyPCI_Yctl;
#if defined(__alpha__) #if defined(__alpha__)
if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo) { /* below 1M? */ if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo) { /* below 1M? */
...@@ -5083,7 +5093,11 @@ cy_detect_pci(void) ...@@ -5083,7 +5093,11 @@ cy_detect_pci(void)
cy_card[j].bus_index = 1; cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel; cy_card[j].first_line = cy_next_channel;
cy_card[j].num_chips = cy_pci_nchan/4; cy_card[j].num_chips = cy_pci_nchan/4;
cy_card[j].resource = resource;
cy_card[j].res_start = res_start;
cy_card[j].res_len = res_len;
resource = NULL; /* For next card */
/* enable interrupts in the PCI interface */ /* enable interrupts in the PCI interface */
plx_ver = cy_readb(cy_pci_addr2 + CyPLX_VER) & 0x0f; plx_ver = cy_readb(cy_pci_addr2 + CyPLX_VER) & 0x0f;
switch (plx_ver) { switch (plx_ver) {
...@@ -5162,8 +5176,16 @@ cy_detect_pci(void) ...@@ -5162,8 +5176,16 @@ cy_detect_pci(void)
/* Although we don't use this I/O region, we should /* Although we don't use this I/O region, we should
request it from the kernel anyway, to avoid problems request it from the kernel anyway, to avoid problems
with other drivers accessing it. */ with other drivers accessing it. */
request_region(cy_pci_phys1, CyPCI_Zctl, "Cyclades-Z"); resource = request_region(cy_pci_phys1,
CyPCI_Zctl, "Cyclades-Z");
if (resource == NULL) {
printk(KERN_ERR "cyclades: failed ot allocate IO resource "
"at 0x%lx\n", cy_pci_phys1);
continue;
}
res_start = cy_pci_phys1;
res_len = CyPCI_Zctl;
if (mailbox == ZE_V1) { if (mailbox == ZE_V1) {
cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ze_win); cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ze_win);
if (ZeIndex == NR_CARDS) { if (ZeIndex == NR_CARDS) {
...@@ -5261,6 +5283,10 @@ cy_detect_pci(void) ...@@ -5261,6 +5283,10 @@ cy_detect_pci(void)
cy_card[j].bus_index = 1; cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel; cy_card[j].first_line = cy_next_channel;
cy_card[j].num_chips = -1; cy_card[j].num_chips = -1;
cy_card[j].resource = resource;
cy_card[j].res_start = res_start;
cy_card[j].res_len = res_len;
resource = NULL; /* For next card */
/* print message */ /* print message */
#ifdef CONFIG_CYZ_INTR #ifdef CONFIG_CYZ_INTR
...@@ -5279,7 +5305,7 @@ cy_detect_pci(void) ...@@ -5279,7 +5305,7 @@ cy_detect_pci(void)
printk("%d channels starting from port %d.\n", printk("%d channels starting from port %d.\n",
cy_pci_nchan,cy_next_channel); cy_pci_nchan,cy_next_channel);
cy_next_channel += cy_pci_nchan; cy_next_channel += cy_pci_nchan;
} }
} }
for (; ZeIndex != 0 && i < NR_CARDS; i++) { for (; ZeIndex != 0 && i < NR_CARDS; i++) {
...@@ -5787,6 +5813,8 @@ cy_cleanup_module(void) ...@@ -5787,6 +5813,8 @@ cy_cleanup_module(void)
#endif /* CONFIG_CYZ_INTR */ #endif /* CONFIG_CYZ_INTR */
) )
free_irq(cy_card[i].irq, &cy_card[i]); free_irq(cy_card[i].irq, &cy_card[i]);
if (cy_card[i].resource)
release_region(cy_card[i].res_start, cy_card[i].res_len);
} }
} }
if (tmp_buf) { if (tmp_buf) {
......
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