]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
r8169: simplify code by using core-provided pcpu stats allocation
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 10 Feb 2024 16:58:29 +0000 (17:58 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 13 Feb 2024 12:21:48 +0000 (13:21 +0100)
Use core-provided pcpu stats allocation instead of open-coding it in
the driver.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/03f5bb3b-d7f4-48be-ae8a-54862ec4566c@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/realtek/r8169_main.c

index b43db3c49d825d9eb2e6cb2be94b73e8b8273966..ddfa6f62472a1e0643fee3db6acce32ea53be474 100644 (file)
@@ -5233,11 +5233,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        raw_spin_lock_init(&tp->mac_ocp_lock);
        mutex_init(&tp->led_lock);
 
-       dev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev,
-                                                  struct pcpu_sw_netstats);
-       if (!dev->tstats)
-               return -ENOMEM;
-
        /* Get the *optional* external "ether_clk" used on some boards */
        tp->clk = devm_clk_get_optional_enabled(&pdev->dev, "ether_clk");
        if (IS_ERR(tp->clk))
@@ -5352,6 +5347,8 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        dev->hw_features |= NETIF_F_RXALL;
        dev->hw_features |= NETIF_F_RXFCS;
 
+       dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
+
        netdev_sw_irq_coalesce_default_on(dev);
 
        /* configure chip for default features */