hrtimers: Consolidate hrtimer initialization - Part 3
Subsystems (34)
v2 cover hrtimers: Consolidate hrtimer initialization - Part 3
hrtimers is initialized with hrtimer_init(), and after that the timer's callback function is setup separately. This separate initialization is error prone and awkward to use.
hrtimer_setup() combines the initialization and is simpler to use.
Switch to use the new setup function. Most conversions were done with Coccinelle, see the sematic patch below.
This series is intended to be applied to the tip tree.
v1 -> v2 https://lore.kernel.org/lkml/[email protected]
- rebase to v6.14-rc1
- use the existing hrtimer_dummy_timeout() for rt2x00 driver and bcm driver
---
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]>
--- 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 | 4 ++-- drivers/net/wireless/virtual/mac80211_hwsim.c | 6 ++--- drivers/net/wwan/iosm/iosm_ipc_imem.c | 24 ++++++++----------- include/linux/hrtimer.h | 5 ++++ kernel/time/hrtimer.c | 5 ---- net/can/bcm.c | 20 +++++++--------- 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_iptfs.c | 6 ++--- net/xfrm/xfrm_state.c | 4 ++-- 35 files changed, 88 insertions(+), 126 deletions(-)
Signature · 1 line
2.39.5
PATCH v2 1/24 netdev: Switch to use hrtimer_setup()
hrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- net/core/dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/core/dev.c +1 -2
@@ -6931,8 +6931,7 @@ void netif_napi_add_weight_locked(struct net_device *dev,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
PATCH v2 2/24 net/sched: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -287,8 +287,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
@@ -619,8 +619,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
@@ -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);
@@ -2056,8 +2055,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
PATCH v2 3/24 mac802154: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- net/mac802154/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mac802154/main.c +2 -2
@@ -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
PATCH v2 4/24 tcp: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- net/ipv4/tcp_timer.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/ipv4/tcp_timer.c +4 -6
@@ -884,11 +884,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
PATCH v2 5/24 can: m_can: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -2420,12 +2420,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
PATCH v2 6/24 can: mcp251xfd: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -541,11 +541,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
PATCH v2 7/24 can: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Most of this patch is generated by Coccinelle. Except for the TX thrtimer in bcm_tx_setup() because this timer is not used and the callback function is never set. For this particular case, set the callback to hrtimer_dummy_timeout()
---
v2:
- Use hrtimer_dummy_timeout() for bcm TX thrtimer
--- include/linux/hrtimer.h | 5 +++++ kernel/time/hrtimer.c | 5 ----- net/can/bcm.c | 20 ++++++++------------ net/can/isotp.c | 10 ++++------ net/can/j1939/bus.c | 4 ++-- net/can/j1939/transport.c | 8 ++------ 6 files changed, 21 insertions(+), 31 deletions(-)
include/linux/hrtimer.h +5 -0
@@ -223,6 +223,11 @@ static inline void hrtimer_cancel_wait_running(struct hrtimer *timer) }#endif +static inline enum hrtimer_restart hrtimer_dummy_timeout (struct hrtimer *unused) +{ +return HRTIMER_NORESTART ; +} +/* Exported timer functions: */ /* Initialize timers: */
kernel/time/hrtimer.c +0 -5
@@ -1597,11 +1597,6 @@ static inline int hrtimer_clockid_to_base(clockid_t clock_id)return HRTIMER_BASE_MONOTONIC ; } -static enum hrtimer_restart hrtimer_dummy_timeout (struct hrtimer *unused) -{ -return HRTIMER_NORESTART ; -} -static void __hrtimer_init (struct hrtimer *timer,clockid_t clock_id,enum hrtimer_mode mode) {
net/can/bcm.c +8 -12
@@ -1011,13 +1011,12 @@ 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 );/* currently unused in tx_ops */ -hrtimer_init (&op->thrtimer,CLOCK_MONOTONIC , -HRTIMER_MODE_REL_SOFT ); +hrtimer_setup (&op->thrtimer, hrtimer_dummy_timeout,CLOCK_MONOTONIC , +HRTIMER_MODE_REL_SOFT );/* add this bcm_op to the list of the tx_ops */ list_add (&op->list, &bo->tx_ops);
@@ -1192,13 +1191,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
@@ -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
@@ -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
@@ -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
PATCH v2 8/24 net: ethernet: ti: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -2299,8 +2299,8 @@ static int am65_cpsw_nuss_ndev_add_tx_napi(struct am65_cpsw_common *common)for (i =0 ; i < common->tx_ch_num; i++) {struct am65_cpsw_tx_chn *tx_chn = &common->tx_chns[i]; -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,
@@ -2553,9 +2553,8 @@ static int am65_cpsw_nuss_init_rx_chns(struct am65_cpsw_common *common)snprintf (flow->name,sizeof (flow->name),"%s-rx%d" ,dev_name (dev), i); -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
@@ -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
@@ -1169,9 +1169,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
PATCH v2 9/24 net: ethernet: cortina: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- drivers/net/ethernet/cortina/gemini.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/cortina/gemini.c +2 -3
@@ -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
PATCH v2 10/24 net: ethernet: ec_bhf: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- drivers/net/ethernet/ec_bhf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/ec_bhf.c +1 -2
@@ -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
PATCH v2 11/24 net: ethernet: hisilicon: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- drivers/net/ethernet/hisilicon/hip04_eth.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hip04_eth.c +1 -3
@@ -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
PATCH v2 12/24 net: sparx5: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
--- 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
@@ -375,6 +375,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
PATCH v2 13/24 net: ieee802154: at86rf230: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
--- drivers/net/ieee802154/at86rf230.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ieee802154/at86rf230.c +2 -2
@@ -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
PATCH v2 14/24 net: mvpp2: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -6985,9 +6985,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
PATCH v2 15/24 net: qualcomm: rmnet: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -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
PATCH v2 16/24 net: stmmac: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -3184,8 +3184,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++)
@@ -6952,8 +6951,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
PATCH v2 17/24 net: fec: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- drivers/net/ethernet/freescale/fec_ptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/fec_ptp.c +2 -2
@@ -739,8 +739,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
PATCH v2 18/24 net: wwan: iosm: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -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
PATCH v2 19/24 net/cdc_ncm: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- drivers/net/usb/cdc_ncm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/usb/cdc_ncm.c +1 -2
@@ -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
PATCH v2 20/24 wifi: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -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
@@ -5548,10 +5548,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
PATCH v2 21/24 wifi: rt2x00: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely. This new function replaces hrtimer_init().
However, converting this driver is not obvious: the 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.
With the lack of hardware to verify any non-trivial changes, keep it simple and calls hrtimer_setup() with hrtimer_dummy_timeout() as callback function pointer.
--- drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +2 -2
@@ -1391,8 +1391,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, hrtimer_dummy_timeout,CLOCK_MONOTONIC , +HRTIMER_MODE_REL );set_bit (DEVICE_STATE_PRESENT , &rt2x00dev->flags);
Signature · 1 line
2.39.5
PATCH v2 22/24 igc: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -7086,8 +7086,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
PATCH v2 23/24 octeontx2-pf: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
Patch was created by using Coccinelle.
--- 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
@@ -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
PATCH v2 24/24 xfrm: Switch to use hrtimer_setup()
In reply to Nam Caohrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.
Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.
--- net/xfrm/xfrm_iptfs.c | 6 ++---- net/xfrm/xfrm_state.c | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-)
net/xfrm/xfrm_iptfs.c +2 -4
@@ -2625,12 +2625,10 @@ static void __iptfs_init_state(struct xfrm_state *x, struct xfrm_iptfs_data *xtfs) {__skb_queue_head_init (&xtfs->queue); -hrtimer_init (&xtfs->iptfs_timer,CLOCK_MONOTONIC ,IPTFS_HRTIMER_MODE ); - xtfs->iptfs_timer.function = iptfs_delay_timer; +hrtimer_setup (&xtfs->iptfs_timer, iptfs_delay_timer,CLOCK_MONOTONIC ,IPTFS_HRTIMER_MODE );spin_lock_init (&xtfs->drop_lock); -hrtimer_init (&xtfs->drop_timer,CLOCK_MONOTONIC ,IPTFS_HRTIMER_MODE ); - xtfs->drop_timer.function = iptfs_drop_timer; +hrtimer_setup (&xtfs->drop_timer, iptfs_drop_timer,CLOCK_MONOTONIC ,IPTFS_HRTIMER_MODE );/* Modify type (esp) adjustment values */
net/xfrm/xfrm_state.c +2 -2
@@ -746,8 +746,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