Skip to content

Commit 7bddccc

Browse files
claudiubezneadavem330
authored andcommitted
net: ravb: Move the update of ndev->features to ravb_set_features()
Commit c2da940 ("ravb: Add Rx checksum offload support for GbEth") introduced support for setting GbEth features. With this the IP-specific features update functions update the ndev->features individually. Next commits add runtime PM support for the ravb driver. The runtime PM implementation will enable/disable the IP clocks on the ravb_open()/ravb_close() functions. Accessing the IP registers with clocks disabled blocks the system. The ravb_set_features() function could be executed when the Ethernet interface is closed so we need to ensure we don't access IP registers while the interface is down when runtime PM support will be in place. For these, move the update of ndev->features to ravb_set_features(). In this way we update the ndev->features only when the IP-specific features set function returns success and we can avoid code duplication when introducing runtime PM registers protection. Signed-off-by: Claudiu Beznea <[email protected]> Reviewed-by: Sergey Shtylyov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bbf2345 commit 7bddccc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,7 +2538,6 @@ static int ravb_set_features_gbeth(struct net_device *ndev,
25382538
goto done;
25392539
}
25402540

2541-
ndev->features = features;
25422541
done:
25432542
spin_unlock_irqrestore(&priv->lock, flags);
25442543

@@ -2553,8 +2552,6 @@ static int ravb_set_features_rcar(struct net_device *ndev,
25532552
if (changed & NETIF_F_RXCSUM)
25542553
ravb_set_rx_csum(ndev, features & NETIF_F_RXCSUM);
25552554

2556-
ndev->features = features;
2557-
25582555
return 0;
25592556
}
25602557

@@ -2563,8 +2560,15 @@ static int ravb_set_features(struct net_device *ndev,
25632560
{
25642561
struct ravb_private *priv = netdev_priv(ndev);
25652562
const struct ravb_hw_info *info = priv->info;
2563+
int ret;
2564+
2565+
ret = info->set_feature(ndev, features);
2566+
if (ret)
2567+
return ret;
25662568

2567-
return info->set_feature(ndev, features);
2569+
ndev->features = features;
2570+
2571+
return 0;
25682572
}
25692573

25702574
static const struct net_device_ops ravb_netdev_ops = {

0 commit comments

Comments
 (0)