@@ -1300,7 +1300,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty)
if (retval) {
if (capable(CAP_SYS_ADMIN) && tty)
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
release_resources(info);
return retval;
}
@@ -1309,7 +1309,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty)
mgslpc_change_params(info, tty);
if (tty)
- clear_bit(TTY_IO_ERROR, &tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
tty_port_set_initialized(&info->port, 1);
@@ -1359,7 +1359,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty)
release_resources(info);
if (tty)
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
tty_port_set_initialized(&info->port, 0);
}
@@ -1060,7 +1060,7 @@ isdn_tty_startup(modem_info *info)
*/
info->mcr = UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2;
if (info->port.tty)
- clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
/*
* and set the speed of the serial port
*/
@@ -1097,7 +1097,7 @@ isdn_tty_shutdown(modem_info *info)
}
}
if (info->port.tty)
- set_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
tty_port_set_initialized(&info->port, 0);
}
@@ -607,7 +607,7 @@ static int sdio_uart_activate(struct tty_port *tport, struct tty_struct *tty)
* Set the TTY IO error marker - we will only clear this
* once we have successfully opened the port.
*/
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
kfifo_reset(&port->xmit_fifo);
@@ -655,7 +655,7 @@ static int sdio_uart_activate(struct tty_port *tport, struct tty_struct *tty)
if (!(sdio_uart_get_mctrl(port) & TIOCM_CTS))
tty->port->hw_stopped = 1;
- clear_bit(TTY_IO_ERROR, &tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
/* Kick the IRQ handler once while we're still holding the host lock */
sdio_uart_irq(port->func);
@@ -992,7 +992,7 @@ static int fwtty_port_activate(struct tty_port *tty_port,
unsigned int baud;
int err;
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
err = dma_fifo_alloc(&port->tx_fifo, FWTTY_PORT_TXFIFO_LEN,
cache_line_size(),
@@ -1019,7 +1019,7 @@ static int fwtty_port_activate(struct tty_port *tty_port,
__fwtty_write_port_status(port);
spin_unlock_bh(&port->lock);
- clear_bit(TTY_IO_ERROR, &tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
return 0;
}
@@ -547,7 +547,7 @@ static int startup(struct tty_struct *tty, struct serial_state *info)
retval = request_irq(IRQ_AMIGA_VERTB, ser_vbl_int, 0, "serial status", info);
if (retval) {
if (serial_isroot()) {
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
retval = 0;
}
goto errout;
@@ -566,7 +566,7 @@ static int startup(struct tty_struct *tty, struct serial_state *info)
info->MCR = SER_DTR | SER_RTS;
rtsdtr_ctrl(info->MCR);
- clear_bit(TTY_IO_ERROR, &tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
info->xmit.head = info->xmit.tail = 0;
/*
@@ -643,7 +643,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
info->MCR &= ~(SER_DTR|SER_RTS);
rtsdtr_ctrl(info->MCR);
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
tty_port_set_initialized(&info->tport, 0);
local_irq_restore(flags);
@@ -1281,7 +1281,7 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)
goto errout;
if (!info->type) {
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
goto errout;
}
@@ -1364,7 +1364,7 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)
tty_port_set_initialized(&info->port, 1);
- clear_bit(TTY_IO_ERROR, &tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
info->breakon = info->breakoff = 0;
memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats));
@@ -1445,7 +1445,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
/* it may be appropriate to clear _XMIT at
some later date (after testing)!!! */
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
tty_port_set_initialized(&info->port, 0);
spin_unlock_irqrestore(&card->card_lock, flags);
} else {
@@ -1470,7 +1470,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
if (C_HUPCL(&tty->termios))
tty_port_lower_dtr_rts(&info->port);
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
tty_port_set_initialized(&info->port, 0);
spin_unlock_irqrestore(&card->card_lock, flags);
@@ -2147,7 +2147,7 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
else
cyy_change_rts_dtr(info, TIOCM_DTR, 0);
- clear_bit(TTY_IO_ERROR, &tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
spin_unlock_irqrestore(&card->card_lock, flags);
} else {
@@ -2267,7 +2267,7 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
"was %x\n", info->line, retval);
}
- clear_bit(TTY_IO_ERROR, &tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
}
} /* set_line_char */
@@ -870,7 +870,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)
spin_lock_irqsave(&info->slock, flags);
if (!info->ioaddr || !info->type) {
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
free_page(page);
spin_unlock_irqrestore(&info->slock, flags);
return 0;
@@ -897,7 +897,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)
if (inb(info->ioaddr + UART_LSR) == 0xff) {
spin_unlock_irqrestore(&info->slock, flags);
if (capable(CAP_SYS_ADMIN)) {
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
return 0;
} else
return -ENODEV;
@@ -935,7 +935,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)
(void) inb(info->ioaddr + UART_IIR);
(void) inb(info->ioaddr + UART_MSR);
- clear_bit(TTY_IO_ERROR, &tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
/*
@@ -49,7 +49,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
if (tty->count > 2)
return;
}
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
wake_up_interruptible(&tty->read_wait);
wake_up_interruptible(&tty->write_wait);
spin_lock_irq(&tty->ctrl_lock);
@@ -246,13 +246,13 @@ static int pty_open(struct tty_struct *tty, struct file *filp)
if (tty->driver->subtype == PTY_TYPE_SLAVE && tty->link->count != 1)
goto out;
- clear_bit(TTY_IO_ERROR, &tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
clear_bit(TTY_OTHER_CLOSED, &tty->link->flags);
set_bit(TTY_THROTTLED, &tty->flags);
return 0;
out:
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
return -EIO;
}
@@ -2659,7 +2659,7 @@ startup(struct e100_serial * info)
}
if (info->port.tty)
- clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
info->xmit.head = info->xmit.tail = 0;
info->first_recv_buffer = info->last_recv_buffer = NULL;
@@ -2775,7 +2775,7 @@ shutdown(struct e100_serial * info)
}
if (info->port.tty)
- set_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
tty_port_set_initialized(&info->port, 0);
local_irq_restore(flags);
@@ -2442,7 +2442,7 @@ static void ic4_shutdown(struct uart_port *the_port)
wake_up_interruptible(&state->port.delta_msr_wait);
if (state->port.tty)
- set_bit(TTY_IO_ERROR, &state->port.tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &state->port.iflags);
spin_lock_irqsave(&the_port->lock, port_flags);
set_notification(port, N_ALL, 0);
@@ -237,7 +237,7 @@ static int uart_startup(struct tty_struct *tty, struct uart_state *state,
retval = uart_port_startup(tty, state, init_hw);
if (retval)
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &port->iflags);
return retval;
}
@@ -257,8 +257,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
/*
* Set the TTY IO error marker
*/
- if (tty)
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &port->iflags);
if (tty_port_initialized(port)) {
tty_port_set_initialized(port, 0);
@@ -1780,7 +1780,7 @@ static int startup(struct mgsl_struct * info)
if ( retval ) {
if (capable(CAP_SYS_ADMIN) && info->port.tty)
- set_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
mgsl_release_resources(info);
return retval;
}
@@ -1789,7 +1789,7 @@ static int startup(struct mgsl_struct * info)
mgsl_change_params(info);
if (info->port.tty)
- clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
tty_port_set_initialized(&info->port, 1);
@@ -1854,7 +1854,7 @@ static void shutdown(struct mgsl_struct * info)
mgsl_release_resources(info);
if (info->port.tty)
- set_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
tty_port_set_initialized(&info->port, 0);
} /* end of shutdown() */
@@ -2440,7 +2440,7 @@ static int startup(struct slgt_info *info)
change_params(info);
if (info->port.tty)
- clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
tty_port_set_initialized(&info->port, 1);
@@ -2487,7 +2487,7 @@ static void shutdown(struct slgt_info *info)
spin_unlock_irqrestore(&info->lock,flags);
if (info->port.tty)
- set_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
tty_port_set_initialized(&info->port, 0);
}
@@ -2660,7 +2660,7 @@ static int startup(SLMP_INFO * info)
mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10));
if (info->port.tty)
- clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
tty_port_set_initialized(&info->port, 1);
@@ -2703,7 +2703,7 @@ static void shutdown(SLMP_INFO * info)
spin_unlock_irqrestore(&info->lock,flags);
if (info->port.tty)
- set_bit(TTY_IO_ERROR, &info->port.tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &info->port.iflags);
tty_port_set_initialized(&info->port, 0);
}
@@ -239,7 +239,7 @@ void tty_port_hangup(struct tty_port *port)
port->count = 0;
tty = port->tty;
if (tty)
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
port->tty = NULL;
spin_unlock_irqrestore(&port->lock, flags);
tty_port_set_active(port, 0);
@@ -531,7 +531,7 @@ void tty_port_close(struct tty_port *port, struct tty_struct *tty,
if (tty_port_close_start(port, tty, filp) == 0)
return;
tty_port_shutdown(port, tty);
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
tty_port_close_end(port, tty);
tty_port_tty_set(port, NULL);
}
@@ -580,7 +580,7 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty,
mutex_lock(&port->mutex);
if (!tty_port_initialized(port)) {
- clear_bit(TTY_IO_ERROR, &tty->flags);
+ clear_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
if (port->ops->activate) {
int retval = port->ops->activate(port, tty);
if (retval) {
@@ -256,6 +256,8 @@ struct tty_port {
#define TTY_PORT_CTS_FLOW 3 /* h/w flow control enabled */
#define TTY_PORT_CHECK_CD 4 /* carrier detect enabled */
+#define TTY_PORT_IO_ERROR 3 /* device has I/O error */
+
/*
* Where all of the state associated with a tty is kept while the tty
* is open. Since the termios state should be kept even if the tty
@@ -347,7 +349,6 @@ struct tty_file_private {
* clear_bit() to make things atomic.
*/
#define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */
-#define TTY_IO_ERROR 1 /* Cause an I/O error (may be no ldisc too) */
#define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */
#define TTY_EXCLUSIVE 3 /* Exclusive open mode */
#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */
@@ -374,7 +375,7 @@ static inline void tty_set_flow_change(struct tty_struct *tty, int val)
static inline bool tty_io_error(struct tty_struct *tty)
{
- return test_bit(TTY_IO_ERROR, &tty->flags);
+ return test_bit(TTY_PORT_IO_ERROR, &tty->port->flags);
}
static inline bool tty_throttled(struct tty_struct *tty)
@@ -115,7 +115,7 @@ static int rfcomm_dev_activate(struct tty_port *port, struct tty_struct *tty)
err = rfcomm_dlc_open(dev->dlc, &dev->src, &dev->dst, dev->channel);
if (err)
- set_bit(TTY_IO_ERROR, &tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &tty->port->iflags);
return err;
}
@@ -927,7 +927,7 @@ static void ircomm_tty_hangup(struct tty_struct *tty)
spin_lock_irqsave(&port->lock, flags);
if (port->tty) {
- set_bit(TTY_IO_ERROR, &port->tty->flags);
+ set_bit(TTY_PORT_IO_ERROR, &port->iflags);
tty_kref_put(port->tty);
}
port->tty = NULL;
TTY_IO_ERROR is a property of the tty port rather than the tty, so move it to tty_port struct and remove another dependency on tty_struct from drivers. Partially converted with coccinelle: @@ identifier t; identifier func; @@ - func(TTY_IO_ERROR, &t->flags) + func(TTY_PORT_IO_ERROR, &t->port->iflags) @@ expression port; identifier func; @@ - func(TTY_IO_ERROR, &port.tty->flags) + func(TTY_PORT_IO_ERROR, &port.iflags) Signed-off-by: Rob Herring <robh@kernel.org> --- drivers/char/pcmcia/synclink_cs.c | 6 +++--- drivers/isdn/i4l/isdn_tty.c | 4 ++-- drivers/mmc/card/sdio_uart.c | 4 ++-- drivers/staging/fwserial/fwserial.c | 4 ++-- drivers/tty/amiserial.c | 6 +++--- drivers/tty/cyclades.c | 12 ++++++------ drivers/tty/mxser.c | 6 +++--- drivers/tty/pty.c | 6 +++--- drivers/tty/serial/crisv10.c | 4 ++-- drivers/tty/serial/ioc4_serial.c | 2 +- drivers/tty/serial/serial_core.c | 5 ++--- drivers/tty/synclink.c | 6 +++--- drivers/tty/synclink_gt.c | 4 ++-- drivers/tty/synclinkmp.c | 4 ++-- drivers/tty/tty_port.c | 6 +++--- include/linux/tty.h | 5 +++-- net/bluetooth/rfcomm/tty.c | 2 +- net/irda/ircomm/ircomm_tty.c | 2 +- 18 files changed, 44 insertions(+), 44 deletions(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html