summarylogtreecommitdiffstats
path: root/linux-4.15.patch
blob: 290055ef83fd428fb05727601368bafdeeac1719 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
diff --git a/src/r8168_n.c b/src/r8168_n.c
index 4cd540a..e7ee078 100755
--- a/src/r8168_n.c
+++ b/src/r8168_n.c
@@ -87,6 +87,8 @@
 #include <linux/seq_file.h>
 #endif
 
+unsigned long __devicepointer;
+
 /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
    The RTL chips use a 64 element hash table based on the Ethernet CRC. */
 static const int multicast_filter_limit = 32;
@@ -407,8 +409,14 @@ MODULE_VERSION(RTL8168_VERSION);
 static void rtl8168_sleep_rx_enable(struct net_device *dev);
 static void rtl8168_dsm(struct net_device *dev, int dev_state);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+static void rtl8168_esd_timer(struct timer_list *timer);
+static void rtl8168_link_timer(struct timer_list *timer);
+#else
 static void rtl8168_esd_timer(unsigned long __opaque);
 static void rtl8168_link_timer(unsigned long __opaque);
+#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+
 static void rtl8168_tx_clear(struct rtl8168_private *tp);
 static void rtl8168_rx_clear(struct rtl8168_private *tp);
 
@@ -22964,7 +22972,12 @@ static inline void rtl8168_request_esd_timer(struct net_device *dev)
         struct rtl8168_private *tp = netdev_priv(dev);
         struct timer_list *timer = &tp->esd_timer;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+        __devicepointer = (unsigned long)dev;
+        timer_setup(timer, rtl8168_esd_timer, 0);
+#else
         setup_timer(timer, rtl8168_esd_timer, (unsigned long)dev);
+#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
         mod_timer(timer, jiffies + RTL8168_ESD_TIMEOUT);
 }
 
@@ -22978,7 +22991,12 @@ static inline void rtl8168_request_link_timer(struct net_device *dev)
         struct rtl8168_private *tp = netdev_priv(dev);
         struct timer_list *timer = &tp->link_timer;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+        __devicepointer = (unsigned long)dev;
+        timer_setup(timer, rtl8168_link_timer, 0);
+#else
         setup_timer(timer, rtl8168_link_timer, (unsigned long)dev);
+#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
         mod_timer(timer, jiffies + RTL8168_LINK_TIMEOUT);
 }
 
@@ -24717,12 +24735,19 @@ err_out:
 #define PCI_DEVICE_SERIAL_NUMBER (0x0164)
 
 static void
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+rtl8168_esd_timer(struct timer_list *timer)
+{
+        struct net_device *dev = (struct net_device *)__devicepointer;
+        struct rtl8168_private *tp = netdev_priv(dev);
+#else
 rtl8168_esd_timer(unsigned long __opaque)
 {
         struct net_device *dev = (struct net_device *)__opaque;
         struct rtl8168_private *tp = netdev_priv(dev);
-        struct pci_dev *pdev = tp->pci_dev;
         struct timer_list *timer = &tp->esd_timer;
+#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+        struct pci_dev *pdev = tp->pci_dev;
         unsigned long timeout = RTL8168_ESD_TIMEOUT;
         unsigned long flags;
         u8 cmd;
@@ -24856,11 +24881,18 @@ rtl8168_esd_timer(unsigned long __opaque)
 }
 
 static void
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
+rtl8168_link_timer(struct timer_list *timer)
+{
+        struct net_device *dev = (struct net_device *)__devicepointer;
+        struct rtl8168_private *tp = netdev_priv(dev);
+#else
 rtl8168_link_timer(unsigned long __opaque)
 {
         struct net_device *dev = (struct net_device *)__opaque;
         struct rtl8168_private *tp = netdev_priv(dev);
         struct timer_list *timer = &tp->link_timer;
+#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)
         unsigned long flags;
 
         spin_lock_irqsave(&tp->lock, flags);