USB: usb_wwan: fix remote wakeup
authorJohan Hovold <jhovold@gmail.com>
Mon, 26 May 2014 17:23:20 +0000 (19:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 May 2014 22:04:06 +0000 (15:04 -0700)
commitc1c0180340aa73e747744abd7e06239f261d4ade
treeb2ee0e51075b1394ad96288af1d3082cda43b18e
parent7436f41283ef2a45f8320ad482edd0aba1bd5843
USB: usb_wwan: fix remote wakeup

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.

Note that there are currently no multi-port drivers using the usb_wwan
implementation.

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