Skip to content

Commit 62a0ec9

Browse files
jwrdegoederafaeljw
authored andcommitted
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 <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 110d7b0 commit 62a0ec9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/pnp/driver.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state)
182182
return error;
183183
}
184184

185-
if (pnp_can_disable(pnp_dev)) {
185+
/* can_write is necessary to be able to re-start the device on resume */
186+
if (pnp_can_disable(pnp_dev) && pnp_can_write(pnp_dev)) {
186187
error = pnp_stop_dev(pnp_dev);
187188
if (error)
188189
return error;

0 commit comments

Comments
 (0)