netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tobias Diedrich <ranma+kernel@tdiedrich.de>
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ayaz Abdulla <aabdulla@nvidia.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Stephen Hemminger <shemminger@linux-foundation.org>,
	Davi
Subject: Re: [PATCH 6/4] Fix forcedeth hibernate/wake-on-lan problems
Date: Sun, 1 Jun 2008 01:20:05 +0200	[thread overview]
Message-ID: <20080531232005.GA2613@yamamaya.is-a-geek.org> (raw)
In-Reply-To: <20080518125715.GA19229@yamamaya.is-a-geek.org>

From: Tobias Diedrich <ranma+kernel@tdiedrich.de>

This patch is the minimal amount of code needed to support
wake-on-lan in platform mode properly (i.e. "ethtool -s eth0 wol g"
is sufficient, no additional magic needed) for me.

This is derived from David Brownells patch
(http://lists.laptop.org/pipermail/devel/2007-April/004691.html).
However I decided to move the hook into pci-acpi.c since the other
two pci hooks also live there and pci and acpi are the only users of
the platform_enable_wakeup-hook.

As a 'side-effect' this also makes wake on usb activity work for me
and I had to disable usb wakeup (which is enabled by default) using
the power/wakeup sysfs functionality ("echo disabled >
${sysfs_path_to_device}/power/wakeup").

(BTW I first thought the 'immediate reboot because of usb wake' effect is
caused by the optical mouse generating a wake event, but it rather
seems to be a problem with a flaky secondary usb host controller,
which sees a connected device where nothing is attached)

Signed-off-by: Tobias Diedrich <ranma+kernel@tdiedrich.de>

Index: linux-2.6.26-rc4.forcedwol/drivers/pci/pci-acpi.c
===================================================================
--- linux-2.6.26-rc4.forcedwol.orig/drivers/pci/pci-acpi.c	2008-06-01 00:40:23.000000000 +0200
+++ linux-2.6.26-rc4.forcedwol/drivers/pci/pci-acpi.c	2008-06-01 00:46:55.000000000 +0200
@@ -315,6 +315,25 @@
 	}
 	return PCI_POWER_ERROR;
 }
+
+static int acpi_platform_enable_wakeup(struct device *dev, int is_on)
+{
+	struct acpi_device	*adev;
+	int			status;
+
+	if (!device_can_wakeup(dev))
+		return -EINVAL;
+
+	if (is_on && !device_may_wakeup(dev))
+		return -EINVAL;
+
+	status = acpi_bus_get_device(DEVICE_ACPI_HANDLE(dev), &adev);
+	if (status < 0)
+		return status;
+
+	adev->wakeup.state.enabled = !!is_on;
+	return 0;
+}
 #endif
 
 static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
@@ -399,6 +418,7 @@
 		return 0;
 #ifdef	CONFIG_ACPI_SLEEP
 	platform_pci_choose_state = acpi_pci_choose_state;
+	platform_enable_wakeup = acpi_platform_enable_wakeup;
 #endif
 	platform_pci_set_power_state = acpi_pci_set_power_state;
 	return 0;

      parent reply	other threads:[~2008-05-31 23:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-18 12:57 [PATCH 0/4] Fix forcedeth hibernate/wake-on-lan problems Tobias Diedrich
2008-05-18 13:00 ` [PATCH 1/4] Restore multicast settings on resume Tobias Diedrich
2008-05-22 10:21   ` Jeff Garzik
2008-05-18 13:02 ` [PATCH 2/4] setup wake-on-lan before shutting down Tobias Diedrich
2008-05-31  2:20   ` Jeff Garzik
2008-05-18 13:03 ` [PATCH 3/4] save/restore device configuration space Tobias Diedrich
2008-05-18 13:04 ` [PATCH 4/4] reorder suspend/resume code Tobias Diedrich
2008-05-18 15:09 ` [PATCH 0/4] Fix forcedeth hibernate/wake-on-lan problems Tobias Diedrich
2008-05-20 22:39   ` Rafael J. Wysocki
2008-05-25 15:04   ` Tobias Diedrich
2008-05-25 18:13     ` Tobias Diedrich
2008-05-27  6:21       ` Tobias Diedrich
2008-05-27 21:32         ` David Brownell
2008-05-31  7:20           ` Pavel Machek
2008-06-05  2:38             ` David Brownell
2008-05-31 22:12         ` Tobias Diedrich
2008-06-01  2:51           ` [linux-pm] " Alan Stern
2008-06-01  7:49             ` Tobias Diedrich
2008-06-02 21:09               ` Alan Stern
2008-06-03  6:16                 ` Tobias Diedrich
2008-06-03 14:12                   ` Alan Stern
2008-06-03 17:30                     ` Tobias Diedrich
2008-06-03 20:06                       ` Alan Stern
2008-05-31 22:54 ` [PATCH 5/4] " Tobias Diedrich
2008-06-27  6:09   ` Jeff Garzik
2008-05-31 23:20 ` Tobias Diedrich [this message]

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=20080531232005.GA2613@yamamaya.is-a-geek.org \
    --to=ranma+kernel@tdiedrich.de \
    --cc=aabdulla@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=shemminger@linux-foundation.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).