Skip to contentSkip to conversation

rtnet: e1000e: Account for timer API changes

PATCH New Jan Kiszka 1 participant 1 message Apr 5, 2019

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 rtnet: e1000e: Account for timer API changes

From: Jan Kiszka <[email protected]>

init_timer was removed in 4.15.

---
 kernel/drivers/net/drivers/e1000e/netdev.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
kernel/drivers/net/drivers/e1000e/netdev.c +17 -0
index 9feaf071a1..baeb6aa09d 100644
@@ -2879,9 +2879,15 @@ static void e1000e_update_phy_task(struct work_struct *work)
  * Need to wait a few seconds after link up to get diagnostic information from
  * the phy
  */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
+static void e1000_update_phy_info(struct timer_list *t)
+{
+	struct e1000_adapter *adapter = from_timer(adapter, t, phy_info_timer);
+#else /* < 4.14 */
 static void e1000_update_phy_info(unsigned long data)
 {
 	struct e1000_adapter *adapter = (struct e1000_adapter *) data;
+#endif /* < 4.14 */
 
 	if (test_bit(__E1000_DOWN, &adapter->state))
 		return;
@@ -3027,9 +3033,15 @@ static void e1000e_check_82574_phy_workaround(struct e1000_adapter *adapter)
  * e1000_watchdog - Timer Call-back
  * @data: pointer to adapter cast into an unsigned long
  **/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
+static void e1000_watchdog(struct timer_list *t)
+{
+	struct e1000_adapter *adapter = from_timer(adapter, t, watchdog_timer);
+#else /* < 4.14 */
 static void e1000_watchdog(unsigned long data)
 {
 	struct e1000_adapter *adapter = (struct e1000_adapter *) data;
+#endif /* < 4.14 */
 
 	/* Do the rest outside of interrupt context */
 	rtdm_schedule_nrt_work(&adapter->watchdog_task);
@@ -4079,6 +4091,10 @@ static int e1000_probe(struct pci_dev *pdev,
 
 	memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
+	timer_setup(&adapter->watchdog_timer, e1000_watchdog, 0);
+	timer_setup(&adapter->phy_info_timer, e1000_update_phy_info, 0);
+#else /* < 4.14 */
 	init_timer(&adapter->watchdog_timer);
 	adapter->watchdog_timer.function = e1000_watchdog;
 	adapter->watchdog_timer.data = (unsigned long) adapter;
@@ -4086,6 +4102,7 @@ static int e1000_probe(struct pci_dev *pdev,
 	init_timer(&adapter->phy_info_timer);
 	adapter->phy_info_timer.function = e1000_update_phy_info;
 	adapter->phy_info_timer.data = (unsigned long) adapter;
+#endif /* < 4.14 */
 
 	INIT_WORK(&adapter->reset_task, e1000_reset_task);
 	INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
Signature · 1 line
2.16.4