[PATCH 03/16] USB: pl2303: only wake up MSR queue on changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Only wake up MSR wait queue on actual modem-status changes.

Signed-off-by: Johan Hovold <jhovold@xxxxxxxxx>
---
 drivers/usb/serial/pl2303.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 11de1f169308..64f093f16981 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -118,6 +118,7 @@ MODULE_DEVICE_TABLE(usb, id_table);
 #define VENDOR_READ_REQUEST		0x01
 
 #define UART_STATE_INDEX		8
+#define UART_STATE_MSR_MASK		0x8b
 #define UART_STATE_TRANSIENT_MASK	0x74
 #define UART_DCD			0x01
 #define UART_DSR			0x02
@@ -828,15 +829,17 @@ static void pl2303_update_line_status(struct usb_serial_port *port,
 	if (status & UART_BREAK_ERROR)
 		usb_serial_handle_break(port);
 
-	wake_up_interruptible(&port->port.delta_msr_wait);
-
-	if (delta & UART_DCD) {
-		tty = tty_port_tty_get(&port->port);
-		if (tty) {
-			usb_serial_handle_dcd_change(port, tty,
+	if (delta & UART_STATE_MSR_MASK) {
+		if (delta & UART_DCD) {
+			tty = tty_port_tty_get(&port->port);
+			if (tty) {
+				usb_serial_handle_dcd_change(port, tty,
 							status & UART_DCD);
-			tty_kref_put(tty);
+				tty_kref_put(tty);
+			}
 		}
+
+		wake_up_interruptible(&port->port.delta_msr_wait);
 	}
 }
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux