patch-2.4.18 linux/drivers/char/cyclades.c
Next file: linux/drivers/char/drm/Config.in
Previous file: linux/drivers/char/agp/agpgart_be.c
Back to the patch index
Back to the overall index
- Lines: 112
- Date:
Tue Jan 8 16:18:53 2002
- Orig file:
linux.orig/drivers/char/cyclades.c
- Orig date:
Mon Feb 18 20:18:39 2002
diff -Naur -X /home/marcelo/lib/dontdiff linux.orig/drivers/char/cyclades.c linux/drivers/char/cyclades.c
@@ -4965,6 +4965,8 @@
uclong Ze_addr0[NR_CARDS], Ze_addr2[NR_CARDS], ZeIndex = 0;
uclong Ze_phys0[NR_CARDS], Ze_phys2[NR_CARDS];
unsigned char Ze_irq[NR_CARDS];
+ struct resource *resource;
+ unsigned long res_start, res_len;
for (i = 0; i < NR_CARDS; i++) {
/* look for a Cyclades card by vendor and device id */
@@ -4992,8 +4994,8 @@
device_id &= ~PCI_DEVICE_ID_MASK;
- if ((device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo)
- || (device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi)){
+ if ((device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo)
+ || (device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi)){
#ifdef CY_PCI_DEBUG
printk("Cyclom-Y/PCI (bus=0x0%x, pci_id=0x%x, ",
pdev->bus->number, pdev->devfn);
@@ -5012,7 +5014,14 @@
/* Although we don't use this I/O region, we should
request it from the kernel anyway, to avoid problems
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 (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo) { /* below 1M? */
@@ -5083,6 +5092,10 @@
cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel;
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 */
plx_ver = cy_readb(cy_pci_addr2 + CyPLX_VER) & 0x0f;
@@ -5118,7 +5131,7 @@
cy_pci_nchan, cy_next_channel);
cy_next_channel += cy_pci_nchan;
- }else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Lo){
+ }else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Lo){
/* print message */
printk("Cyclades-Z/PCI (bus=0x0%x, pci_id=0x%x, ",
pdev->bus->number, pdev->devfn);
@@ -5128,7 +5141,7 @@
(ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
printk("Cyclades-Z/PCI not supported for low addresses\n");
break;
- }else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Hi){
+ }else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Hi){
#ifdef CY_PCI_DEBUG
printk("Cyclades-Z/PCI (bus=0x0%x, pci_id=0x%x, ",
pdev->bus->number, pdev->devfn);
@@ -5163,6 +5176,15 @@
request it from the kernel anyway, to avoid problems
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 to allocate IO "
+ "resource at 0x%lx\n", cy_pci_phys1);
+ continue;
+ }
+ res_start = cy_pci_phys1;
+ res_len = CyPCI_Zctl;
if (mailbox == ZE_V1) {
cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ze_win);
@@ -5261,6 +5283,10 @@
cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel;
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 */
#ifdef CONFIG_CYZ_INTR
@@ -5279,7 +5305,7 @@
printk("%d channels starting from port %d.\n",
cy_pci_nchan,cy_next_channel);
cy_next_channel += cy_pci_nchan;
- }
+ }
}
for (; ZeIndex != 0 && i < NR_CARDS; i++) {
@@ -5787,6 +5813,10 @@
#endif /* CONFIG_CYZ_INTR */
)
free_irq(cy_card[i].irq, &cy_card[i]);
+ if (cy_card[i].resource) {
+ cy_card[i].resource = NULL;
+ release_region(cy_card[i].res_start, cy_card[i].res_len);
+ }
}
}
if (tmp_buf) {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)