]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: ethernet: ti: Switch to use hrtimer_setup()
authorNam Cao <namcao@linutronix.de>
Wed, 5 Feb 2025 10:43:28 +0000 (11:43 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 18 Feb 2025 09:35:45 +0000 (10:35 +0100)
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.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/bd34d3d0dba9a47b6ec5d14776941e9aa118c7d2.1738746872.git.namcao@linutronix.de
drivers/net/ethernet/ti/am65-cpsw-nuss.c
drivers/net/ethernet/ti/icssg/icssg_common.c
drivers/net/ethernet/ti/icssg/icssg_prueth.c

index 2806238629f823ca4f708fa0c1ba9e86fef4d441..361169db4befb16019c4796c680ddebd2a40649c 100644 (file)
@@ -2311,8 +2311,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,
@@ -2565,9 +2565,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,
index 74f0f200a89d4f353223b8263766b77b7f88726d..6c1b8ff563e06892c75d5b897d0014381235e3f4 100644 (file)
@@ -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);
index 00ed978605478443e0e48e3f173586371e2aa1c7..d3bdde6bd3aac42002d5ff588d54f116cf6fca8c 100644 (file)
@@ -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;