Commit 67549038 authored by Jan Kiszka's avatar Jan Kiszka

rtnet: e1000e: Account for timer API changes

init_timer was removed in 4.15.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 2b0bb498
...@@ -2879,9 +2879,15 @@ static void e1000e_update_phy_task(struct work_struct *work) ...@@ -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 * Need to wait a few seconds after link up to get diagnostic information from
* the phy * 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) static void e1000_update_phy_info(unsigned long data)
{ {
struct e1000_adapter *adapter = (struct e1000_adapter *) data; struct e1000_adapter *adapter = (struct e1000_adapter *) data;
#endif /* < 4.14 */
if (test_bit(__E1000_DOWN, &adapter->state)) if (test_bit(__E1000_DOWN, &adapter->state))
return; return;
...@@ -3027,9 +3033,15 @@ static void e1000e_check_82574_phy_workaround(struct e1000_adapter *adapter) ...@@ -3027,9 +3033,15 @@ static void e1000e_check_82574_phy_workaround(struct e1000_adapter *adapter)
* e1000_watchdog - Timer Call-back * e1000_watchdog - Timer Call-back
* @data: pointer to adapter cast into an unsigned long * @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) static void e1000_watchdog(unsigned long data)
{ {
struct e1000_adapter *adapter = (struct e1000_adapter *) data; struct e1000_adapter *adapter = (struct e1000_adapter *) data;
#endif /* < 4.14 */
/* Do the rest outside of interrupt context */ /* Do the rest outside of interrupt context */
rtdm_schedule_nrt_work(&adapter->watchdog_task); rtdm_schedule_nrt_work(&adapter->watchdog_task);
...@@ -4079,6 +4091,10 @@ static int e1000_probe(struct pci_dev *pdev, ...@@ -4079,6 +4091,10 @@ static int e1000_probe(struct pci_dev *pdev,
memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); 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); init_timer(&adapter->watchdog_timer);
adapter->watchdog_timer.function = e1000_watchdog; adapter->watchdog_timer.function = e1000_watchdog;
adapter->watchdog_timer.data = (unsigned long) adapter; adapter->watchdog_timer.data = (unsigned long) adapter;
...@@ -4086,6 +4102,7 @@ static int e1000_probe(struct pci_dev *pdev, ...@@ -4086,6 +4102,7 @@ static int e1000_probe(struct pci_dev *pdev,
init_timer(&adapter->phy_info_timer); init_timer(&adapter->phy_info_timer);
adapter->phy_info_timer.function = e1000_update_phy_info; adapter->phy_info_timer.function = e1000_update_phy_info;
adapter->phy_info_timer.data = (unsigned long) adapter; adapter->phy_info_timer.data = (unsigned long) adapter;
#endif /* < 4.14 */
INIT_WORK(&adapter->reset_task, e1000_reset_task); INIT_WORK(&adapter->reset_task, e1000_reset_task);
INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment