diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-01-10 21:23:16 +0100 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2011-01-11 15:20:40 -0500 |
commit | cc8e7a355c1ec64b06a5b8126c47c5cb47f44fce (patch) | |
tree | c2188b1abcab9ac29d47b75f78e48b4007184ff4 /drivers/pnp/driver.c | |
parent | 3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 (diff) |
PNP / ACPI: Use DEVICE_ACPI_HANDLE() for device ACPI handle access
The PNP ACPI driver squirrels the ACPI handles of PNP devices' ACPI
companions, but this isn't correct, because those handles should be
accessed using the DEVICE_ACPI_HANDLE() macro operating on struct
device objects.
Using DEVICE_ACPI_HANDLE() in the PNP ACPI driver instead of the
driver's own copies of the ACPI handles allows us to avoid a problem
with docking stations where a machine docked before suspend to RAM
and undocked while suspended crashes during the subsequent resume (in
that case the ACPI companion of the PNP device in question doesn't
exist any more while the device is being resumed). It also allows us
to avoid the problem where suspend to RAM fails when the machine was
undocked while suspended before (again, the ACPI companion of the PNP
device is not present any more while it is being suspended).
This change doesn't fix all of the the PNP ACPI driver's problems
with PNP devices in docking stations (generally speaking, the driver
has no idea that devices can come and go and doesn't even attempt to
handle such events), but at least it makes suspend work for the
users of docking stations who don't use the PNP devices located in
there.
References: https://bugzilla.kernel.org/show_bug.cgi?id=15100
Reported-and-tested-by: Toralf Förster <toralf.foerster@gmx.de>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/driver.c')
-rw-r--r-- | drivers/pnp/driver.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index d1dbb9df53fa..00e94032531a 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c @@ -189,8 +189,11 @@ static int pnp_bus_resume(struct device *dev) if (!pnp_drv) return 0; - if (pnp_dev->protocol->resume) - pnp_dev->protocol->resume(pnp_dev); + if (pnp_dev->protocol->resume) { + error = pnp_dev->protocol->resume(pnp_dev); + if (error) + return error; + } if (pnp_can_write(pnp_dev)) { error = pnp_start_dev(pnp_dev); |