Răsfoiți Sursa

tty: tty_port: Move the IO_ERROR clear

Some devices want to set IO_ERROR in their activate methods so that you can
be handed a 'dead' port for operations like setserial. Thus we need to
clear the flag before activate so that activate can choose to set the flag
and still return 0.

This is fine as the file handle/tty are not accessible to the user yet.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Cox 15 ani în urmă
părinte
comite
a9a37ec33a
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      drivers/char/tty_port.c

+ 1 - 1
drivers/char/tty_port.c

@@ -409,6 +409,7 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty,
 	mutex_lock(&port->mutex);
 	mutex_lock(&port->mutex);
 
 
 	if (!test_bit(ASYNCB_INITIALIZED, &port->flags)) {
 	if (!test_bit(ASYNCB_INITIALIZED, &port->flags)) {
+		clear_bit(TTY_IO_ERROR, &tty->flags);
 		if (port->ops->activate) {
 		if (port->ops->activate) {
 			int retval = port->ops->activate(port, tty);
 			int retval = port->ops->activate(port, tty);
 			if (retval) {
 			if (retval) {
@@ -417,7 +418,6 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty,
 			}
 			}
 		}
 		}
 		set_bit(ASYNCB_INITIALIZED, &port->flags);
 		set_bit(ASYNCB_INITIALIZED, &port->flags);
-		clear_bit(TTY_IO_ERROR, &tty->flags);
 	}
 	}
 	mutex_unlock(&port->mutex);
 	mutex_unlock(&port->mutex);
 	return tty_port_block_til_ready(port, tty, filp);
 	return tty_port_block_til_ready(port, tty, filp);