linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: rmk+kernel@arm.linux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH B 01/10] net: fec: improve safety of suspend/resume/transmit timeout paths
Date: Tue, 08 Jul 2014 12:39:57 +0100	[thread overview]
Message-ID: <E1X4Tkb-0005nq-Jv@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20140708113911.GH21766@n2100.arm.linux.org.uk>

We should hold the rtnl lock while suspending, resuming or processing
the transmit timeout to ensure that nothing will interfere while we
bring up, take down or restart the hardware.  The transmit timeout
could run if we're preempted during suspend.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/net/ethernet/freescale/fec_main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index f43c388e2eb9..1cd71a8d9996 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1068,8 +1068,10 @@ static void fec_enet_work(struct work_struct *work)
 
 	if (fep->delay_work.timeout) {
 		fep->delay_work.timeout = false;
+		rtnl_lock();
 		fec_restart(fep->netdev, fep->full_duplex);
 		netif_wake_queue(fep->netdev);
+		rtnl_unlock();
 	}
 
 	if (fep->delay_work.trig_tx) {
@@ -2680,11 +2682,14 @@ fec_suspend(struct device *dev)
 	struct net_device *ndev = dev_get_drvdata(dev);
 	struct fec_enet_private *fep = netdev_priv(ndev);
 
+	rtnl_lock();
 	if (netif_running(ndev)) {
 		phy_stop(fep->phy_dev);
 		fec_stop(ndev);
 		netif_device_detach(ndev);
 	}
+	rtnl_unlock();
+
 	fec_enet_clk_enable(ndev, false);
 	pinctrl_pm_select_sleep_state(&fep->pdev->dev);
 
@@ -2712,11 +2717,13 @@ fec_resume(struct device *dev)
 	if (ret)
 		goto failed_clk;
 
+	rtnl_lock();
 	if (netif_running(ndev)) {
 		fec_restart(ndev, fep->full_duplex);
 		netif_device_attach(ndev);
 		phy_start(fep->phy_dev);
 	}
+	rtnl_unlock();
 
 	return 0;
 
-- 
1.8.3.1

  reply	other threads:[~2014-07-08 11:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 11:39 [PATCH B 00/10] Freescale ethernet driver updates (part 2) Russell King - ARM Linux
2014-07-08 11:39 ` Russell King [this message]
2014-07-08 11:40 ` [PATCH B 02/10] net: fec: ensure fec_enet_close() copes with resume failure Russell King
2014-07-08 11:40 ` [PATCH B 03/10] net: fec: only restart or stop the device if it is present and running Russell King
2014-07-08 11:40 ` [PATCH B 04/10] net: fec: move calls to quiesce/resume packet processing out of fec_restart() Russell King
2014-07-08 11:40 ` [PATCH B 05/10] net: fec: remove inappropriate calls around fec_restart() Russell King
2014-07-08 11:40 ` [PATCH B 06/10] net: fec: quiesce packet processing before stopping device in fec_suspend() Russell King
2014-07-08 11:40 ` [PATCH B 07/10] net: fec: quiesce packet processing before stopping device in fec_set_features() Russell King
2014-07-08 11:40 ` [PATCH B 08/10] net: fec: quiesce packet processing before changing features Russell King
2014-07-08 11:40 ` [PATCH B 09/10] net: fec: quiesce packet processing when taking link down in fec_enet_adjust_link() Russell King
2014-07-08 11:40 ` [PATCH B 10/10] net: fec: clean up duplex mode handling Russell King
2014-07-09  3:03 ` [PATCH B 00/10] Freescale ethernet driver updates (part 2) David Miller

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=E1X4Tkb-0005nq-Jv@rmk-PC.arm.linux.org.uk \
    --to=rmk+kernel@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).