netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH 7/8] sky2: hold RTNL when doing suspend/shutdown operations
Date: Thu, 06 Aug 2009 09:12:20 -0700	[thread overview]
Message-ID: <20090806161232.998780534@vyatta.com> (raw)
In-Reply-To: 20090806161213.148382653@vyatta.com

[-- Attachment #1: sky2-wol-rtnl.patch --]
[-- Type: text/plain, Size: 1197 bytes --]

The suspend and shutdown code plays with shared state. Use consistent
locking, for extra protection. 

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/sky2.c	2009-08-06 08:29:58.560356154 -0700
+++ b/drivers/net/sky2.c	2009-08-06 08:32:06.128478111 -0700
@@ -4635,6 +4635,7 @@ static int sky2_suspend(struct pci_dev *
 	del_timer_sync(&hw->watchdog_timer);
 	cancel_work_sync(&hw->restart_work);
 
+	rtnl_lock();
 	for (i = 0; i < hw->ports; i++) {
 		struct net_device *dev = hw->dev[i];
 		struct sky2_port *sky2 = netdev_priv(dev);
@@ -4652,6 +4653,7 @@ static int sky2_suspend(struct pci_dev *
 	sky2_write32(hw, B0_IMSK, 0);
 	napi_disable(&hw->napi);
 	sky2_power_aux(hw);
+	rtnl_unlock();
 
 	pci_save_state(pdev);
 	pci_enable_wake(pdev, pci_choose_state(pdev, state), wol);
@@ -4721,6 +4723,7 @@ static void sky2_shutdown(struct pci_dev
 	if (!hw)
 		return;
 
+	rtnl_lock();
 	del_timer_sync(&hw->watchdog_timer);
 
 	for (i = 0; i < hw->ports; i++) {
@@ -4735,6 +4738,7 @@ static void sky2_shutdown(struct pci_dev
 
 	if (wol)
 		sky2_power_aux(hw);
+	rtnl_unlock();
 
 	pci_enable_wake(pdev, PCI_D3hot, wol);
 	pci_enable_wake(pdev, PCI_D3cold, wol);

-- 


  parent reply	other threads:[~2009-08-06 16:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-06 16:12 [PATCH 0/8] sky2: driver update Stephen Hemminger
2009-08-06 16:12 ` [PATCH 1/8] Revert "sky2: Avoid transmits during sky2_down()" Stephen Hemminger
2009-08-06 16:12 ` [PATCH 2/8] sky2: Avoid rewinding sky2->tx_prod Stephen Hemminger
2009-08-06 16:12 ` [PATCH 3/8] sky2: Move tx reset functionality to sky2_tx_reset() Stephen Hemminger
2009-08-06 16:12 ` [PATCH 4/8] sky2: Reset tx train after interrupts disabled Stephen Hemminger
2009-08-06 16:12 ` [PATCH 5/8] sky2: Remove tx locks Stephen Hemminger
2009-08-06 16:12 ` [PATCH 6/8] sky2: Lock tx queue when calling sky2_down locally Stephen Hemminger
2009-08-06 16:12 ` Stephen Hemminger [this message]
2009-08-06 16:12 ` [PATCH 8/8] sky2: hold spinlock around phy_power_down Stephen Hemminger
2009-08-10  4:09 ` [PATCH 0/8] sky2: driver update David Miller
2009-08-10 15:48   ` Stephen Hemminger
2009-08-11  0:52     ` 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=20090806161232.998780534@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.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).