diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2016-04-09 20:53:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-30 12:26:55 -0400 |
commit | d41861ca19c9e96f12a4f1ebbc8255d00909a232 (patch) | |
tree | 4b09c15500d404b0b375469dd673f0bc8fd05f5f /drivers/usb/serial/generic.c | |
parent | 80f02d5424301bf4df195d09b1a664f394435851 (diff) |
tty: Replace ASYNC_INITIALIZED bit and update atomically
Replace ASYNC_INITIALIZED bit in the tty_port::flags field with
TTY_PORT_INITIALIZED bit in the tty_port::iflags field. Introduce helpers
tty_port_set_initialized() and tty_port_initialized() to abstract
atomic bit ops.
Note: the transforms for test_and_set_bit() and test_and_clear_bit()
are unnecessary as the state transitions are already mutually exclusive;
the tty lock prevents concurrent open/close/hangup.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/generic.c')
-rw-r--r-- | drivers/usb/serial/generic.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 54e170dd3dad..ae8c0365abd6 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -473,7 +473,7 @@ static bool usb_serial_generic_msr_changed(struct tty_struct *tty, | |||
473 | * Use tty-port initialised flag to detect all hangups including the | 473 | * Use tty-port initialised flag to detect all hangups including the |
474 | * one generated at USB-device disconnect. | 474 | * one generated at USB-device disconnect. |
475 | */ | 475 | */ |
476 | if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) | 476 | if (!tty_port_initialized(&port->port)) |
477 | return true; | 477 | return true; |
478 | 478 | ||
479 | spin_lock_irqsave(&port->lock, flags); | 479 | spin_lock_irqsave(&port->lock, flags); |
@@ -503,7 +503,7 @@ int usb_serial_generic_tiocmiwait(struct tty_struct *tty, unsigned long arg) | |||
503 | 503 | ||
504 | ret = wait_event_interruptible(port->port.delta_msr_wait, | 504 | ret = wait_event_interruptible(port->port.delta_msr_wait, |
505 | usb_serial_generic_msr_changed(tty, arg, &cnow)); | 505 | usb_serial_generic_msr_changed(tty, arg, &cnow)); |
506 | if (!ret && !test_bit(ASYNCB_INITIALIZED, &port->port.flags)) | 506 | if (!ret && !tty_port_initialized(&port->port)) |
507 | ret = -EIO; | 507 | ret = -EIO; |
508 | 508 | ||
509 | return ret; | 509 | return ret; |
@@ -606,7 +606,7 @@ int usb_serial_generic_resume(struct usb_serial *serial) | |||
606 | 606 | ||
607 | for (i = 0; i < serial->num_ports; i++) { | 607 | for (i = 0; i < serial->num_ports; i++) { |
608 | port = serial->port[i]; | 608 | port = serial->port[i]; |
609 | if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) | 609 | if (!tty_port_initialized(&port->port)) |
610 | continue; | 610 | continue; |
611 | 611 | ||
612 | if (port->bulk_in_size) { | 612 | if (port->bulk_in_size) { |