summaryrefslogtreecommitdiff
path: root/drivers/net/can/grcan.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-10-25 03:51:14 -0700
committerDavid S. Miller <davem@davemloft.net>2017-10-27 12:09:15 +0900
commit550acfb37ffeee9ff00f7f13f087ad1c33a74b29 (patch)
treee129c181d9dd28ffe0df8ef3722429129bb962b5 /drivers/net/can/grcan.c
parent0ff624fbfefbb96db62d100bda84e4fbdabaf628 (diff)
drivers/net: can: 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: Wolfgang Grandegger <wg@grandegger.com> Cc: Marc Kleine-Budde <mkl@pengutronix.de> Cc: "David S. Miller" <davem@davemloft.net> Cc: Allen Pais <allen.lkml@gmail.com> Cc: linux-can@vger.kernel.org Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/grcan.c')
-rw-r--r--drivers/net/can/grcan.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
index 8570cfdaea75..897c6b113d3f 100644
--- a/drivers/net/can/grcan.c
+++ b/drivers/net/can/grcan.c
@@ -807,10 +807,10 @@ static irqreturn_t grcan_interrupt(int irq, void *dev_id)
* is not ONGOING (TX might be stuck in ONGOING due to a harwrware bug
* for single shot)
*/
-static void grcan_running_reset(unsigned long data)
+static void grcan_running_reset(struct timer_list *t)
{
- struct net_device *dev = (struct net_device *)data;
- struct grcan_priv *priv = netdev_priv(dev);
+ struct grcan_priv *priv = from_timer(priv, t, rr_timer);
+ struct net_device *dev = priv->dev;
struct grcan_registers __iomem *regs = priv->regs;
unsigned long flags;
@@ -898,10 +898,10 @@ static inline void grcan_reset_timer(struct timer_list *timer, __u32 bitrate)
}
/* Disable channels and schedule a running reset */
-static void grcan_initiate_running_reset(unsigned long data)
+static void grcan_initiate_running_reset(struct timer_list *t)
{
- struct net_device *dev = (struct net_device *)data;
- struct grcan_priv *priv = netdev_priv(dev);
+ struct grcan_priv *priv = from_timer(priv, t, hang_timer);
+ struct net_device *dev = priv->dev;
struct grcan_registers __iomem *regs = priv->regs;
unsigned long flags;
@@ -1626,11 +1626,8 @@ static int grcan_setup_netdev(struct platform_device *ofdev,
spin_lock_init(&priv->lock);
if (priv->need_txbug_workaround) {
- setup_timer(&priv->rr_timer, grcan_running_reset,
- (unsigned long)dev);
-
- setup_timer(&priv->hang_timer, grcan_initiate_running_reset,
- (unsigned long)dev);
+ timer_setup(&priv->rr_timer, grcan_running_reset, 0);
+ timer_setup(&priv->hang_timer, grcan_initiate_running_reset, 0);
}
netif_napi_add(dev, &priv->napi, grcan_poll, GRCAN_NAPI_WEIGHT);