Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26566eae authored by Kees Cook's avatar Kees Cook Committed by David S. Miller
Browse files

ethernet/intel: Convert timers to use timer_setup()



In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly. Switches test of .data field to
.function, since .data will be going away.

Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d039ef68
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1710,9 +1710,9 @@ static void e100_adjust_adaptive_ifs(struct nic *nic, int speed, int duplex)
	}
}

static void e100_watchdog(unsigned long data)
static void e100_watchdog(struct timer_list *t)
{
	struct nic *nic = (struct nic *)data;
	struct nic *nic = from_timer(nic, t, watchdog);
	struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET };
	u32 speed;

@@ -2920,7 +2920,7 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

	pci_set_master(pdev);

	setup_timer(&nic->watchdog, e100_watchdog, (unsigned long)nic);
	timer_setup(&nic->watchdog, e100_watchdog, 0);

	INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task);

+6 −8
Original line number Diff line number Diff line
@@ -4823,9 +4823,9 @@ 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
 **/
static void e1000_update_phy_info(unsigned long data)
static void e1000_update_phy_info(struct timer_list *t)
{
	struct e1000_adapter *adapter = (struct e1000_adapter *)data;
	struct e1000_adapter *adapter = from_timer(adapter, t, phy_info_timer);

	if (test_bit(__E1000_DOWN, &adapter->state))
		return;
@@ -5159,9 +5159,9 @@ 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
 **/
static void e1000_watchdog(unsigned long data)
static void e1000_watchdog(struct timer_list *t)
{
	struct e1000_adapter *adapter = (struct e1000_adapter *)data;
	struct e1000_adapter *adapter = from_timer(adapter, t, watchdog_timer);

	/* Do the rest outside of interrupt context */
	schedule_work(&adapter->watchdog_task);
@@ -7267,10 +7267,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
		goto err_eeprom;
	}

	setup_timer(&adapter->watchdog_timer, e1000_watchdog,
		    (unsigned long)adapter);
	setup_timer(&adapter->phy_info_timer, e1000_update_phy_info,
		    (unsigned long)adapter);
	timer_setup(&adapter->watchdog_timer, e1000_watchdog, 0);
	timer_setup(&adapter->phy_info_timer, e1000_update_phy_info, 0);

	INIT_WORK(&adapter->reset_task, e1000_reset_task);
	INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
+4 −4
Original line number Diff line number Diff line
@@ -213,9 +213,10 @@ static void fm10k_start_service_event(struct fm10k_intfc *interface)
 * fm10k_service_timer - Timer Call-back
 * @data: pointer to interface cast into an unsigned long
 **/
static void fm10k_service_timer(unsigned long data)
static void fm10k_service_timer(struct timer_list *t)
{
	struct fm10k_intfc *interface = (struct fm10k_intfc *)data;
	struct fm10k_intfc *interface = from_timer(interface, t,
						   service_timer);

	/* Reset the timer */
	mod_timer(&interface->service_timer, (HZ * 2) + jiffies);
@@ -2315,8 +2316,7 @@ static int fm10k_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	/* Initialize service timer and service task late in order to avoid
	 * cleanup issues.
	 */
	setup_timer(&interface->service_timer, &fm10k_service_timer,
		    (unsigned long)interface);
	timer_setup(&interface->service_timer, fm10k_service_timer, 0);
	INIT_WORK(&interface->service_task, fm10k_service_task);

	/* Setup the MAC/VLAN queue */
+4 −4
Original line number Diff line number Diff line
@@ -8800,9 +8800,9 @@ static void i40e_service_task(struct work_struct *work)
 * i40e_service_timer - timer callback
 * @data: pointer to PF struct
 **/
static void i40e_service_timer(unsigned long data)
static void i40e_service_timer(struct timer_list *t)
{
	struct i40e_pf *pf = (struct i40e_pf *)data;
	struct i40e_pf *pf = from_timer(pf, t, service_timer);

	mod_timer(&pf->service_timer,
		  round_jiffies(jiffies + pf->service_timer_period));
@@ -12648,7 +12648,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
#endif /* CONFIG_I40E_DCB */

	/* set up periodic task facility */
	setup_timer(&pf->service_timer, i40e_service_timer, (unsigned long)pf);
	timer_setup(&pf->service_timer, i40e_service_timer, 0);
	pf->service_timer_period = HZ;

	INIT_WORK(&pf->service_task, i40e_service_task);
@@ -12972,7 +12972,7 @@ static void i40e_remove(struct pci_dev *pdev)
	/* no more scheduling of any task */
	set_bit(__I40E_SUSPENDED, pf->state);
	set_bit(__I40E_DOWN, pf->state);
	if (pf->service_timer.data)
	if (pf->service_timer.function)
		del_timer_sync(&pf->service_timer);
	if (pf->service_task.func)
		cancel_work_sync(&pf->service_task);
+4 −4
Original line number Diff line number Diff line
@@ -1594,9 +1594,10 @@ static int i40evf_reinit_interrupt_scheme(struct i40evf_adapter *adapter)
 * i40evf_watchdog_timer - Periodic call-back timer
 * @data: pointer to adapter disguised as unsigned long
 **/
static void i40evf_watchdog_timer(unsigned long data)
static void i40evf_watchdog_timer(struct timer_list *t)
{
	struct i40evf_adapter *adapter = (struct i40evf_adapter *)data;
	struct i40evf_adapter *adapter = from_timer(adapter, t,
						    watchdog_timer);

	schedule_work(&adapter->watchdog_task);
	/* timer will be rescheduled in watchdog task */
@@ -2748,8 +2749,7 @@ static void i40evf_init_task(struct work_struct *work)
		ether_addr_copy(netdev->perm_addr, adapter->hw.mac.addr);
	}

	setup_timer(&adapter->watchdog_timer, &i40evf_watchdog_timer,
		    (unsigned long)adapter);
	timer_setup(&adapter->watchdog_timer, i40evf_watchdog_timer, 0);
	mod_timer(&adapter->watchdog_timer, jiffies + 1);

	adapter->tx_desc_count = I40EVF_DEFAULT_TXD;
Loading