Skip to content

Commit a71a50e

Browse files
claudiubezneadavem330
authored andcommitted
net: ravb: Do not apply features to hardware if the interface is down
Do not apply features to hardware if the interface is down. In case runtime PM is enabled, and while the interface is down, the IP will be in reset mode (as for some platforms disabling the clocks will switch the IP to reset mode, which will lead to losing register contents) and applying settings in reset mode is not an option. Instead, cache the features and apply them in ravb_open() through ravb_emac_init(). To avoid accessing the hardware while the interface is down pm_runtime_active() check was introduced. Along with it the device runtime PM usage counter has been incremented to avoid disabling the device clocks while the check is in progress (if any). Commit prepares for the addition of runtime PM. Signed-off-by: Claudiu Beznea <[email protected]> Reviewed-by: Sergey Shtylyov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7bddccc commit a71a50e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2560,9 +2560,18 @@ static int ravb_set_features(struct net_device *ndev,
25602560
{
25612561
struct ravb_private *priv = netdev_priv(ndev);
25622562
const struct ravb_hw_info *info = priv->info;
2563+
struct device *dev = &priv->pdev->dev;
25632564
int ret;
25642565

2565-
ret = info->set_feature(ndev, features);
2566+
pm_runtime_get_noresume(dev);
2567+
2568+
if (pm_runtime_active(dev))
2569+
ret = info->set_feature(ndev, features);
2570+
else
2571+
ret = 0;
2572+
2573+
pm_runtime_put_noidle(dev);
2574+
25662575
if (ret)
25672576
return ret;
25682577

0 commit comments

Comments
 (0)