Skip to contentSkip to conversation

IB/ipoib: Convert timers to use timer_setup()

PATCH Applied Kees Cook 3 participants 3 messages Oct 5, 2017 – Oct 9, 2017 InfiniBand

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 IB/ipoib: 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 Doug Ledford <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc Leon Romanovsky <[email protected]>
Cc Alex Vesker <[email protected]>
Cc Erez Shitrit <[email protected]>
Cc Zhu Yanjun <[email protected]>
Cc Dasaratharaman Chandramouli <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Ira Weiny <[email protected]>
Cc Yuval Shaia <[email protected]>
Cc Thomas Gleixner <[email protected]>

---
This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone.

---
 drivers/infiniband/ulp/ipoib/ipoib.h      | 2 +-
 drivers/infiniband/ulp/ipoib/ipoib_ib.c   | 6 ++++--
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 +--
 3 files changed, 6 insertions(+), 5 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib.h +1 -1
index 4a5c7a07a631..7cc2b755413d 100644
@@ -500,7 +500,7 @@ void ipoib_mark_paths_invalid(struct net_device *dev);
 void ipoib_flush_paths(struct net_device *dev);
 struct ipoib_dev_priv *ipoib_intf_alloc(struct ib_device *hca, u8 port,
 					const char *format);
-void ipoib_ib_tx_timer_func(unsigned long ctx);
+void ipoib_ib_tx_timer_func(struct timer_list *t);
 void ipoib_ib_dev_flush_light(struct work_struct *work);
 void ipoib_ib_dev_flush_normal(struct work_struct *work);
 void ipoib_ib_dev_flush_heavy(struct work_struct *work);
drivers/infiniband/ulp/ipoib/ipoib_ib.c +4 -2
index 6cd61638b441..918930a0bc70 100644
@@ -821,9 +821,11 @@ int ipoib_ib_dev_stop(struct net_device *dev)
 	return 0;
 }
 
-void ipoib_ib_tx_timer_func(unsigned long ctx)
+void ipoib_ib_tx_timer_func(struct timer_list *t)
 {
-	drain_tx_cq((struct net_device *)ctx);
+	struct ipoib_dev_priv *priv = from_timer(priv, t, poll_timer);
+
+	drain_tx_cq(priv->dev);
 }
 
 int ipoib_ib_dev_open_default(struct net_device *dev)
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -2
index dcc77014018d..77c1b7adbb40 100644
@@ -1666,8 +1666,7 @@ static int ipoib_dev_init_default(struct net_device *dev)
 	priv->dev->dev_addr[2] = (priv->qp->qp_num >>  8) & 0xff;
 	priv->dev->dev_addr[3] = (priv->qp->qp_num) & 0xff;
 
-	setup_timer(&priv->poll_timer, ipoib_ib_tx_timer_func,
-		    (unsigned long)dev);
+	timer_setup(&priv->poll_timer, ipoib_ib_tx_timer_func, 0);
 
 	return 0;
 
Signature · 6 lines
2.7.4


-- 
Kees Cook
Pixel Security
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Kees Cook

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 Doug Ledford <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc Leon Romanovsky <[email protected]>
Cc Alex Vesker <valex-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc Erez Shitrit <erezsh-VPRAkNaXOzVWk0Htik3J/[email protected]>
Cc Zhu Yanjun <[email protected]>
Cc Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc Paolo Abeni <[email protected]>
Cc Ira Weiny <[email protected]>
Cc Yuval Shaia <[email protected]>
Cc Thomas Gleixner <[email protected]>

---
This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone.

Quoted 6 lines
---
 drivers/infiniband/ulp/ipoib/ipoib.h      | 2 +-
 drivers/infiniband/ulp/ipoib/ipoib_ib.c   | 6 ++++--
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 +--
 3 files changed, 6 insertions(+), 5 deletions(-)

Thanks,

Applied
#2 lore raw
In reply to Kees Cook
Quoted 21 lines · Kees Cook

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: Doug Ledford <[email protected]>
Cc: Sean Hefty <[email protected]>
Cc: Hal Rosenstock <[email protected]>
Cc: Leon Romanovsky <[email protected]>
Cc: Alex Vesker <[email protected]>
Cc: Erez Shitrit <[email protected]>
Cc: Zhu Yanjun <[email protected]>
Cc: Dasaratharaman Chandramouli <[email protected] m>

Cc Paolo Abeni <[email protected]>
Cc Ira Weiny <[email protected]>
Cc Yuval Shaia <[email protected]>
Cc Thomas Gleixner <[email protected]>
Quoted 4 lines

---
This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone.

Thanks, applied.

Signature · 3 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD