Commit eb8c6b5b authored by Kees Cook's avatar Kees Cook Committed by David S. Miller

ethernet/broadcom: 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()
helper to pass the timer pointer explicitly.

Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c3aed709
...@@ -295,16 +295,13 @@ static int bcm_enet_refill_rx(struct net_device *dev) ...@@ -295,16 +295,13 @@ static int bcm_enet_refill_rx(struct net_device *dev)
/* /*
* timer callback to defer refill rx queue in case we're OOM * timer callback to defer refill rx queue in case we're OOM
*/ */
static void bcm_enet_refill_rx_timer(unsigned long data) static void bcm_enet_refill_rx_timer(struct timer_list *t)
{ {
struct net_device *dev; struct bcm_enet_priv *priv = from_timer(priv, t, rx_timeout);
struct bcm_enet_priv *priv; struct net_device *dev = priv->net_dev;
dev = (struct net_device *)data;
priv = netdev_priv(dev);
spin_lock(&priv->rx_lock); spin_lock(&priv->rx_lock);
bcm_enet_refill_rx((struct net_device *)data); bcm_enet_refill_rx(dev);
spin_unlock(&priv->rx_lock); spin_unlock(&priv->rx_lock);
} }
...@@ -1860,8 +1857,7 @@ static int bcm_enet_probe(struct platform_device *pdev) ...@@ -1860,8 +1857,7 @@ static int bcm_enet_probe(struct platform_device *pdev)
spin_lock_init(&priv->rx_lock); spin_lock_init(&priv->rx_lock);
/* init rx timeout (used for oom) */ /* init rx timeout (used for oom) */
setup_timer(&priv->rx_timeout, bcm_enet_refill_rx_timer, timer_setup(&priv->rx_timeout, bcm_enet_refill_rx_timer, 0);
(unsigned long)dev);
/* init the mib update lock&work */ /* init the mib update lock&work */
mutex_init(&priv->mib_update_lock); mutex_init(&priv->mib_update_lock);
...@@ -2015,9 +2011,9 @@ static inline int bcm_enet_port_is_rgmii(int portid) ...@@ -2015,9 +2011,9 @@ static inline int bcm_enet_port_is_rgmii(int portid)
/* /*
* enet sw PHY polling * enet sw PHY polling
*/ */
static void swphy_poll_timer(unsigned long data) static void swphy_poll_timer(struct timer_list *t)
{ {
struct bcm_enet_priv *priv = (struct bcm_enet_priv *)data; struct bcm_enet_priv *priv = from_timer(priv, t, swphy_poll);
unsigned int i; unsigned int i;
for (i = 0; i < priv->num_ports; i++) { for (i = 0; i < priv->num_ports; i++) {
...@@ -2326,7 +2322,7 @@ static int bcm_enetsw_open(struct net_device *dev) ...@@ -2326,7 +2322,7 @@ static int bcm_enetsw_open(struct net_device *dev)
} }
/* start phy polling timer */ /* start phy polling timer */
setup_timer(&priv->swphy_poll, swphy_poll_timer, (unsigned long)priv); timer_setup(&priv->swphy_poll, swphy_poll_timer, 0);
mod_timer(&priv->swphy_poll, jiffies); mod_timer(&priv->swphy_poll, jiffies);
return 0; return 0;
...@@ -2743,9 +2739,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev) ...@@ -2743,9 +2739,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
spin_lock_init(&priv->rx_lock); spin_lock_init(&priv->rx_lock);
/* init rx timeout (used for oom) */ /* init rx timeout (used for oom) */
init_timer(&priv->rx_timeout); timer_setup(&priv->rx_timeout, bcm_enet_refill_rx_timer, 0);
priv->rx_timeout.function = bcm_enet_refill_rx_timer;
priv->rx_timeout.data = (unsigned long)dev;
/* register netdevice */ /* register netdevice */
dev->netdev_ops = &bcm_enetsw_ops; dev->netdev_ops = &bcm_enetsw_ops;
......
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