Skip to contentSkip to conversation

sparc64 cleanup cyclades.c

PATCH In review Florian Lohoff 2 participants 3 messages May 4, 2002 – May 5, 2002 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc64 cleanup cyclades.c

Hi,
attached a patch which cleanup the parts needed for sparc64. I am using the driver currently. I can't verify if it breaks i386 or alpha which seem to be the platforms now.

It changes the definition in cyclades.h to use the kernel fixed bit defines therefor removes the need for the ifdef __alpha__. It then fixes the irq beeing unsigned long not unsigned char also the error path in the cyclom Y init. Need to free resources when aborting.

Against 2.4.18

drivers/char/cyclades.c +14 -9
diff -Nur linux/drivers/char/cyclades.c linux.flo/drivers/char/cyclades.c
@@ -4895,7 +4895,7 @@
                 }
 
                 /* allocate IRQ */
-                if(request_irq(cy_isa_irq, cyy_interrupt,
+                if(request_irq(cy_isa_irq, &cyy_interrupt,
 				   SA_INTERRUPT, "Cyclom-Y", &cy_card[j]))
                 {
                         printk("Cyclom-Y/ISA found at 0x%lx ",
@@ -4956,14 +4956,14 @@
 
   struct pci_dev	*pdev = NULL;
   unsigned char		cyy_rev_id;
-  unsigned char         cy_pci_irq = 0;
-  uclong		cy_pci_phys0, cy_pci_phys1, cy_pci_phys2;
-  uclong		cy_pci_addr0, cy_pci_addr2;
+  unsigned long		cy_pci_irq = 0;
+  unsigned long		cy_pci_phys0, cy_pci_phys1, cy_pci_phys2;
+  unsigned long		cy_pci_addr0, cy_pci_addr2;
   unsigned short        i,j,cy_pci_nchan, plx_ver;
   unsigned short        device_id,dev_index = 0;
-  uclong		mailbox;
-  uclong		Ze_addr0[NR_CARDS], Ze_addr2[NR_CARDS], ZeIndex = 0;
-  uclong		Ze_phys0[NR_CARDS], Ze_phys2[NR_CARDS];
+  unsigned long		mailbox;
+  unsigned long		Ze_addr0[NR_CARDS], Ze_addr2[NR_CARDS], ZeIndex = 0;
+  unsigned long		Ze_phys0[NR_CARDS], Ze_phys2[NR_CARDS];
   unsigned char         Ze_irq[NR_CARDS];
   struct resource *resource;
   unsigned long res_start, res_len;
@@ -5033,6 +5033,7 @@
 		        (ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
 	            printk("Cyclom-Y/PCI not supported for low addresses in "
                            "Alpha systems.\n");
+		    release_region(res_start, res_len);
 		    i--;
 	            continue;
                 }
@@ -5050,6 +5051,7 @@
                         printk("Cyclom-Y PCI host card with ");
                         printk("no Serial-Modules at 0x%lx.\n",
 			    (ulong) cy_pci_phys2);
+			release_region(res_start, res_len);
                         i--;
                         continue;
                 }
@@ -5058,6 +5060,7 @@
 			    (ulong) cy_pci_phys2);
                         printk("but no channels are available.\n");
                         printk("Change NR_PORTS in cyclades.c and recompile kernel.\n");
+			release_region(res_start, res_len);
                         return(i);
                 }
                 /* fill the next cy_card structure available */
@@ -5069,17 +5072,19 @@
 			    (ulong) cy_pci_phys2);
                         printk("but no more cards can be used.\n");
                         printk("Change NR_CARDS in cyclades.c and recompile kernel.\n");
+			release_region(res_start, res_len);
                         return(i);
                 }
 
                 /* allocate IRQ */
-                if(request_irq(cy_pci_irq, cyy_interrupt,
+                if(request_irq(cy_pci_irq, &cyy_interrupt,
 		        SA_SHIRQ, "Cyclom-Y", &cy_card[j]))
                 {
                         printk("Cyclom-Y/PCI found at 0x%lx ",
 			    (ulong) cy_pci_phys2);
-                        printk("but could not allocate IRQ%d.\n",
+                        printk("but could not allocate IRQ%ld.\n",
 			    cy_pci_irq);
+			release_region(res_start, res_len);
                         return(i);
                 }
 
include/linux/cyclades.h +3 -8
diff -Nur linux/include/linux/cyclades.h linux.flo/include/linux/cyclades.h
@@ -145,14 +145,9 @@
  *	architectures and compilers.
  */
 
-#if defined(__alpha__)
-typedef unsigned long	ucdouble;	/* 64 bits, unsigned */
-typedef unsigned int	uclong;		/* 32 bits, unsigned */
-#else
-typedef unsigned long	uclong;		/* 32 bits, unsigned */
-#endif
-typedef unsigned short	ucshort;	/* 16 bits, unsigned */
-typedef unsigned char	ucchar;		/* 8 bits, unsigned */
+typedef __u32		uclong;		/* 32 bits, unsigned */
+typedef __u16		ucshort;	/* 16 bits, unsigned */
+typedef __u8		ucchar;		/* 8 bits, unsigned */
 
 /*
  *	Memory Window Sizes

Flo

Signature · 2 lines
Florian Lohoff                  [email protected]             +49-5201-669912
                        Heisenberg may have been here.
#1 lore raw

From: Florian Lohoff <[email protected]>
Date: Sat, 4 May 2002 18:25:18 +0200

   @@ -4895,7 +4895,7 @@
                    }
                    /* allocate IRQ */
   -                if(request_irq(cy_isa_irq, cyy_interrupt,
   +                if(request_irq(cy_isa_irq, &cyy_interrupt,
    				   SA_INTERRUPT, "Cyclom-Y", &cy_card[j]))
                    {
                            printk("Cyclom-Y/ISA found at 0x%lx ",

This looks suspicious, did you really need it?