PNP: do not stop/start devices in suspend/resume path

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Bjorn Helgaas
Date: Thursday, December 6, 2007 - 4:25 pm

On Wednesday 05 December 2007 11:24:18 am Bjorn Helgaas wrote:

I checked with a Windows kernel person, who said that when preparing
to sleep, Windows puts devices in S3 state (I think he meant D3)
and does not use _DIS.

I think this patch is the right thing to do.  It's possible we'll
trip over some BIOS issue, but in the long term, we should try to
do it the same way Windows does.  Andrew, can you add this before
pnp-request-ioport-and-iomem-resources-used-by-active-devices.patch?

Thanks,
  Bjorn


PNP: do not stop/start devices in suspend/resume path

Do not disable PNP devices in the suspend path.  We still call
the driver's suspend method, which should prevent further use of
the device, and the protocol suspend method, which may put the
device in a low-power state.

I'm told that Windows puts devices in a low-power state (Linux
does this in the protocol suspend method), but does not use _DIS
in the suspend path.  Other relevant references:

  - In the ACPI 3.0b spec, I can't find any mention of _DIS in
    connection with sleep.  And Device Object Notifications,
    Section 5.6.3, Table 5-43, says we should get a bus check
    after awakening if hardware was removed while we slept.

  - This: http://msdn2.microsoft.com/en-us/library/ms810079.aspx
    makes a similar point about how the OS re-enumerates devices
    as a result of a power state change (3rd last paragraph of
    text).

  - This: http://msdn2.microsoft.com/en-us/library/aa489874.aspx
    suggests that Windows only stops a device to rebalance hardware
    resources.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

Index: linux-mm/drivers/pnp/driver.c
===================================================================
--- linux-mm.orig/drivers/pnp/driver.c	2007-11-30 13:58:25.000000000 -0700
+++ linux-mm/drivers/pnp/driver.c	2007-12-03 09:58:35.000000000 -0700
@@ -161,13 +161,6 @@
 			return error;
 	}
 
-	if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE) &&
-	    pnp_can_disable(pnp_dev)) {
-		error = pnp_stop_dev(pnp_dev);
-		if (error)
-			return error;
-	}
-
 	if (pnp_dev->protocol && pnp_dev->protocol->suspend)
 		pnp_dev->protocol->suspend(pnp_dev, state);
 	return 0;
@@ -177,7 +170,6 @@
 {
 	struct pnp_dev *pnp_dev = to_pnp_dev(dev);
 	struct pnp_driver *pnp_drv = pnp_dev->driver;
-	int error;
 
 	if (!pnp_drv)
 		return 0;
@@ -185,12 +177,6 @@
 	if (pnp_dev->protocol && pnp_dev->protocol->resume)
 		pnp_dev->protocol->resume(pnp_dev);
 
-	if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) {
-		error = pnp_start_dev(pnp_dev);
-		if (error)
-			return error;
-	}
-
 	if (pnp_drv->resume)
 		return pnp_drv->resume(pnp_dev);
 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
WARNING: at kernel/resource.c:189 __release_resource, Jiri Slaby, (Thu Nov 22, 2:41 pm)
Re: WARNING: at kernel/resource.c:189 __release_resource, Andrew Morton, (Mon Nov 26, 11:05 pm)
Re: WARNING: at kernel/resource.c:189 __release_resource, Matthew Wilcox, (Tue Nov 27, 5:38 am)
Re: WARNING: at kernel/resource.c:189 __release_resource, Bjorn Helgaas, (Thu Nov 29, 4:40 pm)
Re: WARNING: at kernel/resource.c:189 __release_resource, Andrew Morton, (Thu Nov 29, 5:42 pm)
Re: WARNING: at kernel/resource.c:189 __release_resource, Bjorn Helgaas, (Fri Nov 30, 2:08 pm)
Re: WARNING: at kernel/resource.c:189 __release_resource, Bjorn Helgaas, (Fri Nov 30, 3:58 pm)
PNP: do not stop/start devices in suspend/resume path, Bjorn Helgaas, (Thu Dec 6, 4:25 pm)
Re: PNP: do not stop/start devices in suspend/resume path, Andrew Morton, (Wed Dec 12, 1:16 am)
Re: PNP: do not stop/start devices in suspend/resume path, Bjorn Helgaas, (Wed Dec 12, 9:29 am)
Re: PNP: do not stop/start devices in suspend/resume path, Pierre Ossman, (Thu Dec 13, 1:26 am)