All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
To: "David S. Miller" <davem@davemloft.net>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: <netdev@vger.kernel.org>, <linux-renesas-soc@vger.kernel.org>
Subject: [PATCH 4/6] sh_eth: remove custom .nway_reset from ethtool ops
Date: Thu, 24 May 2018 14:11:56 +0300	[thread overview]
Message-ID: <1527160318-10958-5-git-send-email-vladimir_zapolskiy@mentor.com> (raw)
In-Reply-To: <1527160318-10958-1-git-send-email-vladimir_zapolskiy@mentor.com>

The change fixes a sleep in atomic context issue, which can be
always triggered by running 'ethtool -r' command, because
phy_start_aneg() protects phydev fields by a mutex.

Another note is that the change implicitly replaces phy_start_aneg()
with a newer phy_restart_aneg().

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index d9cadfb1bc4a..6d1fed2b4a4a 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2252,22 +2252,6 @@ static void sh_eth_get_regs(struct net_device *ndev, struct ethtool_regs *regs,
 	pm_runtime_put_sync(&mdp->pdev->dev);
 }
 
-static int sh_eth_nway_reset(struct net_device *ndev)
-{
-	struct sh_eth_private *mdp = netdev_priv(ndev);
-	unsigned long flags;
-	int ret;
-
-	if (!ndev->phydev)
-		return -ENODEV;
-
-	spin_lock_irqsave(&mdp->lock, flags);
-	ret = phy_start_aneg(ndev->phydev);
-	spin_unlock_irqrestore(&mdp->lock, flags);
-
-	return ret;
-}
-
 static u32 sh_eth_get_msglevel(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -2418,7 +2402,7 @@ static int sh_eth_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
 static const struct ethtool_ops sh_eth_ethtool_ops = {
 	.get_regs_len	= sh_eth_get_regs_len,
 	.get_regs	= sh_eth_get_regs,
-	.nway_reset	= sh_eth_nway_reset,
+	.nway_reset	= phy_ethtool_nway_reset,
 	.get_msglevel	= sh_eth_get_msglevel,
 	.set_msglevel	= sh_eth_set_msglevel,
 	.get_link	= ethtool_op_get_link,
-- 
2.8.1

  parent reply	other threads:[~2018-05-24 11:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24 11:11 [PATCH 0/6] ravb/sh_eth: fix sleep in atomic by reusing shared ethtool handlers Vladimir Zapolskiy
2018-05-24 11:11 ` [PATCH 1/6] ravb: remove custom .nway_reset from ethtool ops Vladimir Zapolskiy
2018-05-24 13:22   ` Andrew Lunn
2018-05-24 14:11     ` Vladimir Zapolskiy
2018-05-24 14:11       ` Vladimir Zapolskiy
2018-05-24 16:18       ` Sergei Shtylyov
2018-05-24 16:44         ` Andrew Lunn
2018-05-24 17:01           ` Sergei Shtylyov
2018-05-24 17:23             ` Andrew Lunn
2018-05-25  6:05             ` Vladimir Zapolskiy
2018-05-25  6:05               ` Vladimir Zapolskiy
2018-05-26 16:56   ` Sergei Shtylyov
2018-05-26 16:56   ` Sergei Shtylyov
2018-05-26 17:51   ` Sergei Shtylyov
2018-05-24 11:11 ` [PATCH 2/6] ravb: remove custom .get_link_ksettings " Vladimir Zapolskiy
2018-05-26 17:07   ` Sergei Shtylyov
2018-05-24 11:11 ` [PATCH 3/6] ravb: remove custom .set_link_ksettings " Vladimir Zapolskiy
2018-05-24 13:29   ` Andrew Lunn
2018-05-24 14:06     ` Vladimir Zapolskiy
2018-05-24 14:06       ` Vladimir Zapolskiy
2018-05-26 19:50   ` Sergei Shtylyov
2018-05-28  9:51     ` Vladimir Zapolskiy
2018-05-28  9:51       ` Vladimir Zapolskiy
2018-06-03 15:42       ` Sergei Shtylyov
2018-06-04 11:07         ` Vladimir Zapolskiy
2018-06-04 11:07           ` Vladimir Zapolskiy
2018-06-06 20:34           ` Sergei Shtylyov
2018-05-24 11:11 ` Vladimir Zapolskiy [this message]
2018-05-24 13:30   ` [PATCH 4/6] sh_eth: remove custom .nway_reset " Andrew Lunn
2018-05-26 18:46   ` Sergei Shtylyov
2018-05-26 19:22     ` Sergei Shtylyov
2018-05-24 11:14 ` [PATCH 5/6] sh_eth: remove custom .get_link_ksettings " Vladimir Zapolskiy
2018-05-24 11:14   ` [PATCH 6/6] sh_eth: remove custom .set_link_ksettings " Vladimir Zapolskiy
2018-05-24 13:31   ` [PATCH 5/6] sh_eth: remove custom .get_link_ksettings " Andrew Lunn
2018-05-24 16:40 ` [PATCH 0/6] ravb/sh_eth: fix sleep in atomic by reusing shared ethtool handlers Sergei Shtylyov
2018-05-24 17:24   ` Sergei Shtylyov
2018-05-25  6:25     ` Vladimir Zapolskiy
2018-05-25  6:25       ` Vladimir Zapolskiy
2018-05-26 17:31       ` Sergei Shtylyov
2018-05-25  8:11 ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1527160318-10958-5-git-send-email-vladimir_zapolskiy@mentor.com \
    --to=vladimir_zapolskiy@mentor.com \
    --cc=davem@davemloft.net \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.