1 /*
2  * Backport hacks. Redefine world to look as close to current 2.6
3  * as posssible.
4  */
5 
6 #include <linux/version.h>
7 
8 #ifndef __iomem
9 #define __iomem
10 #endif
11 
12 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
13 #define pci_dma_sync_single_for_device(pdev, addr, len, dir)
14 #define pci_dma_sync_single_for_cpu(pdev, addr, len, dir) \
15 	pci_dma_sync_single(pdev, addr, len, dir)
16 
17 #else
18 #include <linux/dma-mapping.h>
19 #endif
20 
21 #ifndef DMA_32BIT_MASK
22 #define DMA_64BIT_MASK	0xffffffffffffffffULL
23 #define DMA_32BIT_MASK	0x00000000ffffffffULL
24 #endif
25 
26 #ifndef module_param
27 #define module_param(var, type, perm) \
28 	MODULE_PARM(var, "i");
29 #endif
30 
31 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
msleep_interruptible(unsigned int msecs)32 static unsigned long msleep_interruptible(unsigned int msecs)
33 {
34 	unsigned long timeout = msecs_to_jiffies(msecs) + 1;
35 
36 	__set_current_state(TASK_INTERRUPTIBLE);
37 	while (timeout && !signal_pending(current))
38 		timeout = schedule_timeout(timeout);
39 	return jiffies_to_msecs(timeout);
40 }
41 #endif
42 
43 #ifndef PCI_DEVICE
44 #define PCI_DEVICE(vend,dev) \
45 	.vendor = (vend), .device = (dev), \
46 	.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
47 #endif
48 
49 #ifndef HAVE_NETDEV_PRIV
50 #define netdev_priv(dev)	((dev)->priv)
51 #endif
52 
53 #ifndef ALIGN
54 #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
55 #endif
56 
57 #ifndef NET_IP_ALIGN
58 #define NET_IP_ALIGN 2
59 #endif
60 
61 #ifndef NETDEV_TX_OK
62 #define NETDEV_TX_OK 0		/* driver took care of packet */
63 #define NETDEV_TX_BUSY 1	/* driver tx path was busy*/
64 #endif
65 
66 #ifndef IRQ_NONE
67 #define irqreturn_t	void
68 #define IRQ_NONE
69 #define IRQ_HANDLED
70 #endif
71 
72 #ifndef PCI_D0
73 #define PCI_D0		0
74 #define PCI_D1		1
75 #define PCI_D2		2
76 #define PCI_D3hot	3
77 #define PCI_D3cold	4
78 typedef int pci_power_t;
79 #endif
80 
81