USB: sierra: fix remote wakeup
authorJohan Hovold <jhovold@gmail.com>
Mon, 26 May 2014 17:22:54 +0000 (19:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Jul 2014 03:01:32 +0000 (20:01 -0700)
commitd228aeaff57cb42b134b499fd1cd6111724b9340
tree098b54e5858cfce30b41f62bf3c397c14a6b4d9a
parentedc71a5ebfed93d04c5648a6e9f94a5358d46aa0
USB: sierra: fix remote wakeup

commit 80cc0fcbdaeaf10d04ba27779a2d7ceb73d2717a upstream.

Make sure that needs_remote_wake up is always set when there are open
ports.

Currently close() would unconditionally set needs_remote_wakeup to 0
even though there might still be open ports. This could lead to blocked
input and possibly dropped data on devices that do not support remote
wakeup (and which must therefore not be runtime suspended while open).

Add an open_ports counter (protected by the susp_lock) and only clear
needs_remote_wakeup when the last port is closed.

Fixes: e6929a9020ac ("USB: support for autosuspend in sierra while
online")

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/sierra.c