diff options
author | Hans de Goede <hdegoede@redhat.com> | 2022-11-24 13:53:05 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-11-25 21:36:52 +0300 |
commit | 62a0ec9dc1dfb0f58138f1e2527e4a26567268e5 (patch) | |
tree | 289ed97b4ad3664d22877bc329d33bf818b1c127 /drivers/pnp/driver.c | |
parent | 110d7b0325c55ff3620073ba4201845f59e22ebf (diff) | |
download | linux-62a0ec9dc1dfb0f58138f1e2527e4a26567268e5.tar.xz |
PNP: Do not disable devices on suspend when they cannot be re-enabled on resume
On an Advantech MICA-071 tablet, with a builtin barcode scanner connected
to ttyS0, the following message is shown on suspend:
serial 00:02: disabled
And after suspend/resume trying to use the barcode scanner / ttyS0 shows:
serial 00:02: LSR safety check engaged!
Indicating that the UARTs io-ports are no longer reachable.
This is caused by __pnp_bus_suspend() calling pnp_stop_dev() on the "00:02"
pnp device on suspend (this outputs the disabled message).
The problem is that pnp_can_write() returns false for the "00:02" pnp
device, so after disabling it (disabling its decoding of IO addresses)
during suspend, it cannot be re-enabled.
Add a pnp_can_write() check to the suspend path and only disable devices
which can actually be re-enabled on resume.
This fixes the Advantech MICA-071's ttyS0 no longer working after
a suspend/resume.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pnp/driver.c')
-rw-r--r-- | drivers/pnp/driver.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index c02e7bf643a6..46c534f6b1c9 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c @@ -182,7 +182,8 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state) return error; } - if (pnp_can_disable(pnp_dev)) { + /* can_write is necessary to be able to re-start the device on resume */ + if (pnp_can_disable(pnp_dev) && pnp_can_write(pnp_dev)) { error = pnp_stop_dev(pnp_dev); if (error) return error; |