Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com --- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 13 ++++++++----- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index bc35d57..e91ac9f 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c @@ -2216,9 +2216,11 @@ static int pch_gbe_set_features(struct net_device *netdev, netdev_features_t features) { struct pch_gbe_adapter *adapter = netdev_priv(netdev); - netdev_features_t changed = features ^ netdev->features; + netdev_features_t changed;
- if (!(changed & NETIF_F_RXCSUM)) + netdev_feature_xor(&changed, features, netdev->features); + + if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed)) return 0;
if (netif_running(netdev)) @@ -2529,9 +2531,10 @@ static int pch_gbe_probe(struct pci_dev *pdev, netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD; netif_napi_add(netdev, &adapter->napi, pch_gbe_napi_poll, PCH_GBE_RX_WEIGHT); - netdev->hw_features = NETIF_F_RXCSUM | - NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; - netdev->features = netdev->hw_features; + netdev_feature_zero(&netdev->hw_features); + netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM | + NETIF_F_IPV6_CSUM, &netdev->hw_features); + netdev_feature_copy(&netdev->features, netdev->hw_features); pch_gbe_set_ethtool_ops(netdev);
/* MTU range: 46 - 10300 */ diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c index 81fc5a6..1e3a909 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c @@ -477,7 +477,8 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter) val = XsumRX; pch_gbe_validate_option(&val, &opt, adapter); if (!val) - dev->features &= ~NETIF_F_RXCSUM; + netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT, + &dev->features); } { /* Checksum Offload Enable/Disable */ static const struct pch_gbe_option opt = { @@ -489,7 +490,8 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter) val = XsumTX; pch_gbe_validate_option(&val, &opt, adapter); if (!val) - dev->features &= ~NETIF_F_CSUM_MASK; + netdev_feature_clear_bits(NETIF_F_CSUM_MASK, + &dev->features); } { /* Flow Control */ static const struct pch_gbe_option opt = {