Skip to contentSkip to conversation

hrtimers: Switch to new hrtimer interface functions (3/5)

PATCH Superseded Nam Cao 2 participants 28 messages Oct 28, 2024

Subsystems (33)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nam Cao

author
#0 lore raw

cover hrtimers: Switch to new hrtimer interface functions (3/5)

This is the third part of a 5-part series (split for convenience). All 5 parts are:

Part 1: https://lore.kernel.org/lkml/[email protected]
Part 2: https://lore.kernel.org/lkml/[email protected]
Part 3: https://lore.kernel.org/lkml/[email protected]
Part 4: https://lore.kernel.org/lkml/[email protected]
Part 5: https://lore.kernel.org/lkml/[email protected]

To use hrtimer, hrtimer_init() (or one of its variant) must be called, and also the timer's callfack function must be setup separately.

That can cause misuse of hrtimer. For example, because:
- The callback function is not setup
- The callback function is setup while it is not safe to do so

To prevent misuse of hrtimer, this series:
- Introduce new functions hrtimer_setup*(). These new functions are similar to hrtimer_init*(), except that they also sanity-check and initialize the callback function.
- Introduce hrtimer_update_function() which checks that it is safe to change the callback function. The 'function' field of hrtimer is then made private.
- Convert all users to use the new functions.
- Some minor cleanups on the way.

Most conversion patches were created using Coccinelle with the sematic patch below; except for tricky cases that Coccinelle cannot handle, or for some cases where a Coccinelle's bug regarding 100 column limit is triggered. Any patches not mentioning Coccinelle were done manually.

virtual patch
@@ expression timer, clock, mode, func; @@
- hrtimer_init(timer, clock, mode);
...
- timer->function = func;
+ hrtimer_setup(timer, func, clock, mode);

@@ expression timer, clock, mode, func; @@
- hrtimer_init(&timer, clock, mode);
...
- timer.function = func;
+ hrtimer_setup(&timer, func, clock, mode);

@@ expression timer, clock, mode, func; @@
- hrtimer_init_on_stack(&timer, clock, mode);
...
- timer.function = func;
+ hrtimer_setup_on_stack(&timer, func, clock, mode);

@@ expression timer, clock, mode; @@
- hrtimer_init_sleeper_on_stack(timer, clock, mode);
+ hrtimer_setup_sleeper_on_stack(timer, clock, mode);

Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Marc Kleine-Budde <[email protected]>
Cc Oliver Neukum <[email protected]>
Cc Kalle Valo <[email protected]>

Nam Cao (24):
netdev: Switch to use hrtimer_setup()
net/sched: Switch to use hrtimer_setup()
mac802154: Switch to use hrtimer_setup()
tcp: Switch to use hrtimer_setup()
can: m_can: Switch to use hrtimer_setup()
can: mcp251xfd: Switch to use hrtimer_setup()
can: Switch to use hrtimer_setup()
net: ethernet: ti: Switch to use hrtimer_setup()
net: ethernet: cortina: Switch to use hrtimer_setup()
net: ethernet: ec_bhf: Switch to use hrtimer_setup()
net: ethernet: hisilicon: Switch to use hrtimer_setup()
net: sparx5: Switch to use hrtimer_setup()
net: ieee802154: at86rf230: Switch to use hrtimer_setup()
net: mvpp2: Switch to use hrtimer_setup()
net: qualcomm: rmnet: Switch to use hrtimer_setup()
net: stmmac: Switch to use hrtimer_setup()
net: fec: Switch to use hrtimer_setup()
net: wwan: iosm: Switch to use hrtimer_setup() net/cdc_ncm: Switch to use hrtimer_setup()
wifi: Switch to use hrtimer_setup()
wifi: rt2x00: Switch to use hrtimer_setup()
igc: Switch to use hrtimer_setup()
octeontx2-pf: Switch to use hrtimer_setup()
xfrm: Switch to use hrtimer_setup()

 drivers/net/can/m_can/m_can.c                 |  9 ++++---
 .../net/can/spi/mcp251xfd/mcp251xfd-ring.c    |  8 +++----
 drivers/net/ethernet/cortina/gemini.c         |  5 ++--
 drivers/net/ethernet/ec_bhf.c                 |  3 +--
 drivers/net/ethernet/freescale/fec_ptp.c      |  4 ++--
 drivers/net/ethernet/hisilicon/hip04_eth.c    |  4 +---
 drivers/net/ethernet/intel/igc/igc_main.c     |  4 ++--
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   |  5 ++--
 .../net/ethernet/marvell/octeontx2/af/ptp.c   |  3 +--
 .../ethernet/microchip/sparx5/sparx5_packet.c |  4 ++--
 .../ethernet/qualcomm/rmnet/rmnet_map_data.c  |  4 ++--
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  6 ++---
 drivers/net/ethernet/ti/am65-cpsw-nuss.c      |  9 ++++---
 drivers/net/ethernet/ti/icssg/icssg_common.c  |  5 ++--
 drivers/net/ethernet/ti/icssg/icssg_prueth.c  |  5 ++--
 drivers/net/ieee802154/at86rf230.c            |  4 ++--
 drivers/net/usb/cdc_ncm.c                     |  3 +--
 .../wireless/mediatek/mt76/mt76x02_usb_core.c |  4 ++--
 .../net/wireless/ralink/rt2x00/rt2x00dev.c    |  9 +++++--
 drivers/net/wireless/virtual/mac80211_hwsim.c |  6 ++---
 drivers/net/wwan/iosm/iosm_ipc_imem.c         | 24 ++++++++-----------
 net/can/bcm.c                                 | 16 +++++--------
 net/can/isotp.c                               | 10 ++++----
 net/can/j1939/bus.c                           |  4 ++--
 net/can/j1939/transport.c                     |  8 ++-----
 net/core/dev.c                                |  3 +--
 net/ipv4/tcp_timer.c                          | 10 ++++----
 net/mac802154/main.c                          |  4 ++--
 net/sched/act_gate.c                          |  3 +--
 net/sched/sch_api.c                           |  3 +--
 net/sched/sch_taprio.c                        |  6 ++---
 net/xfrm/xfrm_state.c                         |  4 ++--
 32 files changed, 84 insertions(+), 115 deletions(-)
Signature · 1 line
2.39.5
author
#1 lore raw

PATCH 1/24 netdev: Switch to use hrtimer_setup()

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 net/core/dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/core/dev.c +1 -2
index cd479f5f22f6..83971c85466e 100644
@@ -6645,8 +6645,7 @@ void netif_napi_add_weight(struct net_device *dev, struct napi_struct *napi,
 
 	INIT_LIST_HEAD(&napi->poll_list);
 	INIT_HLIST_NODE(&napi->napi_hash_node);
-	hrtimer_init(&napi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
-	napi->timer.function = napi_watchdog;
+	hrtimer_setup(&napi->timer, napi_watchdog, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
 	init_gro_hash(napi);
 	napi->skb = NULL;
 	INIT_LIST_HEAD(&napi->rx_list);
Signature · 1 line
2.39.5
author
#2 lore raw

PATCH 2/24 net/sched: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 net/sched/act_gate.c   | 3 +--
 net/sched/sch_api.c    | 3 +--
 net/sched/sch_taprio.c | 6 ++----
 3 files changed, 4 insertions(+), 8 deletions(-)
net/sched/act_gate.c +1 -2
index 1dd74125398a..ba4bdb71f1f3 100644
@@ -292,8 +292,7 @@ static void gate_setup_timer(struct tcf_gate *gact, u64 basetime,
 	gact->param.tcfg_basetime = basetime;
 	gact->param.tcfg_clockid = clockid;
 	gact->tk_offset = tko;
-	hrtimer_init(&gact->hitimer, clockid, HRTIMER_MODE_ABS_SOFT);
-	gact->hitimer.function = gate_timer_func;
+	hrtimer_setup(&gact->hitimer, gate_timer_func, clockid, HRTIMER_MODE_ABS_SOFT);
 }
 
 static int tcf_gate_init(struct net *net, struct nlattr *nla,
net/sched/sch_api.c +1 -2
index 74afc210527d..679d441e6074 100644
@@ -620,8 +620,7 @@ static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer)
 void qdisc_watchdog_init_clockid(struct qdisc_watchdog *wd, struct Qdisc *qdisc,
 				 clockid_t clockid)
 {
-	hrtimer_init(&wd->timer, clockid, HRTIMER_MODE_ABS_PINNED);
-	wd->timer.function = qdisc_watchdog;
+	hrtimer_setup(&wd->timer, qdisc_watchdog, clockid, HRTIMER_MODE_ABS_PINNED);
 	wd->qdisc = qdisc;
 }
 EXPORT_SYMBOL(qdisc_watchdog_init_clockid);
net/sched/sch_taprio.c +2 -4
index 8498d0606b24..9b8bc27e633d 100644
@@ -1932,8 +1932,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
 	if (!TXTIME_ASSIST_IS_ENABLED(q->flags) &&
 	    !FULL_OFFLOAD_IS_ENABLED(q->flags) &&
 	    !hrtimer_active(&q->advance_timer)) {
-		hrtimer_init(&q->advance_timer, q->clockid, HRTIMER_MODE_ABS);
-		q->advance_timer.function = advance_sched;
+		hrtimer_setup(&q->advance_timer, advance_sched, q->clockid, HRTIMER_MODE_ABS);
 	}
 
 	err = taprio_get_start_time(sch, new_admin, &start);
@@ -2055,8 +2054,7 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt,
 
 	spin_lock_init(&q->current_entry_lock);
 
-	hrtimer_init(&q->advance_timer, CLOCK_TAI, HRTIMER_MODE_ABS);
-	q->advance_timer.function = advance_sched;
+	hrtimer_setup(&q->advance_timer, advance_sched, CLOCK_TAI, HRTIMER_MODE_ABS);
 
 	q->root = sch;
 
Signature · 1 line
2.39.5
author
#3 lore raw

PATCH 3/24 mac802154: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 net/mac802154/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/mac802154/main.c +2 -2
index 21b7c3b280b4..ea1efef3572a 100644
@@ -213,8 +213,8 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
 		goto out_wq;
 	}
 
-	hrtimer_init(&local->ifs_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	local->ifs_timer.function = ieee802154_xmit_ifs_timer;
+	hrtimer_setup(&local->ifs_timer, ieee802154_xmit_ifs_timer, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	wpan_phy_set_dev(local->phy, local->hw.parent);
 
Signature · 1 line
2.39.5
author
#4 lore raw

PATCH 4/24 tcp: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 net/ipv4/tcp_timer.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
net/ipv4/tcp_timer.c +4 -6
index 79064580c8c0..6fa99cac98c2 100644
@@ -869,11 +869,9 @@ void tcp_init_xmit_timers(struct sock *sk)
 {
 	inet_csk_init_xmit_timers(sk, &tcp_write_timer, &tcp_delack_timer,
 				  &tcp_keepalive_timer);
-	hrtimer_init(&tcp_sk(sk)->pacing_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_ABS_PINNED_SOFT);
-	tcp_sk(sk)->pacing_timer.function = tcp_pace_kick;
+	hrtimer_setup(&tcp_sk(sk)->pacing_timer, tcp_pace_kick, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_ABS_PINNED_SOFT);
 
-	hrtimer_init(&tcp_sk(sk)->compressed_ack_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL_PINNED_SOFT);
-	tcp_sk(sk)->compressed_ack_timer.function = tcp_compressed_ack_kick;
+	hrtimer_setup(&tcp_sk(sk)->compressed_ack_timer, tcp_compressed_ack_kick, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL_PINNED_SOFT);
 }
Signature · 1 line
2.39.5
author
#5 lore raw

PATCH 5/24 can: m_can: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Marc Kleine-Budde <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/can/m_can/m_can.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/can/m_can/m_can.c +4 -5
index a978b960f1f1..183f6eceb7e9 100644
@@ -2383,12 +2383,11 @@ int m_can_class_register(struct m_can_classdev *cdev)
 
 	if (!cdev->net->irq) {
 		dev_dbg(cdev->dev, "Polling enabled, initialize hrtimer");
-		hrtimer_init(&cdev->hrtimer, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_REL_PINNED);
-		cdev->hrtimer.function = &hrtimer_callback;
+		hrtimer_setup(&cdev->hrtimer, &hrtimer_callback, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL_PINNED);
 	} else {
-		hrtimer_init(&cdev->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		cdev->hrtimer.function = m_can_coalescing_timer;
+		hrtimer_setup(&cdev->hrtimer, m_can_coalescing_timer, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL);
 	}
 
 	ret = m_can_dev_setup(cdev);
Signature · 1 line
2.39.5
author
#7 lore raw

PATCH 6/24 can: mcp251xfd: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Marc Kleine-Budde <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-ring.c +4 -4
index 83c18035b2a2..de2ae204beaa 100644
@@ -539,11 +539,11 @@ int mcp251xfd_ring_alloc(struct mcp251xfd_priv *priv)
 	}
 	priv->rx_ring_num = i;
 
-	hrtimer_init(&priv->rx_irq_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	priv->rx_irq_timer.function = mcp251xfd_rx_irq_timer;
+	hrtimer_setup(&priv->rx_irq_timer, mcp251xfd_rx_irq_timer, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
-	hrtimer_init(&priv->tx_irq_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	priv->tx_irq_timer.function = mcp251xfd_tx_irq_timer;
+	hrtimer_setup(&priv->tx_irq_timer, mcp251xfd_tx_irq_timer, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	return 0;
 }
Signature · 1 line
2.39.5
author
#9 lore raw

PATCH 7/24 can: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Marc Kleine-Budde <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 net/can/bcm.c             | 16 ++++++----------
 net/can/isotp.c           | 10 ++++------
 net/can/j1939/bus.c       |  4 ++--
 net/can/j1939/transport.c |  8 ++------
 4 files changed, 14 insertions(+), 24 deletions(-)
net/can/bcm.c +6 -10
index 792528f7bce2..2048cbbed138 100644
@@ -1012,9 +1012,8 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
 		op->ifindex = ifindex;
 
 		/* initialize uninitialized (kzalloc) structure */
-		hrtimer_init(&op->timer, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_REL_SOFT);
-		op->timer.function = bcm_tx_timeout_handler;
+		hrtimer_setup(&op->timer, bcm_tx_timeout_handler, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL_SOFT);
 
 		/* add this bcm_op to the list of the tx_ops */
 		list_add(&op->list, &bo->tx_ops);
@@ -1189,13 +1188,10 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
 		op->rx_ifindex = ifindex;
 
 		/* initialize uninitialized (kzalloc) structure */
-		hrtimer_init(&op->timer, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_REL_SOFT);
-		op->timer.function = bcm_rx_timeout_handler;
-
-		hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_REL_SOFT);
-		op->thrtimer.function = bcm_rx_thr_handler;
+		hrtimer_setup(&op->timer, bcm_rx_timeout_handler, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL_SOFT);
+		hrtimer_setup(&op->thrtimer, bcm_rx_thr_handler, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL_SOFT);
 
 		/* add this bcm_op to the list of the rx_ops */
 		list_add(&op->list, &bo->rx_ops);
net/can/isotp.c +4 -6
index 16046931542a..442c343afe1f 100644
@@ -1634,12 +1634,10 @@ static int isotp_init(struct sock *sk)
 	so->rx.buflen = ARRAY_SIZE(so->rx.sbuf);
 	so->tx.buflen = ARRAY_SIZE(so->tx.sbuf);
 
-	hrtimer_init(&so->rxtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
-	so->rxtimer.function = isotp_rx_timer_handler;
-	hrtimer_init(&so->txtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
-	so->txtimer.function = isotp_tx_timer_handler;
-	hrtimer_init(&so->txfrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
-	so->txfrtimer.function = isotp_txfr_timer_handler;
+	hrtimer_setup(&so->rxtimer, isotp_rx_timer_handler, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
+	hrtimer_setup(&so->txtimer, isotp_tx_timer_handler, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
+	hrtimer_setup(&so->txfrtimer, isotp_txfr_timer_handler, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL_SOFT);
 
 	init_waitqueue_head(&so->wait);
 	spin_lock_init(&so->rx_lock);
net/can/j1939/bus.c +2 -2
index 486687901602..39844f14eed8 100644
@@ -158,8 +158,8 @@ struct j1939_ecu *j1939_ecu_create_locked(struct j1939_priv *priv, name_t name)
 	ecu->addr = J1939_IDLE_ADDR;
 	ecu->name = name;
 
-	hrtimer_init(&ecu->ac_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
-	ecu->ac_timer.function = j1939_ecu_timer_handler;
+	hrtimer_setup(&ecu->ac_timer, j1939_ecu_timer_handler, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL_SOFT);
 	INIT_LIST_HEAD(&ecu->list);
 
 	j1939_priv_get(priv);
net/can/j1939/transport.c +2 -6
index 319f47df3330..7f97e7f97799 100644
@@ -1510,12 +1510,8 @@ static struct j1939_session *j1939_session_new(struct j1939_priv *priv,
 	skcb = j1939_skb_to_cb(skb);
 	memcpy(&session->skcb, skcb, sizeof(session->skcb));
 
-	hrtimer_init(&session->txtimer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL_SOFT);
-	session->txtimer.function = j1939_tp_txtimer;
-	hrtimer_init(&session->rxtimer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL_SOFT);
-	session->rxtimer.function = j1939_tp_rxtimer;
+	hrtimer_setup(&session->txtimer, j1939_tp_txtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
+	hrtimer_setup(&session->rxtimer, j1939_tp_rxtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
 
 	netdev_dbg(priv->ndev, "%s: 0x%p: sa: %02x, da: %02x\n",
 		   __func__, session, skcb->addr.sa, skcb->addr.da);
Signature · 1 line
2.39.5
author
#11 lore raw

PATCH 8/24 net: ethernet: ti: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/ti/am65-cpsw-nuss.c     | 9 ++++-----
 drivers/net/ethernet/ti/icssg/icssg_common.c | 5 ++---
 drivers/net/ethernet/ti/icssg/icssg_prueth.c | 5 ++---
 3 files changed, 8 insertions(+), 11 deletions(-)
drivers/net/ethernet/ti/am65-cpsw-nuss.c +4 -5
index cbe99017cbfa..ba5e32366fb8 100644
@@ -2236,8 +2236,8 @@ static int am65_cpsw_nuss_ndev_add_tx_napi(struct am65_cpsw_common *common)
 
 		netif_napi_add_tx(common->dma_ndev, &tx_chn->napi_tx,
 				  am65_cpsw_nuss_tx_poll);
-		hrtimer_init(&tx_chn->tx_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
-		tx_chn->tx_hrtimer.function = &am65_cpsw_nuss_tx_timer_callback;
+		hrtimer_setup(&tx_chn->tx_hrtimer, &am65_cpsw_nuss_tx_timer_callback,
+			      CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
 
 		ret = devm_request_irq(dev, tx_chn->irq,
 				       am65_cpsw_nuss_tx_irq,
@@ -2485,9 +2485,8 @@ static int am65_cpsw_nuss_init_rx_chns(struct am65_cpsw_common *common)
 			 dev_name(dev), i);
 		netif_napi_add(common->dma_ndev, &flow->napi_rx,
 			       am65_cpsw_nuss_rx_poll);
-		hrtimer_init(&flow->rx_hrtimer, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_REL_PINNED);
-		flow->rx_hrtimer.function = &am65_cpsw_nuss_rx_timer_callback;
+		hrtimer_setup(&flow->rx_hrtimer, &am65_cpsw_nuss_rx_timer_callback, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL_PINNED);
 
 		ret = devm_request_irq(dev, flow->irq,
 				       am65_cpsw_nuss_rx_irq,
drivers/net/ethernet/ti/icssg/icssg_common.c +2 -3
index fdebeb2f84e0..16ca4b1fc01b 100644
@@ -249,9 +249,8 @@ int prueth_ndev_add_tx_napi(struct prueth_emac *emac)
 		struct prueth_tx_chn *tx_chn = &emac->tx_chns[i];
 
 		netif_napi_add_tx(emac->ndev, &tx_chn->napi_tx, emac_napi_tx_poll);
-		hrtimer_init(&tx_chn->tx_hrtimer, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_REL_PINNED);
-		tx_chn->tx_hrtimer.function = &emac_tx_timer_callback;
+		hrtimer_setup(&tx_chn->tx_hrtimer, &emac_tx_timer_callback, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL_PINNED);
 		ret = request_irq(tx_chn->irq, prueth_tx_irq,
 				  IRQF_TRIGGER_HIGH, tx_chn->name,
 				  tx_chn);
drivers/net/ethernet/ti/icssg/icssg_prueth.c +2 -3
index 5fd9902ab181..fe5c32be1ab3 100644
@@ -951,9 +951,8 @@ static int prueth_netdev_init(struct prueth *prueth,
 	ndev->hw_features |= NETIF_PRUETH_HSR_OFFLOAD_FEATURES;
 
 	netif_napi_add(ndev, &emac->napi_rx, icssg_napi_rx_poll);
-	hrtimer_init(&emac->rx_hrtimer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL_PINNED);
-	emac->rx_hrtimer.function = &emac_rx_timer_callback;
+	hrtimer_setup(&emac->rx_hrtimer, &emac_rx_timer_callback, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL_PINNED);
 	prueth->emac[mac] = emac;
 
 	return 0;
Signature · 1 line
2.39.5
author
#12 lore raw

PATCH 9/24 net: ethernet: cortina: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/cortina/gemini.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/cortina/gemini.c +2 -3
index 73e1c71c5092..5347431a089f 100644
@@ -1833,9 +1833,8 @@ static int gmac_open(struct net_device *netdev)
 	gmac_enable_tx_rx(netdev);
 	netif_tx_start_all_queues(netdev);
 
-	hrtimer_init(&port->rx_coalesce_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL);
-	port->rx_coalesce_timer.function = &gmac_coalesce_delay_expired;
+	hrtimer_setup(&port->rx_coalesce_timer, &gmac_coalesce_delay_expired, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	netdev_dbg(netdev, "opened\n");
 
Signature · 1 line
2.39.5
author
#13 lore raw

PATCH 10/24 net: ethernet: ec_bhf: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/ec_bhf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/ec_bhf.c +1 -2
index 44af1d13d931..67275aa4f65b 100644
@@ -416,8 +416,7 @@ static int ec_bhf_open(struct net_device *net_dev)
 
 	netif_start_queue(net_dev);
 
-	hrtimer_init(&priv->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	priv->hrtimer.function = ec_bhf_timer_fun;
+	hrtimer_setup(&priv->hrtimer, ec_bhf_timer_fun, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	hrtimer_start(&priv->hrtimer, polling_frequency, HRTIMER_MODE_REL);
 
 	return 0;
Signature · 1 line
2.39.5
author
#14 lore raw

PATCH 11/24 net: ethernet: hisilicon: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/hisilicon/hip04_eth.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hip04_eth.c +1 -3
index beb815e5289b..bea8b79e69b2 100644
@@ -934,8 +934,6 @@ static int hip04_mac_probe(struct platform_device *pdev)
 	priv->chan = arg.args[1] * RX_DESC_NUM;
 	priv->group = arg.args[2];
 
-	hrtimer_init(&priv->tx_coalesce_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-
 	/* BQL will try to keep the TX queue as short as possible, but it can't
 	 * be faster than tx_coalesce_usecs, so we need a fast timeout here,
 	 * but also long enough to gather up enough frames to ensure we don't
@@ -944,7 +942,7 @@ static int hip04_mac_probe(struct platform_device *pdev)
 	 */
 	priv->tx_coalesce_frames = TX_DESC_NUM * 3 / 4;
 	priv->tx_coalesce_usecs = 200;
-	priv->tx_coalesce_timer.function = tx_done;
+	hrtimer_setup(&priv->tx_coalesce_timer, tx_done, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 
 	priv->map = syscon_node_to_regmap(arg.np);
 	of_node_put(arg.np);
Signature · 1 line
2.39.5
author
#15 lore raw

PATCH 12/24 net: sparx5: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/microchip/sparx5/sparx5_packet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c +2 -2
index f3f5fb420468..89e25292d8f9 100644
@@ -356,6 +356,6 @@ irqreturn_t sparx5_xtr_handler(int irq, void *_sparx5)
 
 void sparx5_port_inj_timer_setup(struct sparx5_port *port)
 {
-	hrtimer_init(&port->inj_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	port->inj_timer.function = sparx5_injection_timeout;
+	hrtimer_setup(&port->inj_timer, sparx5_injection_timeout, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 }
Signature · 1 line
2.39.5
author
#16 lore raw

PATCH 13/24 net: ieee802154: at86rf230: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ieee802154/at86rf230.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ieee802154/at86rf230.c +2 -2
index f632b0cfd5ae..fd91f8a45bce 100644
@@ -776,8 +776,8 @@ at86rf230_setup_spi_messages(struct at86rf230_local *lp,
 	state->trx.tx_buf = state->buf;
 	state->trx.rx_buf = state->buf;
 	spi_message_add_tail(&state->trx, &state->msg);
-	hrtimer_init(&state->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	state->timer.function = at86rf230_async_state_timer;
+	hrtimer_setup(&state->timer, at86rf230_async_state_timer, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 }
 
 static irqreturn_t at86rf230_isr(int irq, void *data)
Signature · 1 line
2.39.5
author
#17 lore raw

PATCH 14/24 net: mvpp2: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +2 -3
index 3880dcc0418b..03038402957e 100644
@@ -6914,9 +6914,8 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 		for (thread = 0; thread < priv->nthreads; thread++) {
 			port_pcpu = per_cpu_ptr(port->pcpu, thread);
 
-			hrtimer_init(&port_pcpu->tx_done_timer, CLOCK_MONOTONIC,
-				     HRTIMER_MODE_REL_PINNED_SOFT);
-			port_pcpu->tx_done_timer.function = mvpp2_hr_timer_cb;
+			hrtimer_setup(&port_pcpu->tx_done_timer, mvpp2_hr_timer_cb, CLOCK_MONOTONIC,
+				      HRTIMER_MODE_REL_PINNED_SOFT);
 			port_pcpu->timer_scheduled = false;
 			port_pcpu->dev = dev;
 		}
Signature · 1 line
2.39.5
author
#18 lore raw

PATCH 15/24 net: qualcomm: rmnet: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +2 -2
index a5e3d1a88305..8b4640c5d61e 100644
@@ -686,8 +686,8 @@ void rmnet_map_update_ul_agg_config(struct rmnet_port *port, u32 size,
 
 void rmnet_map_tx_aggregate_init(struct rmnet_port *port)
 {
-	hrtimer_init(&port->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	port->hrtimer.function = rmnet_map_flush_tx_packet_queue;
+	hrtimer_setup(&port->hrtimer, rmnet_map_flush_tx_packet_queue, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 	spin_lock_init(&port->agg_lock);
 	rmnet_map_update_ul_agg_config(port, 4096, 1, 800);
 	INIT_WORK(&port->agg_wq, rmnet_map_flush_tx_packet_work);
Signature · 1 line
2.39.5
author
#19 lore raw

PATCH 16/24 net: stmmac: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -4
index e2140482270a..61ed82561168 100644
@@ -3148,8 +3148,7 @@ static void stmmac_init_coalesce(struct stmmac_priv *priv)
 		priv->tx_coal_frames[chan] = STMMAC_TX_FRAMES;
 		priv->tx_coal_timer[chan] = STMMAC_COAL_TX_TIMER;
 
-		hrtimer_init(&tx_q->txtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		tx_q->txtimer.function = stmmac_tx_timer;
+		hrtimer_setup(&tx_q->txtimer, stmmac_tx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	}
 
 	for (chan = 0; chan < rx_channel_count; chan++)
@@ -6967,8 +6966,7 @@ int stmmac_xdp_open(struct net_device *dev)
 		stmmac_set_tx_tail_ptr(priv, priv->ioaddr,
 				       tx_q->tx_tail_addr, chan);
 
-		hrtimer_init(&tx_q->txtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		tx_q->txtimer.function = stmmac_tx_timer;
+		hrtimer_setup(&tx_q->txtimer, stmmac_tx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	}
 
 	/* Enable the MAC Rx/Tx */
Signature · 1 line
2.39.5
author
#20 lore raw

PATCH 17/24 net: fec: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/freescale/fec_ptp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/fec_ptp.c +2 -2
index 4cffda363a14..b357967d56b6 100644
@@ -738,8 +738,8 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)
 
 	INIT_DELAYED_WORK(&fep->time_keep, fec_time_keep);
 
-	hrtimer_init(&fep->perout_timer, CLOCK_REALTIME, HRTIMER_MODE_REL);
-	fep->perout_timer.function = fec_ptp_pps_perout_handler;
+	hrtimer_setup(&fep->perout_timer, fec_ptp_pps_perout_handler, CLOCK_REALTIME,
+		      HRTIMER_MODE_REL);
 
 	irq = platform_get_irq_byname_optional(pdev, "pps");
 	if (irq < 0)
Signature · 1 line
2.39.5
author
#21 lore raw

PATCH 18/24 net: wwan: iosm: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/wwan/iosm/iosm_ipc_imem.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)
drivers/net/wwan/iosm/iosm_ipc_imem.c +10 -14
index 829515a601b3..530a3ea47a1a 100644
@@ -1381,24 +1381,20 @@ struct iosm_imem *ipc_imem_init(struct iosm_pcie *pcie, unsigned int device_id,
 	/* The phase is set to power off. */
 	ipc_imem->phase = IPC_P_OFF;
 
-	hrtimer_init(&ipc_imem->startup_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL);
-	ipc_imem->startup_timer.function = ipc_imem_startup_timer_cb;
+	hrtimer_setup(&ipc_imem->startup_timer, ipc_imem_startup_timer_cb, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
-	hrtimer_init(&ipc_imem->tdupdate_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL);
-	ipc_imem->tdupdate_timer.function = ipc_imem_td_update_timer_cb;
+	hrtimer_setup(&ipc_imem->tdupdate_timer, ipc_imem_td_update_timer_cb, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
-	hrtimer_init(&ipc_imem->fast_update_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL);
-	ipc_imem->fast_update_timer.function = ipc_imem_fast_update_timer_cb;
+	hrtimer_setup(&ipc_imem->fast_update_timer, ipc_imem_fast_update_timer_cb, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
-	hrtimer_init(&ipc_imem->td_alloc_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL);
-	ipc_imem->td_alloc_timer.function = ipc_imem_td_alloc_timer_cb;
+	hrtimer_setup(&ipc_imem->td_alloc_timer, ipc_imem_td_alloc_timer_cb, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
-	hrtimer_init(&ipc_imem->adb_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	ipc_imem->adb_timer.function = ipc_imem_adb_timer_cb;
+	hrtimer_setup(&ipc_imem->adb_timer, ipc_imem_adb_timer_cb, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	if (ipc_imem_config(ipc_imem)) {
 		dev_err(ipc_imem->dev, "failed to initialize the imem");
Signature · 1 line
2.39.5
author
#22 lore raw

PATCH 19/24 net/cdc_ncm: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Oliver Neukum <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/usb/cdc_ncm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/usb/cdc_ncm.c +1 -2
index d5c47a2a62dc..34e82f1e37d9 100644
@@ -833,8 +833,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
 
 	ctx->dev = dev;
 
-	hrtimer_init(&ctx->tx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	ctx->tx_timer.function = &cdc_ncm_tx_timer_cb;
+	hrtimer_setup(&ctx->tx_timer, &cdc_ncm_tx_timer_cb, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	tasklet_setup(&ctx->bh, cdc_ncm_txpath_bh);
 	atomic_set(&ctx->stop, 0);
 	spin_lock_init(&ctx->mtx);
Signature · 1 line
2.39.5
author
#23 lore raw

PATCH 20/24 wifi: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Kalle Valo <[email protected]>

---
 drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c | 4 ++--
 drivers/net/wireless/virtual/mac80211_hwsim.c         | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c +2 -2
index 0e1ede9314d8..4840d0b500b3 100644
@@ -264,8 +264,8 @@ void mt76x02u_init_beacon_config(struct mt76x02_dev *dev)
 	};
 	dev->beacon_ops = &beacon_ops;
 
-	hrtimer_init(&dev->pre_tbtt_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	dev->pre_tbtt_timer.function = mt76x02u_pre_tbtt_interrupt;
+	hrtimer_setup(&dev->pre_tbtt_timer, mt76x02u_pre_tbtt_interrupt, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 	INIT_WORK(&dev->pre_tbtt_work, mt76x02u_pre_tbtt_work);
 
 	mt76x02_init_beacon_config(dev);
drivers/net/wireless/virtual/mac80211_hwsim.c +2 -4
index f0e528abb1b4..3695f79fec95 100644
@@ -5509,10 +5509,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
 	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
 
 	for (i = 0; i < ARRAY_SIZE(data->link_data); i++) {
-		hrtimer_init(&data->link_data[i].beacon_timer, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_ABS_SOFT);
-		data->link_data[i].beacon_timer.function =
-			mac80211_hwsim_beacon;
+		hrtimer_setup(&data->link_data[i].beacon_timer, mac80211_hwsim_beacon,
+			      CLOCK_MONOTONIC, HRTIMER_MODE_ABS_SOFT);
 		data->link_data[i].link_id = i;
 	}
 
Signature · 1 line
2.39.5
author
#24 lore raw

PATCH 21/24 wifi: rt2x00: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a new function hrtimer_setup() which will replace hrtimer_init() and also set the timer callback function with additional sanity checks.

This driver calls hrtimer_init() in rt2x00dev.c, then set the hrtimer's callback function in rt2800mmio.c and rt2800usb.c. Therefore, switching to the new function is not a simple one-for-one replacement.

Because only usb/mmio variants of this driver use hrtimer, ideally all hrtimer code should be moved in those specific parts. However, all usage of hrtimer_cancel() should be moved as well, and that is not so obvious to do.

With the lack of hardware to verify any non-trivial changes, introduce a dummy timer callback function and use hrtimer_setup() instead of hrtimer_init().

---
Cc: Kalle Valo <[email protected]>

---
 drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +7 -2
index 9e7d9dbe954c..187701a8f8c8 100644
@@ -1362,6 +1362,11 @@ static unsigned int rt2x00dev_extra_tx_headroom(struct rt2x00_dev *rt2x00dev)
 	return rt2x00dev->tx[0].winfo_size;
 }
 
+static enum hrtimer_restart rt2x00lib_dummy_timeout(struct hrtimer *timer)
+{
+	return HRTIMER_NORESTART;
+}
+
 /*
  * driver allocation handlers.
  */
@@ -1391,8 +1396,8 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
 	mutex_init(&rt2x00dev->conf_mutex);
 	INIT_LIST_HEAD(&rt2x00dev->bar_list);
 	spin_lock_init(&rt2x00dev->bar_list_lock);
-	hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL);
+	hrtimer_setup(&rt2x00dev->txstatus_timer, rt2x00lib_dummy_timeout, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
 
Signature · 1 line
2.39.5
author
#25 lore raw

PATCH 22/24 igc: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/intel/igc/igc_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +2 -2
index 6e70bca15db1..dd5190a2a4f0 100644
@@ -7103,8 +7103,8 @@ static int igc_probe(struct pci_dev *pdev,
 	INIT_WORK(&adapter->reset_task, igc_reset_task);
 	INIT_WORK(&adapter->watchdog_task, igc_watchdog_task);
 
-	hrtimer_init(&adapter->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	adapter->hrtimer.function = &igc_qbv_scheduling_timer;
+	hrtimer_setup(&adapter->hrtimer, &igc_qbv_scheduling_timer, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	/* Initialize link properties that are user-changeable */
 	adapter->fc_autoneg = true;
Signature · 1 line
2.39.5
author
#26 lore raw

PATCH 23/24 octeontx2-pf: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/marvell/octeontx2/af/ptp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/ptp.c +1 -2
index bcc96eed2481..66749b3649c1 100644
@@ -545,8 +545,7 @@ static int ptp_probe(struct pci_dev *pdev,
 	spin_lock_init(&ptp->ptp_lock);
 	if (cn10k_ptp_errata(ptp)) {
 		ptp->read_ptp_tstmp = &read_ptp_tstmp_sec_nsec;
-		hrtimer_init(&ptp->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		ptp->hrtimer.function = ptp_reset_thresh;
+		hrtimer_setup(&ptp->hrtimer, ptp_reset_thresh, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	} else {
 		ptp->read_ptp_tstmp = &read_ptp_tstmp_nsec;
 	}
Signature · 1 line
2.39.5
author
#27 lore raw

PATCH 24/24 xfrm: Switch to use hrtimer_setup()

In reply to Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

---
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 net/xfrm/xfrm_state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/xfrm/xfrm_state.c +2 -2
index 37478d36a8df..ee0581d45d9c 100644
@@ -669,8 +669,8 @@ struct xfrm_state *xfrm_state_alloc(struct net *net)
 		INIT_HLIST_NODE(&x->bysrc);
 		INIT_HLIST_NODE(&x->byspi);
 		INIT_HLIST_NODE(&x->byseq);
-		hrtimer_init(&x->mtimer, CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
-		x->mtimer.function = xfrm_timer_handler;
+		hrtimer_setup(&x->mtimer, xfrm_timer_handler, CLOCK_BOOTTIME,
+			      HRTIMER_MODE_ABS_SOFT);
 		timer_setup(&x->rtimer, xfrm_replay_timer_handler, 0);
 		x->curlft.add_time = ktime_get_real_seconds();
 		x->lft.soft_byte_limit = XFRM_INF;
Signature · 1 line
2.39.5
maintainer Reviewed-by on v1 5/24
#6 lore raw

Re: [PATCH 05/24] can: m_can: Switch to use hrtimer_setup()

In reply to Nam Cao
Quoted 9 lines · Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |
maintainer Reviewed-by on v1 6/24
#8 lore raw

Re: [PATCH 06/24] can: mcp251xfd: Switch to use hrtimer_setup()

In reply to Nam Cao
Quoted 9 lines · Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |
maintainer Reviewed-by on v1 7/24
#10 lore raw

Re: [PATCH 07/24] can: Switch to use hrtimer_setup()

In reply to Nam Cao
Quoted 9 lines · Nam Cao

There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function.

Switch to use this new function.

Patch was created by using Coccinelle.

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |