Skip to content

Commit 11dd894

Browse files
keesdavem330
authored andcommitted
net: ksz884x: 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. Cc: "David S. Miller" <davem@davemloft.net> Cc: Johannes Berg <johannes.berg@intel.com> Cc: Jarod Wilson <jarod@redhat.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Philippe Reynes <tremyfr@gmail.com> Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6fa35bd commit 11dd894

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/net/ethernet/micrel/ksz884x.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4338,11 +4338,11 @@ static void ksz_stop_timer(struct ksz_timer_info *info)
43384338
}
43394339

43404340
static void ksz_init_timer(struct ksz_timer_info *info, int period,
4341-
void (*function)(unsigned long), void *data)
4341+
void (*function)(struct timer_list *))
43424342
{
43434343
info->max = 0;
43444344
info->period = period;
4345-
setup_timer(&info->timer, function, (unsigned long)data);
4345+
timer_setup(&info->timer, function, 0);
43464346
}
43474347

43484348
static void ksz_update_timer(struct ksz_timer_info *info)
@@ -6689,9 +6689,9 @@ static void mib_read_work(struct work_struct *work)
66896689
}
66906690
}
66916691

6692-
static void mib_monitor(unsigned long ptr)
6692+
static void mib_monitor(struct timer_list *t)
66936693
{
6694-
struct dev_info *hw_priv = (struct dev_info *) ptr;
6694+
struct dev_info *hw_priv = from_timer(hw_priv, t, mib_timer_info.timer);
66956695

66966696
mib_read_work(&hw_priv->mib_read);
66976697

@@ -6716,10 +6716,10 @@ static void mib_monitor(unsigned long ptr)
67166716
*
67176717
* This routine is run in a kernel timer to monitor the network device.
67186718
*/
6719-
static void dev_monitor(unsigned long ptr)
6719+
static void dev_monitor(struct timer_list *t)
67206720
{
6721-
struct net_device *dev = (struct net_device *) ptr;
6722-
struct dev_priv *priv = netdev_priv(dev);
6721+
struct dev_priv *priv = from_timer(priv, t, monitor_timer_info.timer);
6722+
struct net_device *dev = priv->mii_if.dev;
67236723
struct dev_info *hw_priv = priv->adapter;
67246724
struct ksz_hw *hw = &hw_priv->hw;
67256725
struct ksz_port *port = &priv->port;
@@ -6789,7 +6789,7 @@ static int __init netdev_init(struct net_device *dev)
67896789

67906790
/* 500 ms timeout */
67916791
ksz_init_timer(&priv->monitor_timer_info, 500 * HZ / 1000,
6792-
dev_monitor, dev);
6792+
dev_monitor);
67936793

67946794
/* 500 ms timeout */
67956795
dev->watchdog_timeo = HZ / 2;
@@ -7065,7 +7065,7 @@ static int pcidev_init(struct pci_dev *pdev, const struct pci_device_id *id)
70657065

70667066
/* 500 ms timeout */
70677067
ksz_init_timer(&hw_priv->mib_timer_info, 500 * HZ / 1000,
7068-
mib_monitor, hw_priv);
7068+
mib_monitor);
70697069

70707070
for (i = 0; i < hw->dev_count; i++) {
70717071
dev = alloc_etherdev(sizeof(struct dev_priv));

0 commit comments

Comments
 (0)