Skip to contentSkip to conversation

sky2: Fix recent WOL regression

PATCH In review Rafael J. Wysocki 3 participants 9 messages Oct 2, 2008 – Oct 9, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sky2: Fix recent WOL regression

From: Rafael J. Wysocki <[email protected]>

sky2: Fix recent WOL regression

Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol() (this fixes a regression from 2.6.26 on the Tino's machine).

Remove an open-coded reference to the standard PCI PM registers that is not used any more.

---

 drivers/net/sky2.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/sky2.c +5 -14
Index: linux-2.6/drivers/net/sky2.c
===================================================================
@@ -3034,7 +3034,8 @@ static int sky2_set_wol(struct net_devic
 	struct sky2_port *sky2 = netdev_priv(dev);
 	struct sky2_hw *hw = sky2->hw;
 
-	if (wol->wolopts & ~sky2_wol_supported(sky2->hw))
+	if ((wol->wolopts & ~sky2_wol_supported(sky2->hw))
+	    || !device_can_wakeup(&hw->pdev->dev))
 		return -EOPNOTSUPP;
 
 	sky2->wol = wol->wolopts;
@@ -3045,6 +3046,8 @@ static int sky2_set_wol(struct net_devic
 		sky2_write32(hw, B0_CTST, sky2->wol
 			     ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);
 
+	device_set_wakeup_enable(&hw->pdev->dev, sky2->wol);
+
 	if (!netif_running(dev))
 		sky2_wol_init(sky2);
 	return 0;
@@ -4166,18 +4169,6 @@ static int __devinit sky2_test_msi(struc
 	return err;
 }
 
-static int __devinit pci_wake_enabled(struct pci_dev *dev)
-{
-	int pm  = pci_find_capability(dev, PCI_CAP_ID_PM);
-	u16 value;
-
-	if (!pm)
-		return 0;
-	if (pci_read_config_word(dev, pm + PCI_PM_CTRL, &value))
-		return 0;
-	return value & PCI_PM_CTRL_PME_ENABLE;
-}
-
 /* This driver supports yukon2 chipset only */
 static const char *sky2_name(u8 chipid, char *buf, int sz)
 {
@@ -4238,7 +4241,7 @@ static int __devinit sky2_probe(struct p
 		}
 	}
 
-	wol_default = pci_wake_enabled(pdev) ? WAKE_MAGIC : 0;
+	wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0;
 
 	err = -ENOMEM;
 	hw = kzalloc(sizeof(*hw), GFP_KERNEL);
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Thu, 2 Oct 2008 23:39:33 +0200 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

sky2: Fix recent WOL regression

Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol() (this fixes a regression from 2.6.26 on the Tino's machine).

Quoted 6 lines

Remove an open-coded reference to the standard PCI PM registers that is not used any more.

---

Thanks for fixing this.

Acked-by on v1 1/1
#2 lore raw
In reply to Rafael J. Wysocki
Quoted 10 lines · On Thu, 2 Oct 2008 23:39:33 +0200 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

sky2: Fix recent WOL regression

Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol() (this fixes a regression from 2.6.26 on the Tino's machine).

Quoted 6 lines

Remove an open-coded reference to the standard PCI PM registers that is not used any more.

---

Thanks for fixing this.

#3 lore raw
Quoted 16 lines · Stephen Hemminger
Quoted 13 lines · On Thu, 2 Oct 2008 23:39:33 +0200 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

sky2: Fix recent WOL regression

Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol() (this fixes a regression from 2.6.26 on the Tino's machine).

Remove an open-coded reference to the standard PCI PM registers that is not used any more.

Quoted 7 lines
Quoted 3 lines

---

Thanks for fixing this.

Can you please include this patch into your next push for Jeff?

It seems to have been overlooked.

Thanks,
Rafael

maintainer
#4 lore raw

From: "Rafael J. Wysocki" <[email protected]>
Date: Thu, 9 Oct 2008 00:55:55 +0200

Quoted 21 lines · Stephen Hemminger
Quoted 20 lines
Quoted 16 lines · On Thu, 2 Oct 2008 23:39:33 +0200 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

sky2: Fix recent WOL regression

Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol() (this fixes a regression from 2.6.26 on the Tino's machine).

Remove an open-coded reference to the standard PCI PM registers that is not used any more.

---

Quoted 7 lines
Quoted 3 lines

Thanks for fixing this.

Can you please include this patch into your next push for Jeff?

It seems to have been overlooked.

I missed this ACK but I did add the patch to my tree as you can see from another email of mine.

maintainer
#5 lore raw
In reply to Rafael J. Wysocki

From: "Rafael J. Wysocki" <[email protected]>
Date: Thu, 9 Oct 2008 00:55:55 +0200

Quoted 21 lines · Stephen Hemminger
Quoted 20 lines
Quoted 16 lines · On Thu, 2 Oct 2008 23:39:33 +0200 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

sky2: Fix recent WOL regression

Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol() (this fixes a regression from 2.6.26 on the Tino's machine).

Remove an open-coded reference to the standard PCI PM registers that is not used any more.

---

Quoted 7 lines
Quoted 3 lines

Thanks for fixing this.

Can you please include this patch into your next push for Jeff?

It seems to have been overlooked.

I missed this ACK but I did add the patch to my tree as you can see from another email of mine.

#6 lore raw
Quoted 26 lines · David Miller

From: "Rafael J. Wysocki" <[email protected]>
Date: Thu, 9 Oct 2008 00:55:55 +0200

Quoted 23 lines · Stephen Hemminger
Quoted 22 lines
Quoted 10 lines · On Thu, 2 Oct 2008 23:39:33 +0200 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

sky2: Fix recent WOL regression

Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol() (this fixes a regression from 2.6.26 on the Tino's machine).

Quoted 6 lines

Remove an open-coded reference to the standard PCI PM registers that is not used any more.

---

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks for fixing this.

Can you please include this patch into your next push for Jeff?

It seems to have been overlooked.

I missed this ACK but I did add the patch to my tree as you can see from another email of mine.

I saw it, thanks!

#7 lore raw
In reply to David Miller
Quoted 26 lines · David Miller

From: "Rafael J. Wysocki" <[email protected]>
Date: Thu, 9 Oct 2008 00:55:55 +0200

Quoted 23 lines · Stephen Hemminger
Quoted 22 lines
Quoted 10 lines · On Thu, 2 Oct 2008 23:39:33 +0200 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

sky2: Fix recent WOL regression

Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol() (this fixes a regression from 2.6.26 on the Tino's machine).

Quoted 6 lines

Remove an open-coded reference to the standard PCI PM registers that is not used any more.

---

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks for fixing this.

Can you please include this patch into your next push for Jeff?

It seems to have been overlooked.

I missed this ACK but I did add the patch to my tree as you can see from another email of mine.

I saw it, thanks!

#8 lore raw
In reply to Stephen Hemminger
Quoted 16 lines · Stephen Hemminger
Quoted 13 lines · On Thu, 2 Oct 2008 23:39:33 +0200 "Rafael J. Wysocki" <[email protected]> wrote:

From: Rafael J. Wysocki <[email protected]>

sky2: Fix recent WOL regression

Since dev->power.should_wakeup bit is used by the PCI core to decide whether the device should wake up the system from sleep states, set/unset this bit whenever WOL is enabled/disabled using sky2_set_wol() (this fixes a regression from 2.6.26 on the Tino's machine).

Remove an open-coded reference to the standard PCI PM registers that is not used any more.

Quoted 7 lines
Quoted 3 lines

---

Thanks for fixing this.

Can you please include this patch into your next push for Jeff?

It seems to have been overlooked.

Thanks,
Rafael