Skip to contentSkip to conversation

Cleanup LINUX_VERSION_CODE in drivers/net

PATCH In review Eric Sesterhenn / snakebyte 2 participants 4 messages Dec 18, 2005 – Dec 19, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/5 Cleanup LINUX_VERSION_CODE in drivers/net

hi,

this removes LINUX_VERSION_CODE checks in irda/vlsi_ir.h

drivers/net/irda/vlsi_ir.h renamed from drivers/net/irda/vlsi_ir.h.orig +0 -17
@@ -54,26 +54,9 @@ typedef void irqreturn_t;
  */
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-
-/* PDE() introduced in 2.5.4 */
-#ifdef CONFIG_PROC_FS
-#define PDE(inode) ((inode)->u.generic_ip)
-#endif
-
-/* irda crc16 calculation exported in 2.5.42 */
-#define irda_calc_crc16(fcs,buf,len)	(GOOD_FCS)
-
-/* we use this for unified pci device name access */
-#define PCIDEV_NAME(pdev)	((pdev)->name)
-
-#else /* 2.5 or later */
-
 /* whatever we get from the associated struct device - bus:slot:dev.fn id */
 #define PCIDEV_NAME(pdev)	(pci_name(pdev))
 
-#endif
-
 /* ================================================================ */
 
 /* non-standard PCI registers */

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 22 lines · Eric Sesterhenn / snakebyte

hi,

this removes LINUX_VERSION_CODE checks in irda/vlsi_ir.h

drivers/net/irda/vlsi_ir.h renamed from drivers/net/irda/vlsi_ir.h.orig +0 -10
@@ -54,26 +54,9 @@ typedef void irqreturn_t;
  */
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-
-/* PDE() introduced in 2.5.4 */
-#ifdef CONFIG_PROC_FS
-#define PDE(inode) ((inode)->u.generic_ip)
-#endif
-
-/* irda crc16 calculation exported in 2.5.42 */
-#define irda_calc_crc16(fcs,buf,len)	(GOOD_FCS)
-

drivers/net/irda/vlsi_ir.h typedef void irqreturn_t; · line 75

Quoted 10 lines
drivers/net/irda/vlsi_ir.h renamed from drivers/net/irda/vlsi_ir.h.orig +0 -6
-/* we use this for unified pci device name access */
-#define PCIDEV_NAME(pdev)	((pdev)->name)
-
-#else /* 2.5 or later */
-
 /* whatever we get from the associated struct device - bus:slot:dev.fn id */
 #define PCIDEV_NAME(pdev)	(pci_name(pdev))
 
-#endif
...

In this case, you could make the code more readable by expanding all uses of PCIDEV_NAME in vlsi_ir.c.

And the "#ifndef IRQ_RETVAL" block in vlsi_ir.h is also kernel 2.4 compatibility stuff.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Eric Sesterhenn / snakebyte

hi,

Quoted 2 lines

In this case, you could make the code more readable by expanding all uses of PCIDEV_NAME in vlsi_ir.c.

attached is an updated patch for vlsi_ir.h which also removes the PCIDE_NAME macro, i will reply to this mail with a patch to change the vlsi_ir.c

Quoted 2 lines

And the "#ifndef IRQ_RETVAL" block in vlsi_ir.h is also kernel 2.4 compatibility stuff.

can you give me some more information on this? Seems quite some irda drivers use the IRQ_NONE an friends macro.

drivers/net/irda/vlsi_ir.h renamed from drivers/net/irda/vlsi_ir.h.orig +0 -20
@@ -54,26 +54,6 @@ typedef void irqreturn_t;
  */
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-
-/* PDE() introduced in 2.5.4 */
-#ifdef CONFIG_PROC_FS
-#define PDE(inode) ((inode)->u.generic_ip)
-#endif
-
-/* irda crc16 calculation exported in 2.5.42 */
-#define irda_calc_crc16(fcs,buf,len)	(GOOD_FCS)
-
-/* we use this for unified pci device name access */
-#define PCIDEV_NAME(pdev)	((pdev)->name)
-
-#else /* 2.5 or later */
-
-/* whatever we get from the associated struct device - bus:slot:dev.fn id */
-#define PCIDEV_NAME(pdev)	(pci_name(pdev))
-
-#endif
-
 /* ================================================================ */
 
 /* non-standard PCI registers */

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
In reply to Eric Sesterhenn / snakebyte

hi,

Quoted 2 lines

can you give me some more information on this? Seems quite some irda drivers use the IRQ_NONE an friends macro.

Ah ok, seems it is already defined in include/linux/interrupt.h so we dont need to define it in the driver. Here is a patch on top of the other which simply removes it.

drivers/net/irda/vlsi_ir.h renamed from drivers/net/irda/vlsi_ir.h.orig +0 -8
@@ -41,14 +41,6 @@
 #define PCI_CLASS_SUBCLASS_MASK		0xffff
 #endif
 
-/* in recent 2.5 interrupt handlers have non-void return value */
-#ifndef IRQ_RETVAL
-typedef void irqreturn_t;
-#define IRQ_NONE
-#define IRQ_HANDLED
-#define IRQ_RETVAL(x)
-#endif
-
 /* some stuff need to check kernelversion. Not all 2.5 stuff was present
  * in early 2.5.x - the test is merely to separate 2.4 from 2.5
  */

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors