USB: serial: allow hung up ports to be suspended
authorJohan Hovold <johan@kernel.org>
Fri, 10 Sep 2021 12:11:28 +0000 (14:11 +0200)
committerJohan Hovold <johan@kernel.org>
Mon, 20 Sep 2021 09:49:34 +0000 (11:49 +0200)
commit6400b974910407cd299dc08578a6c1792b4c922a
treec5fa78901493dda544cda1f037dcd604090c36bf
parent96a83c95c3da5ba55ea2cf6ce87de10fc03417a9
USB: serial: allow hung up ports to be suspended

User space can keep a tty open indefinitely and that should not prevent
a hung up port and its USB device from being runtime suspended.

Fix this by incrementing the PM usage counter when the port it activated
and decrementing the counter when the port is shutdown rather than when
the tty is installed and the last reference is dropped, respectively.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/usb-serial.c