@@ -586,14 +586,17 @@ static int dm9000_set_features(struct net_device *dev,
netdev_features_t features)
{
struct board_info *dm = to_dm9000_board(dev);
- netdev_features_t changed = dev->features ^ features;
+ netdev_features_t changed;
unsigned long flags;
- if (!(changed & NETIF_F_RXCSUM))
+ netdev_feature_xor(&changed, dev->features, features);
+ if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed))
return 0;
spin_lock_irqsave(&dm->lock, flags);
- iow(dm, DM9000_RCSR, (features & NETIF_F_RXCSUM) ? RCSR_CSUM : 0);
+ iow(dm, DM9000_RCSR,
+ netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, features) ?
+ RCSR_CSUM : 0);
spin_unlock_irqrestore(&dm->lock, flags);
return 0;
@@ -911,9 +914,10 @@ dm9000_init_dm9000(struct net_device *dev)
db->io_mode = ior(db, DM9000_ISR) >> 6; /* ISR bit7:6 keeps I/O mode */
/* Checksum mode */
- if (dev->hw_features & NETIF_F_RXCSUM)
+ if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, dev->hw_features))
iow(db, DM9000_RCSR,
- (dev->features & NETIF_F_RXCSUM) ? RCSR_CSUM : 0);
+ netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
+ dev->features) ? RCSR_CSUM : 0);
iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */
iow(db, DM9000_GPR, 0);
@@ -1169,7 +1173,8 @@ dm9000_rx(struct net_device *dev)
/* Pass to upper layer */
skb->protocol = eth_type_trans(skb, dev);
- if (dev->features & NETIF_F_RXCSUM) {
+ if (netdev_feature_test_bit(NETIF_F_RXCSUM_BIT,
+ dev->features)) {
if ((((rxbyte & 0x1c) << 3) & rxbyte) == 0)
skb->ip_summed = CHECKSUM_UNNECESSARY;
else
@@ -1643,8 +1648,11 @@ dm9000_probe(struct platform_device *pdev)
/* dm9000a/b are capable of hardware checksum offload */
if (db->type == TYPE_DM9000A || db->type == TYPE_DM9000B) {
- ndev->hw_features = NETIF_F_RXCSUM | NETIF_F_IP_CSUM;
- ndev->features |= ndev->hw_features;
+ netdev_feature_zero(&ndev->hw_features);
+ netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM,
+ &ndev->hw_features);
+ netdev_feature_or(&ndev->features, ndev->features,
+ ndev->hw_features);
}
/* from this point we assume that we have found a DM9000 */
Use netdev_feature_xxx helpers to replace the logical operation for netdev features. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/net/ethernet/davicom/dm9000.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)