]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: eth: convert set_features() to regmap
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Thu, 23 Apr 2026 18:13:45 +0000 (20:13 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 26 Apr 2026 22:38:17 +0000 (00:38 +0200)
Use regmap_assign_bits() for conversion and much simpler code.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/23067
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/realtek/files-6.18/drivers/net/ethernet/rtl838x_eth.c

index 178089ea2718db0d86e06fa10495b51e7d2474db..484f162bb3998ab73aba1ee225a1d7be4784b1a1 100644 (file)
@@ -1272,12 +1272,8 @@ static int rteth_83xx_set_features(struct net_device *dev, netdev_features_t fea
 {
        struct rteth_ctrl *ctrl = netdev_priv(dev);
 
-       if ((features ^ dev->features) & NETIF_F_RXCSUM) {
-               if (!(features & NETIF_F_RXCSUM))
-                       sw_w32_mask(BIT(3), 0, ctrl->r->mac_l2_port_ctrl);
-               else
-                       sw_w32_mask(0, BIT(3), ctrl->r->mac_l2_port_ctrl);
-       }
+       if ((features ^ dev->features) & NETIF_F_RXCSUM)
+               regmap_assign_bits(ctrl->map, ctrl->r->mac_l2_port_ctrl, BIT(3), features & NETIF_F_RXCSUM);
 
        return 0;
 }
@@ -1286,12 +1282,8 @@ static int rteth_93xx_set_features(struct net_device *dev, netdev_features_t fea
 {
        struct rteth_ctrl *ctrl = netdev_priv(dev);
 
-       if ((features ^ dev->features) & NETIF_F_RXCSUM) {
-               if (!(features & NETIF_F_RXCSUM))
-                       sw_w32_mask(BIT(4), 0, ctrl->r->mac_l2_port_ctrl);
-               else
-                       sw_w32_mask(0, BIT(4), ctrl->r->mac_l2_port_ctrl);
-       }
+       if ((features ^ dev->features) & NETIF_F_RXCSUM)
+               regmap_assign_bits(ctrl->map, ctrl->r->mac_l2_port_ctrl, BIT(4), features & NETIF_F_RXCSUM);
 
        return 0;
 }