mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
serial: kill off uart_info
We moved this into uart_state, now move the fields out of the separate structure and kill it off. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
11d85d7b2e
commit
ebd2c8f6d2
50 changed files with 422 additions and 432 deletions
|
@ -95,7 +95,7 @@ void foo(void)
|
|||
OFFSET(__iobase, mn10300_serial_port, _iobase);
|
||||
|
||||
DEFINE(__UART_XMIT_SIZE, UART_XMIT_SIZE);
|
||||
OFFSET(__xmit_buffer, uart_info, xmit.buf);
|
||||
OFFSET(__xmit_head, uart_info, xmit.head);
|
||||
OFFSET(__xmit_tail, uart_info, xmit.tail);
|
||||
OFFSET(__xmit_buffer, uart_state, xmit.buf);
|
||||
OFFSET(__xmit_head, uart_state, xmit.head);
|
||||
OFFSET(__xmit_tail, uart_state, xmit.tail);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ static void serial21285_enable_ms(struct uart_port *port)
|
|||
static irqreturn_t serial21285_rx_chars(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_port *port = dev_id;
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
unsigned int status, ch, flag, rxs, max_count = 256;
|
||||
|
||||
status = *CSR_UARTFLG;
|
||||
|
@ -124,7 +124,7 @@ static irqreturn_t serial21285_rx_chars(int irq, void *dev_id)
|
|||
static irqreturn_t serial21285_tx_chars(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_port *port = dev_id;
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
int count = 256;
|
||||
|
||||
if (port->x_char) {
|
||||
|
@ -235,8 +235,8 @@ serial21285_set_termios(struct uart_port *port, struct ktermios *termios,
|
|||
baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
|
||||
quot = uart_get_divisor(port, baud);
|
||||
|
||||
if (port->info && port->info->port.tty) {
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
if (port->state && port->state->port.tty) {
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
unsigned int b = port->uartclk / (16 * quot);
|
||||
tty_encode_baud_rate(tty, b, b);
|
||||
}
|
||||
|
|
|
@ -1382,7 +1382,7 @@ static void serial8250_enable_ms(struct uart_port *port)
|
|||
static void
|
||||
receive_chars(struct uart_8250_port *up, unsigned int *status)
|
||||
{
|
||||
struct tty_struct *tty = up->port.info->port.tty;
|
||||
struct tty_struct *tty = up->port.state->port.tty;
|
||||
unsigned char ch, lsr = *status;
|
||||
int max_count = 256;
|
||||
char flag;
|
||||
|
@ -1457,7 +1457,7 @@ receive_chars(struct uart_8250_port *up, unsigned int *status)
|
|||
|
||||
static void transmit_chars(struct uart_8250_port *up)
|
||||
{
|
||||
struct circ_buf *xmit = &up->port.info->xmit;
|
||||
struct circ_buf *xmit = &up->port.state->xmit;
|
||||
int count;
|
||||
|
||||
if (up->port.x_char) {
|
||||
|
@ -1500,7 +1500,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
|
|||
status |= up->msr_saved_flags;
|
||||
up->msr_saved_flags = 0;
|
||||
if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI &&
|
||||
up->port.info != NULL) {
|
||||
up->port.state != NULL) {
|
||||
if (status & UART_MSR_TERI)
|
||||
up->port.icount.rng++;
|
||||
if (status & UART_MSR_DDSR)
|
||||
|
@ -1510,7 +1510,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
|
|||
if (status & UART_MSR_DCTS)
|
||||
uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
|
||||
|
||||
wake_up_interruptible(&up->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&up->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -1764,7 +1764,7 @@ static void serial8250_backup_timeout(unsigned long data)
|
|||
up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
|
||||
spin_unlock_irqrestore(&up->port.lock, flags);
|
||||
if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) &&
|
||||
(!uart_circ_empty(&up->port.info->xmit) || up->port.x_char) &&
|
||||
(!uart_circ_empty(&up->port.state->xmit) || up->port.x_char) &&
|
||||
(lsr & UART_LSR_THRE)) {
|
||||
iir &= ~(UART_IIR_ID | UART_IIR_NO_INT);
|
||||
iir |= UART_IIR_THRI;
|
||||
|
|
|
@ -117,7 +117,7 @@ static void pl010_enable_ms(struct uart_port *port)
|
|||
|
||||
static void pl010_rx_chars(struct uart_amba_port *uap)
|
||||
{
|
||||
struct tty_struct *tty = uap->port.info->port.tty;
|
||||
struct tty_struct *tty = uap->port.state->port.tty;
|
||||
unsigned int status, ch, flag, rsr, max_count = 256;
|
||||
|
||||
status = readb(uap->port.membase + UART01x_FR);
|
||||
|
@ -172,7 +172,7 @@ static void pl010_rx_chars(struct uart_amba_port *uap)
|
|||
|
||||
static void pl010_tx_chars(struct uart_amba_port *uap)
|
||||
{
|
||||
struct circ_buf *xmit = &uap->port.info->xmit;
|
||||
struct circ_buf *xmit = &uap->port.state->xmit;
|
||||
int count;
|
||||
|
||||
if (uap->port.x_char) {
|
||||
|
@ -225,7 +225,7 @@ static void pl010_modem_status(struct uart_amba_port *uap)
|
|||
if (delta & UART01x_FR_CTS)
|
||||
uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);
|
||||
|
||||
wake_up_interruptible(&uap->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&uap->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
static irqreturn_t pl010_int(int irq, void *dev_id)
|
||||
|
|
|
@ -124,7 +124,7 @@ static void pl011_enable_ms(struct uart_port *port)
|
|||
|
||||
static void pl011_rx_chars(struct uart_amba_port *uap)
|
||||
{
|
||||
struct tty_struct *tty = uap->port.info->port.tty;
|
||||
struct tty_struct *tty = uap->port.state->port.tty;
|
||||
unsigned int status, ch, flag, max_count = 256;
|
||||
|
||||
status = readw(uap->port.membase + UART01x_FR);
|
||||
|
@ -175,7 +175,7 @@ static void pl011_rx_chars(struct uart_amba_port *uap)
|
|||
|
||||
static void pl011_tx_chars(struct uart_amba_port *uap)
|
||||
{
|
||||
struct circ_buf *xmit = &uap->port.info->xmit;
|
||||
struct circ_buf *xmit = &uap->port.state->xmit;
|
||||
int count;
|
||||
|
||||
if (uap->port.x_char) {
|
||||
|
@ -226,7 +226,7 @@ static void pl011_modem_status(struct uart_amba_port *uap)
|
|||
if (delta & UART01x_FR_CTS)
|
||||
uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);
|
||||
|
||||
wake_up_interruptible(&uap->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&uap->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
static irqreturn_t pl011_int(int irq, void *dev_id)
|
||||
|
|
|
@ -427,7 +427,7 @@ static void atmel_rx_chars(struct uart_port *port)
|
|||
*/
|
||||
static void atmel_tx_chars(struct uart_port *port)
|
||||
{
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
if (port->x_char && UART_GET_CSR(port) & ATMEL_US_TXRDY) {
|
||||
UART_PUT_CHAR(port, port->x_char);
|
||||
|
@ -560,7 +560,7 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id)
|
|||
static void atmel_tx_dma(struct uart_port *port)
|
||||
{
|
||||
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
|
||||
int count;
|
||||
|
||||
|
@ -663,14 +663,14 @@ static void atmel_rx_from_ring(struct uart_port *port)
|
|||
* uart_start(), which takes the lock.
|
||||
*/
|
||||
spin_unlock(&port->lock);
|
||||
tty_flip_buffer_push(port->info->port.tty);
|
||||
tty_flip_buffer_push(port->state->port.tty);
|
||||
spin_lock(&port->lock);
|
||||
}
|
||||
|
||||
static void atmel_rx_from_dma(struct uart_port *port)
|
||||
{
|
||||
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
struct atmel_dma_buffer *pdc;
|
||||
int rx_idx = atmel_port->pdc_rx_idx;
|
||||
unsigned int head;
|
||||
|
@ -776,7 +776,7 @@ static void atmel_tasklet_func(unsigned long data)
|
|||
if (status_change & ATMEL_US_CTS)
|
||||
uart_handle_cts_change(port, !(status & ATMEL_US_CTS));
|
||||
|
||||
wake_up_interruptible(&port->info->delta_msr_wait);
|
||||
wake_up_interruptible(&port->state->delta_msr_wait);
|
||||
|
||||
atmel_port->irq_status_prev = status;
|
||||
}
|
||||
|
@ -795,7 +795,7 @@ static void atmel_tasklet_func(unsigned long data)
|
|||
static int atmel_startup(struct uart_port *port)
|
||||
{
|
||||
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
int retval;
|
||||
|
||||
/*
|
||||
|
@ -854,7 +854,7 @@ static int atmel_startup(struct uart_port *port)
|
|||
}
|
||||
if (atmel_use_dma_tx(port)) {
|
||||
struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
pdc->buf = xmit->buf;
|
||||
pdc->dma_addr = dma_map_single(port->dev,
|
||||
|
|
|
@ -144,7 +144,7 @@ static void bfin_serial_stop_tx(struct uart_port *port)
|
|||
{
|
||||
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
|
||||
#ifdef CONFIG_SERIAL_BFIN_DMA
|
||||
struct circ_buf *xmit = &uart->port.info->xmit;
|
||||
struct circ_buf *xmit = &uart->port.state->xmit;
|
||||
#endif
|
||||
|
||||
while (!(UART_GET_LSR(uart) & TEMT))
|
||||
|
@ -171,7 +171,7 @@ static void bfin_serial_stop_tx(struct uart_port *port)
|
|||
static void bfin_serial_start_tx(struct uart_port *port)
|
||||
{
|
||||
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
|
||||
struct tty_struct *tty = uart->port.info->port.tty;
|
||||
struct tty_struct *tty = uart->port.state->port.tty;
|
||||
|
||||
#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
|
||||
if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) {
|
||||
|
@ -243,10 +243,10 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!uart->port.info || !uart->port.info->port.tty)
|
||||
if (!uart->port.state || !uart->port.state->port.tty)
|
||||
return;
|
||||
#endif
|
||||
tty = uart->port.info->port.tty;
|
||||
tty = uart->port.state->port.tty;
|
||||
|
||||
if (ANOMALY_05000363) {
|
||||
/* The BF533 (and BF561) family of processors have a nice anomaly
|
||||
|
@ -331,7 +331,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
|
|||
|
||||
static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
|
||||
{
|
||||
struct circ_buf *xmit = &uart->port.info->xmit;
|
||||
struct circ_buf *xmit = &uart->port.state->xmit;
|
||||
|
||||
if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) {
|
||||
#ifdef CONFIG_BF54x
|
||||
|
@ -398,7 +398,7 @@ static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id)
|
|||
#ifdef CONFIG_SERIAL_BFIN_DMA
|
||||
static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
|
||||
{
|
||||
struct circ_buf *xmit = &uart->port.info->xmit;
|
||||
struct circ_buf *xmit = &uart->port.state->xmit;
|
||||
|
||||
uart->tx_done = 0;
|
||||
|
||||
|
@ -436,7 +436,7 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
|
|||
|
||||
static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
|
||||
{
|
||||
struct tty_struct *tty = uart->port.info->port.tty;
|
||||
struct tty_struct *tty = uart->port.state->port.tty;
|
||||
int i, flg, status;
|
||||
|
||||
status = UART_GET_LSR(uart);
|
||||
|
@ -529,7 +529,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
|
|||
static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id)
|
||||
{
|
||||
struct bfin_serial_port *uart = dev_id;
|
||||
struct circ_buf *xmit = &uart->port.info->xmit;
|
||||
struct circ_buf *xmit = &uart->port.state->xmit;
|
||||
|
||||
#ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
|
||||
if (uart->scts && !(bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) {
|
||||
|
@ -965,10 +965,10 @@ static void bfin_serial_set_ldisc(struct uart_port *port)
|
|||
int line = port->line;
|
||||
unsigned short val;
|
||||
|
||||
if (line >= port->info->port.tty->driver->num)
|
||||
if (line >= port->state->port.tty->driver->num)
|
||||
return;
|
||||
|
||||
switch (port->info->port.tty->termios->c_line) {
|
||||
switch (port->state->port.tty->termios->c_line) {
|
||||
case N_IRDA:
|
||||
val = UART_GET_GCTL(&bfin_serial_ports[line]);
|
||||
val |= (IREN | RPOLC);
|
||||
|
|
|
@ -178,7 +178,7 @@ static int sport_uart_setup(struct sport_uart_port *up, int sclk, int baud_rate)
|
|||
static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id)
|
||||
{
|
||||
struct sport_uart_port *up = dev_id;
|
||||
struct tty_struct *tty = up->port.info->port.tty;
|
||||
struct tty_struct *tty = up->port.state->port.tty;
|
||||
unsigned int ch;
|
||||
|
||||
do {
|
||||
|
@ -205,7 +205,7 @@ static irqreturn_t sport_uart_tx_irq(int irq, void *dev_id)
|
|||
static irqreturn_t sport_uart_err_irq(int irq, void *dev_id)
|
||||
{
|
||||
struct sport_uart_port *up = dev_id;
|
||||
struct tty_struct *tty = up->port.info->port.tty;
|
||||
struct tty_struct *tty = up->port.state->port.tty;
|
||||
unsigned int stat = SPORT_GET_STAT(up);
|
||||
|
||||
/* Overflow in RX FIFO */
|
||||
|
@ -290,7 +290,7 @@ static int sport_startup(struct uart_port *port)
|
|||
|
||||
static void sport_uart_tx_chars(struct sport_uart_port *up)
|
||||
{
|
||||
struct circ_buf *xmit = &up->port.info->xmit;
|
||||
struct circ_buf *xmit = &up->port.state->xmit;
|
||||
|
||||
if (SPORT_GET_STAT(up) & TXF)
|
||||
return;
|
||||
|
|
|
@ -93,7 +93,7 @@ static void clps711xuart_enable_ms(struct uart_port *port)
|
|||
static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_port *port = dev_id;
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
unsigned int status, ch, flg;
|
||||
|
||||
status = clps_readl(SYSFLG(port));
|
||||
|
@ -147,7 +147,7 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id)
|
|||
static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_port *port = dev_id;
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
int count;
|
||||
|
||||
if (port->x_char) {
|
||||
|
|
|
@ -244,7 +244,7 @@ static void cpm_uart_int_rx(struct uart_port *port)
|
|||
int i;
|
||||
unsigned char ch;
|
||||
u8 *cp;
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
|
||||
cbd_t __iomem *bdp;
|
||||
u16 status;
|
||||
|
|
|
@ -197,7 +197,7 @@ static inline void dz_receive_chars(struct dz_mux *mux)
|
|||
while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) {
|
||||
dport = &mux->dport[LINE(status)];
|
||||
uport = &dport->port;
|
||||
tty = uport->info->port.tty; /* point to the proper dev */
|
||||
tty = uport->state->port.tty; /* point to the proper dev */
|
||||
|
||||
ch = UCHAR(status); /* grab the char */
|
||||
flag = TTY_NORMAL;
|
||||
|
@ -249,7 +249,7 @@ static inline void dz_receive_chars(struct dz_mux *mux)
|
|||
}
|
||||
for (i = 0; i < DZ_NB_PORT; i++)
|
||||
if (lines_rx[i])
|
||||
tty_flip_buffer_push(mux->dport[i].port.info->port.tty);
|
||||
tty_flip_buffer_push(mux->dport[i].port.state->port.tty);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -268,7 +268,7 @@ static inline void dz_transmit_chars(struct dz_mux *mux)
|
|||
|
||||
status = dz_in(dport, DZ_CSR);
|
||||
dport = &mux->dport[LINE(status)];
|
||||
xmit = &dport->port.info->xmit;
|
||||
xmit = &dport->port.state->xmit;
|
||||
|
||||
if (dport->port.x_char) { /* XON/XOFF chars */
|
||||
dz_out(dport, DZ_TDR, dport->port.x_char);
|
||||
|
|
|
@ -627,7 +627,7 @@ static int icom_write(struct uart_port *port)
|
|||
unsigned long data_count;
|
||||
unsigned char cmdReg;
|
||||
unsigned long offset;
|
||||
int temp_tail = port->info->xmit.tail;
|
||||
int temp_tail = port->state->xmit.tail;
|
||||
|
||||
trace(ICOM_PORT, "WRITE", 0);
|
||||
|
||||
|
@ -638,11 +638,11 @@ static int icom_write(struct uart_port *port)
|
|||
}
|
||||
|
||||
data_count = 0;
|
||||
while ((port->info->xmit.head != temp_tail) &&
|
||||
while ((port->state->xmit.head != temp_tail) &&
|
||||
(data_count <= XMIT_BUFF_SZ)) {
|
||||
|
||||
ICOM_PORT->xmit_buf[data_count++] =
|
||||
port->info->xmit.buf[temp_tail];
|
||||
port->state->xmit.buf[temp_tail];
|
||||
|
||||
temp_tail++;
|
||||
temp_tail &= (UART_XMIT_SIZE - 1);
|
||||
|
@ -694,7 +694,7 @@ static inline void check_modem_status(struct icom_port *icom_port)
|
|||
uart_handle_cts_change(&icom_port->uart_port,
|
||||
delta_status & ICOM_CTS);
|
||||
|
||||
wake_up_interruptible(&icom_port->uart_port.info->
|
||||
wake_up_interruptible(&icom_port->uart_port.state->
|
||||
delta_msr_wait);
|
||||
old_status = status;
|
||||
}
|
||||
|
@ -718,10 +718,10 @@ static void xmit_interrupt(u16 port_int_reg, struct icom_port *icom_port)
|
|||
icom_port->uart_port.icount.tx += count;
|
||||
|
||||
for (i=0; i<count &&
|
||||
!uart_circ_empty(&icom_port->uart_port.info->xmit); i++) {
|
||||
!uart_circ_empty(&icom_port->uart_port.state->xmit); i++) {
|
||||
|
||||
icom_port->uart_port.info->xmit.tail++;
|
||||
icom_port->uart_port.info->xmit.tail &=
|
||||
icom_port->uart_port.state->xmit.tail++;
|
||||
icom_port->uart_port.state->xmit.tail &=
|
||||
(UART_XMIT_SIZE - 1);
|
||||
}
|
||||
|
||||
|
@ -735,7 +735,7 @@ static void xmit_interrupt(u16 port_int_reg, struct icom_port *icom_port)
|
|||
static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port)
|
||||
{
|
||||
short int count, rcv_buff;
|
||||
struct tty_struct *tty = icom_port->uart_port.info->port.tty;
|
||||
struct tty_struct *tty = icom_port->uart_port.state->port.tty;
|
||||
unsigned short int status;
|
||||
struct uart_icount *icount;
|
||||
unsigned long offset;
|
||||
|
|
|
@ -224,7 +224,7 @@ static void imx_mctrl_check(struct imx_port *sport)
|
|||
if (changed & TIOCM_CTS)
|
||||
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
|
||||
|
||||
wake_up_interruptible(&sport->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&sport->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -236,7 +236,7 @@ static void imx_timeout(unsigned long data)
|
|||
struct imx_port *sport = (struct imx_port *)data;
|
||||
unsigned long flags;
|
||||
|
||||
if (sport->port.info) {
|
||||
if (sport->port.state) {
|
||||
spin_lock_irqsave(&sport->port.lock, flags);
|
||||
imx_mctrl_check(sport);
|
||||
spin_unlock_irqrestore(&sport->port.lock, flags);
|
||||
|
@ -323,7 +323,7 @@ static void imx_enable_ms(struct uart_port *port)
|
|||
|
||||
static inline void imx_transmit_buffer(struct imx_port *sport)
|
||||
{
|
||||
struct circ_buf *xmit = &sport->port.info->xmit;
|
||||
struct circ_buf *xmit = &sport->port.state->xmit;
|
||||
|
||||
while (!(readl(sport->port.membase + UTS) & UTS_TXFULL)) {
|
||||
/* send xmit->buf[xmit->tail]
|
||||
|
@ -388,7 +388,7 @@ static irqreturn_t imx_rtsint(int irq, void *dev_id)
|
|||
|
||||
writel(USR1_RTSD, sport->port.membase + USR1);
|
||||
uart_handle_cts_change(&sport->port, !!val);
|
||||
wake_up_interruptible(&sport->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&sport->port.state->delta_msr_wait);
|
||||
|
||||
spin_unlock_irqrestore(&sport->port.lock, flags);
|
||||
return IRQ_HANDLED;
|
||||
|
@ -397,7 +397,7 @@ static irqreturn_t imx_rtsint(int irq, void *dev_id)
|
|||
static irqreturn_t imx_txint(int irq, void *dev_id)
|
||||
{
|
||||
struct imx_port *sport = dev_id;
|
||||
struct circ_buf *xmit = &sport->port.info->xmit;
|
||||
struct circ_buf *xmit = &sport->port.state->xmit;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&sport->port.lock,flags);
|
||||
|
@ -427,7 +427,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
|
|||
{
|
||||
struct imx_port *sport = dev_id;
|
||||
unsigned int rx,flg,ignored = 0;
|
||||
struct tty_struct *tty = sport->port.info->port.tty;
|
||||
struct tty_struct *tty = sport->port.state->port.tty;
|
||||
unsigned long flags, temp;
|
||||
|
||||
spin_lock_irqsave(&sport->port.lock,flags);
|
||||
|
@ -900,11 +900,11 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
|
|||
rational_best_approximation(16 * div * baud, sport->port.uartclk,
|
||||
1 << 16, 1 << 16, &num, &denom);
|
||||
|
||||
if (port->info && port->info->port.tty) {
|
||||
if (port->state && port->state->port.tty) {
|
||||
tdiv64 = sport->port.uartclk;
|
||||
tdiv64 *= num;
|
||||
do_div(tdiv64, denom * 16 * div);
|
||||
tty_encode_baud_rate(sport->port.info->port.tty,
|
||||
tty_encode_baud_rate(sport->port.state->port.tty,
|
||||
(speed_t)tdiv64, (speed_t)tdiv64);
|
||||
}
|
||||
|
||||
|
|
|
@ -897,25 +897,25 @@ static void transmit_chars(struct uart_port *the_port)
|
|||
char *start;
|
||||
struct tty_struct *tty;
|
||||
struct ioc3_port *port = get_ioc3_port(the_port);
|
||||
struct uart_info *info;
|
||||
struct uart_state *state;
|
||||
|
||||
if (!the_port)
|
||||
return;
|
||||
if (!port)
|
||||
return;
|
||||
|
||||
info = the_port->info;
|
||||
tty = info->port.tty;
|
||||
state = the_port->state;
|
||||
tty = state->port.tty;
|
||||
|
||||
if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) {
|
||||
if (uart_circ_empty(&state->xmit) || uart_tx_stopped(the_port)) {
|
||||
/* Nothing to do or hw stopped */
|
||||
set_notification(port, N_ALL_OUTPUT, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
head = info->xmit.head;
|
||||
tail = info->xmit.tail;
|
||||
start = (char *)&info->xmit.buf[tail];
|
||||
head = state->xmit.head;
|
||||
tail = state->xmit.tail;
|
||||
start = (char *)&state->xmit.buf[tail];
|
||||
|
||||
/* write out all the data or until the end of the buffer */
|
||||
xmit_count = (head < tail) ? (UART_XMIT_SIZE - tail) : (head - tail);
|
||||
|
@ -928,14 +928,14 @@ static void transmit_chars(struct uart_port *the_port)
|
|||
/* advance the pointers */
|
||||
tail += result;
|
||||
tail &= UART_XMIT_SIZE - 1;
|
||||
info->xmit.tail = tail;
|
||||
start = (char *)&info->xmit.buf[tail];
|
||||
state->xmit.tail = tail;
|
||||
start = (char *)&state->xmit.buf[tail];
|
||||
}
|
||||
}
|
||||
if (uart_circ_chars_pending(&info->xmit) < WAKEUP_CHARS)
|
||||
if (uart_circ_chars_pending(&state->xmit) < WAKEUP_CHARS)
|
||||
uart_write_wakeup(the_port);
|
||||
|
||||
if (uart_circ_empty(&info->xmit)) {
|
||||
if (uart_circ_empty(&state->xmit)) {
|
||||
set_notification(port, N_OUTPUT_LOWAT, 0);
|
||||
} else {
|
||||
set_notification(port, N_OUTPUT_LOWAT, 1);
|
||||
|
@ -956,7 +956,7 @@ ioc3_change_speed(struct uart_port *the_port,
|
|||
unsigned int cflag;
|
||||
int baud;
|
||||
int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8;
|
||||
struct uart_info *info = the_port->info;
|
||||
struct uart_state *state = the_port->state;
|
||||
|
||||
cflag = new_termios->c_cflag;
|
||||
|
||||
|
@ -997,14 +997,14 @@ ioc3_change_speed(struct uart_port *the_port,
|
|||
|
||||
the_port->ignore_status_mask = N_ALL_INPUT;
|
||||
|
||||
info->port.tty->low_latency = 1;
|
||||
state->port.tty->low_latency = 1;
|
||||
|
||||
if (I_IGNPAR(info->port.tty))
|
||||
if (I_IGNPAR(state->port.tty))
|
||||
the_port->ignore_status_mask &= ~(N_PARITY_ERROR
|
||||
| N_FRAMING_ERROR);
|
||||
if (I_IGNBRK(info->port.tty)) {
|
||||
if (I_IGNBRK(state->port.tty)) {
|
||||
the_port->ignore_status_mask &= ~N_BREAK;
|
||||
if (I_IGNPAR(info->port.tty))
|
||||
if (I_IGNPAR(state->port.tty))
|
||||
the_port->ignore_status_mask &= ~N_OVERRUN_ERROR;
|
||||
}
|
||||
if (!(cflag & CREAD)) {
|
||||
|
@ -1286,7 +1286,7 @@ static inline int do_read(struct uart_port *the_port, char *buf, int len)
|
|||
uart_handle_dcd_change
|
||||
(port->ip_port, 0);
|
||||
wake_up_interruptible
|
||||
(&the_port->info->
|
||||
(&the_port->state->
|
||||
delta_msr_wait);
|
||||
}
|
||||
|
||||
|
@ -1392,21 +1392,21 @@ static int receive_chars(struct uart_port *the_port)
|
|||
struct tty_struct *tty;
|
||||
unsigned char ch[MAX_CHARS];
|
||||
int read_count = 0, read_room, flip = 0;
|
||||
struct uart_info *info = the_port->info;
|
||||
struct uart_state *state = the_port->state;
|
||||
struct ioc3_port *port = get_ioc3_port(the_port);
|
||||
unsigned long pflags;
|
||||
|
||||
/* Make sure all the pointers are "good" ones */
|
||||
if (!info)
|
||||
if (!state)
|
||||
return 0;
|
||||
if (!info->port.tty)
|
||||
if (!state->port.tty)
|
||||
return 0;
|
||||
|
||||
if (!(port->ip_flags & INPUT_ENABLE))
|
||||
return 0;
|
||||
|
||||
spin_lock_irqsave(&the_port->lock, pflags);
|
||||
tty = info->port.tty;
|
||||
tty = state->port.tty;
|
||||
|
||||
read_count = do_read(the_port, ch, MAX_CHARS);
|
||||
if (read_count > 0) {
|
||||
|
@ -1491,7 +1491,7 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
|
|||
uart_handle_dcd_change(the_port,
|
||||
shadow & SHADOW_DCD);
|
||||
wake_up_interruptible
|
||||
(&the_port->info->delta_msr_wait);
|
||||
(&the_port->state->delta_msr_wait);
|
||||
} else if ((port->ip_notify & N_DDCD)
|
||||
&& !(shadow & SHADOW_DCD)) {
|
||||
/* Flag delta DCD/no DCD */
|
||||
|
@ -1511,7 +1511,7 @@ ioc3uart_intr_one(struct ioc3_submodule *is,
|
|||
uart_handle_cts_change(the_port, shadow
|
||||
& SHADOW_CTS);
|
||||
wake_up_interruptible
|
||||
(&the_port->info->delta_msr_wait);
|
||||
(&the_port->state->delta_msr_wait);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1721,14 +1721,14 @@ static void ic3_shutdown(struct uart_port *the_port)
|
|||
{
|
||||
unsigned long port_flags;
|
||||
struct ioc3_port *port;
|
||||
struct uart_info *info;
|
||||
struct uart_state *state;
|
||||
|
||||
port = get_ioc3_port(the_port);
|
||||
if (!port)
|
||||
return;
|
||||
|
||||
info = the_port->info;
|
||||
wake_up_interruptible(&info->delta_msr_wait);
|
||||
state = the_port->state;
|
||||
wake_up_interruptible(&state->delta_msr_wait);
|
||||
|
||||
spin_lock_irqsave(&the_port->lock, port_flags);
|
||||
set_notification(port, N_ALL, 0);
|
||||
|
|
|
@ -1627,25 +1627,25 @@ static void transmit_chars(struct uart_port *the_port)
|
|||
char *start;
|
||||
struct tty_struct *tty;
|
||||
struct ioc4_port *port = get_ioc4_port(the_port, 0);
|
||||
struct uart_info *info;
|
||||
struct uart_state *state;
|
||||
|
||||
if (!the_port)
|
||||
return;
|
||||
if (!port)
|
||||
return;
|
||||
|
||||
info = the_port->info;
|
||||
tty = info->port.tty;
|
||||
state = the_port->state;
|
||||
tty = state->port.tty;
|
||||
|
||||
if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) {
|
||||
if (uart_circ_empty(&state->xmit) || uart_tx_stopped(the_port)) {
|
||||
/* Nothing to do or hw stopped */
|
||||
set_notification(port, N_ALL_OUTPUT, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
head = info->xmit.head;
|
||||
tail = info->xmit.tail;
|
||||
start = (char *)&info->xmit.buf[tail];
|
||||
head = state->xmit.head;
|
||||
tail = state->xmit.tail;
|
||||
start = (char *)&state->xmit.buf[tail];
|
||||
|
||||
/* write out all the data or until the end of the buffer */
|
||||
xmit_count = (head < tail) ? (UART_XMIT_SIZE - tail) : (head - tail);
|
||||
|
@ -1658,14 +1658,14 @@ static void transmit_chars(struct uart_port *the_port)
|
|||
/* advance the pointers */
|
||||
tail += result;
|
||||
tail &= UART_XMIT_SIZE - 1;
|
||||
info->xmit.tail = tail;
|
||||
start = (char *)&info->xmit.buf[tail];
|
||||
state->xmit.tail = tail;
|
||||
start = (char *)&state->xmit.buf[tail];
|
||||
}
|
||||
}
|
||||
if (uart_circ_chars_pending(&info->xmit) < WAKEUP_CHARS)
|
||||
if (uart_circ_chars_pending(&state->xmit) < WAKEUP_CHARS)
|
||||
uart_write_wakeup(the_port);
|
||||
|
||||
if (uart_circ_empty(&info->xmit)) {
|
||||
if (uart_circ_empty(&state->xmit)) {
|
||||
set_notification(port, N_OUTPUT_LOWAT, 0);
|
||||
} else {
|
||||
set_notification(port, N_OUTPUT_LOWAT, 1);
|
||||
|
@ -1686,7 +1686,7 @@ ioc4_change_speed(struct uart_port *the_port,
|
|||
int baud, bits;
|
||||
unsigned cflag;
|
||||
int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8;
|
||||
struct uart_info *info = the_port->info;
|
||||
struct uart_state *state = the_port->state;
|
||||
|
||||
cflag = new_termios->c_cflag;
|
||||
|
||||
|
@ -1738,14 +1738,14 @@ ioc4_change_speed(struct uart_port *the_port,
|
|||
|
||||
the_port->ignore_status_mask = N_ALL_INPUT;
|
||||
|
||||
info->port.tty->low_latency = 1;
|
||||
state->port.tty->low_latency = 1;
|
||||
|
||||
if (I_IGNPAR(info->port.tty))
|
||||
if (I_IGNPAR(state->port.tty))
|
||||
the_port->ignore_status_mask &= ~(N_PARITY_ERROR
|
||||
| N_FRAMING_ERROR);
|
||||
if (I_IGNBRK(info->port.tty)) {
|
||||
if (I_IGNBRK(state->port.tty)) {
|
||||
the_port->ignore_status_mask &= ~N_BREAK;
|
||||
if (I_IGNPAR(info->port.tty))
|
||||
if (I_IGNPAR(state->port.tty))
|
||||
the_port->ignore_status_mask &= ~N_OVERRUN_ERROR;
|
||||
}
|
||||
if (!(cflag & CREAD)) {
|
||||
|
@ -1784,7 +1784,7 @@ ioc4_change_speed(struct uart_port *the_port,
|
|||
static inline int ic4_startup_local(struct uart_port *the_port)
|
||||
{
|
||||
struct ioc4_port *port;
|
||||
struct uart_info *info;
|
||||
struct uart_state *state;
|
||||
|
||||
if (!the_port)
|
||||
return -1;
|
||||
|
@ -1793,7 +1793,7 @@ static inline int ic4_startup_local(struct uart_port *the_port)
|
|||
if (!port)
|
||||
return -1;
|
||||
|
||||
info = the_port->info;
|
||||
state = the_port->state;
|
||||
|
||||
local_open(port);
|
||||
|
||||
|
@ -1801,7 +1801,7 @@ static inline int ic4_startup_local(struct uart_port *the_port)
|
|||
ioc4_set_proto(port, the_port->mapbase);
|
||||
|
||||
/* set the speed of the serial port */
|
||||
ioc4_change_speed(the_port, info->port.tty->termios,
|
||||
ioc4_change_speed(the_port, state->port.tty->termios,
|
||||
(struct ktermios *)0);
|
||||
|
||||
return 0;
|
||||
|
@ -1882,7 +1882,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
|
|||
the_port = port->ip_port;
|
||||
the_port->icount.dcd = 1;
|
||||
wake_up_interruptible
|
||||
(&the_port-> info->delta_msr_wait);
|
||||
(&the_port->state->delta_msr_wait);
|
||||
} else if ((port->ip_notify & N_DDCD)
|
||||
&& !(shadow & IOC4_SHADOW_DCD)) {
|
||||
/* Flag delta DCD/no DCD */
|
||||
|
@ -1904,7 +1904,7 @@ static void handle_intr(void *arg, uint32_t sio_ir)
|
|||
the_port->icount.cts =
|
||||
(shadow & IOC4_SHADOW_CTS) ? 1 : 0;
|
||||
wake_up_interruptible
|
||||
(&the_port->info->delta_msr_wait);
|
||||
(&the_port->state->delta_msr_wait);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2236,7 +2236,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
|
|||
&& port->ip_port) {
|
||||
the_port->icount.dcd = 0;
|
||||
wake_up_interruptible
|
||||
(&the_port->info->
|
||||
(&the_port->state->
|
||||
delta_msr_wait);
|
||||
}
|
||||
|
||||
|
@ -2341,17 +2341,17 @@ static void receive_chars(struct uart_port *the_port)
|
|||
unsigned char ch[IOC4_MAX_CHARS];
|
||||
int read_count, request_count = IOC4_MAX_CHARS;
|
||||
struct uart_icount *icount;
|
||||
struct uart_info *info = the_port->info;
|
||||
struct uart_state *state = the_port->state;
|
||||
unsigned long pflags;
|
||||
|
||||
/* Make sure all the pointers are "good" ones */
|
||||
if (!info)
|
||||
if (!state)
|
||||
return;
|
||||
if (!info->port.tty)
|
||||
if (!state->port.tty)
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(&the_port->lock, pflags);
|
||||
tty = info->port.tty;
|
||||
tty = state->port.tty;
|
||||
|
||||
request_count = tty_buffer_request_room(tty, IOC4_MAX_CHARS);
|
||||
|
||||
|
@ -2430,19 +2430,19 @@ static void ic4_shutdown(struct uart_port *the_port)
|
|||
{
|
||||
unsigned long port_flags;
|
||||
struct ioc4_port *port;
|
||||
struct uart_info *info;
|
||||
struct uart_state *state;
|
||||
|
||||
port = get_ioc4_port(the_port, 0);
|
||||
if (!port)
|
||||
return;
|
||||
|
||||
info = the_port->info;
|
||||
state = the_port->state;
|
||||
port->ip_port = NULL;
|
||||
|
||||
wake_up_interruptible(&info->delta_msr_wait);
|
||||
wake_up_interruptible(&state->delta_msr_wait);
|
||||
|
||||
if (info->port.tty)
|
||||
set_bit(TTY_IO_ERROR, &info->port.tty->flags);
|
||||
if (state->port.tty)
|
||||
set_bit(TTY_IO_ERROR, &state->port.tty->flags);
|
||||
|
||||
spin_lock_irqsave(&the_port->lock, port_flags);
|
||||
set_notification(port, N_ALL, 0);
|
||||
|
@ -2538,7 +2538,7 @@ static int ic4_startup(struct uart_port *the_port)
|
|||
int retval;
|
||||
struct ioc4_port *port;
|
||||
struct ioc4_control *control;
|
||||
struct uart_info *info;
|
||||
struct uart_state *state;
|
||||
unsigned long port_flags;
|
||||
|
||||
if (!the_port)
|
||||
|
@ -2546,7 +2546,7 @@ static int ic4_startup(struct uart_port *the_port)
|
|||
port = get_ioc4_port(the_port, 1);
|
||||
if (!port)
|
||||
return -ENODEV;
|
||||
info = the_port->info;
|
||||
state = the_port->state;
|
||||
|
||||
control = port->ip_control;
|
||||
if (!control) {
|
||||
|
|
|
@ -256,9 +256,9 @@ static struct tty_struct *ip22zilog_receive_chars(struct uart_ip22zilog_port *up
|
|||
unsigned int r1;
|
||||
|
||||
tty = NULL;
|
||||
if (up->port.info != NULL &&
|
||||
up->port.info->port.tty != NULL)
|
||||
tty = up->port.info->port.tty;
|
||||
if (up->port.state != NULL &&
|
||||
up->port.state->port.tty != NULL)
|
||||
tty = up->port.state->port.tty;
|
||||
|
||||
for (;;) {
|
||||
ch = readb(&channel->control);
|
||||
|
@ -354,7 +354,7 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
|
|||
uart_handle_cts_change(&up->port,
|
||||
(status & CTS));
|
||||
|
||||
wake_up_interruptible(&up->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&up->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
up->prev_status = status;
|
||||
|
@ -404,9 +404,9 @@ static void ip22zilog_transmit_chars(struct uart_ip22zilog_port *up,
|
|||
return;
|
||||
}
|
||||
|
||||
if (up->port.info == NULL)
|
||||
if (up->port.state == NULL)
|
||||
goto ack_tx_int;
|
||||
xmit = &up->port.info->xmit;
|
||||
xmit = &up->port.state->xmit;
|
||||
if (uart_circ_empty(xmit))
|
||||
goto ack_tx_int;
|
||||
if (uart_tx_stopped(&up->port))
|
||||
|
@ -607,7 +607,7 @@ static void ip22zilog_start_tx(struct uart_port *port)
|
|||
port->icount.tx++;
|
||||
port->x_char = 0;
|
||||
} else {
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
writeb(xmit->buf[xmit->tail], &channel->data);
|
||||
ZSDELAY();
|
||||
|
|
|
@ -989,7 +989,7 @@ static void neo_param(struct jsm_channel *ch)
|
|||
{ 50, B50 },
|
||||
};
|
||||
|
||||
cflag = C_BAUD(ch->uart_port.info->port.tty);
|
||||
cflag = C_BAUD(ch->uart_port.state->port.tty);
|
||||
baud = 9600;
|
||||
for (i = 0; i < ARRAY_SIZE(baud_rates); i++) {
|
||||
if (baud_rates[i].cflag == cflag) {
|
||||
|
|
|
@ -147,7 +147,7 @@ static void jsm_tty_send_xchar(struct uart_port *port, char ch)
|
|||
struct ktermios *termios;
|
||||
|
||||
spin_lock_irqsave(&port->lock, lock_flags);
|
||||
termios = port->info->port.tty->termios;
|
||||
termios = port->state->port.tty->termios;
|
||||
if (ch == termios->c_cc[VSTART])
|
||||
channel->ch_bd->bd_ops->send_start_character(channel);
|
||||
|
||||
|
@ -245,7 +245,7 @@ static int jsm_tty_open(struct uart_port *port)
|
|||
channel->ch_cached_lsr = 0;
|
||||
channel->ch_stops_sent = 0;
|
||||
|
||||
termios = port->info->port.tty->termios;
|
||||
termios = port->state->port.tty->termios;
|
||||
channel->ch_c_cflag = termios->c_cflag;
|
||||
channel->ch_c_iflag = termios->c_iflag;
|
||||
channel->ch_c_oflag = termios->c_oflag;
|
||||
|
@ -278,7 +278,7 @@ static void jsm_tty_close(struct uart_port *port)
|
|||
jsm_printk(CLOSE, INFO, &channel->ch_bd->pci_dev, "start\n");
|
||||
|
||||
bd = channel->ch_bd;
|
||||
ts = port->info->port.tty->termios;
|
||||
ts = port->state->port.tty->termios;
|
||||
|
||||
channel->ch_flags &= ~(CH_STOPI);
|
||||
|
||||
|
@ -530,7 +530,7 @@ void jsm_input(struct jsm_channel *ch)
|
|||
if (!ch)
|
||||
return;
|
||||
|
||||
tp = ch->uart_port.info->port.tty;
|
||||
tp = ch->uart_port.state->port.tty;
|
||||
|
||||
bd = ch->ch_bd;
|
||||
if(!bd)
|
||||
|
@ -849,7 +849,7 @@ int jsm_tty_write(struct uart_port *port)
|
|||
u16 tail;
|
||||
u16 tmask;
|
||||
u32 remain;
|
||||
int temp_tail = port->info->xmit.tail;
|
||||
int temp_tail = port->state->xmit.tail;
|
||||
struct jsm_channel *channel = (struct jsm_channel *)port;
|
||||
|
||||
tmask = WQUEUEMASK;
|
||||
|
@ -865,10 +865,10 @@ int jsm_tty_write(struct uart_port *port)
|
|||
data_count = 0;
|
||||
if (bufcount >= remain) {
|
||||
bufcount -= remain;
|
||||
while ((port->info->xmit.head != temp_tail) &&
|
||||
while ((port->state->xmit.head != temp_tail) &&
|
||||
(data_count < remain)) {
|
||||
channel->ch_wqueue[head++] =
|
||||
port->info->xmit.buf[temp_tail];
|
||||
port->state->xmit.buf[temp_tail];
|
||||
|
||||
temp_tail++;
|
||||
temp_tail &= (UART_XMIT_SIZE - 1);
|
||||
|
@ -880,10 +880,10 @@ int jsm_tty_write(struct uart_port *port)
|
|||
data_count1 = 0;
|
||||
if (bufcount > 0) {
|
||||
remain = bufcount;
|
||||
while ((port->info->xmit.head != temp_tail) &&
|
||||
while ((port->state->xmit.head != temp_tail) &&
|
||||
(data_count1 < remain)) {
|
||||
channel->ch_wqueue[head++] =
|
||||
port->info->xmit.buf[temp_tail];
|
||||
port->state->xmit.buf[temp_tail];
|
||||
|
||||
temp_tail++;
|
||||
temp_tail &= (UART_XMIT_SIZE - 1);
|
||||
|
@ -892,7 +892,7 @@ int jsm_tty_write(struct uart_port *port)
|
|||
}
|
||||
}
|
||||
|
||||
port->info->xmit.tail = temp_tail;
|
||||
port->state->xmit.tail = temp_tail;
|
||||
|
||||
data_count += data_count1;
|
||||
if (data_count) {
|
||||
|
|
|
@ -286,7 +286,7 @@ static void m32r_sio_start_tx(struct uart_port *port)
|
|||
{
|
||||
#ifdef CONFIG_SERIAL_M32R_PLDSIO
|
||||
struct uart_sio_port *up = (struct uart_sio_port *)port;
|
||||
struct circ_buf *xmit = &up->port.info->xmit;
|
||||
struct circ_buf *xmit = &up->port.state->xmit;
|
||||
|
||||
if (!(up->ier & UART_IER_THRI)) {
|
||||
up->ier |= UART_IER_THRI;
|
||||
|
@ -325,7 +325,7 @@ static void m32r_sio_enable_ms(struct uart_port *port)
|
|||
|
||||
static void receive_chars(struct uart_sio_port *up, int *status)
|
||||
{
|
||||
struct tty_struct *tty = up->port.info->port.tty;
|
||||
struct tty_struct *tty = up->port.state->port.tty;
|
||||
unsigned char ch;
|
||||
unsigned char flag;
|
||||
int max_count = 256;
|
||||
|
@ -398,7 +398,7 @@ static void receive_chars(struct uart_sio_port *up, int *status)
|
|||
|
||||
static void transmit_chars(struct uart_sio_port *up)
|
||||
{
|
||||
struct circ_buf *xmit = &up->port.info->xmit;
|
||||
struct circ_buf *xmit = &up->port.state->xmit;
|
||||
int count;
|
||||
|
||||
if (up->port.x_char) {
|
||||
|
|
|
@ -184,7 +184,7 @@ static void max3100_timeout(unsigned long data)
|
|||
{
|
||||
struct max3100_port *s = (struct max3100_port *)data;
|
||||
|
||||
if (s->port.info) {
|
||||
if (s->port.state) {
|
||||
max3100_dowork(s);
|
||||
mod_timer(&s->timer, jiffies + s->poll_time);
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ static void max3100_work(struct work_struct *w)
|
|||
int rxchars;
|
||||
u16 tx, rx;
|
||||
int conf, cconf, rts, crts;
|
||||
struct circ_buf *xmit = &s->port.info->xmit;
|
||||
struct circ_buf *xmit = &s->port.state->xmit;
|
||||
|
||||
dev_dbg(&s->spi->dev, "%s\n", __func__);
|
||||
|
||||
|
@ -307,8 +307,8 @@ static void max3100_work(struct work_struct *w)
|
|||
}
|
||||
}
|
||||
|
||||
if (rxchars > 16 && s->port.info->port.tty != NULL) {
|
||||
tty_flip_buffer_push(s->port.info->port.tty);
|
||||
if (rxchars > 16 && s->port.state->port.tty != NULL) {
|
||||
tty_flip_buffer_push(s->port.state->port.tty);
|
||||
rxchars = 0;
|
||||
}
|
||||
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
|
||||
|
@ -320,8 +320,8 @@ static void max3100_work(struct work_struct *w)
|
|||
(!uart_circ_empty(xmit) &&
|
||||
!uart_tx_stopped(&s->port))));
|
||||
|
||||
if (rxchars > 0 && s->port.info->port.tty != NULL)
|
||||
tty_flip_buffer_push(s->port.info->port.tty);
|
||||
if (rxchars > 0 && s->port.state->port.tty != NULL)
|
||||
tty_flip_buffer_push(s->port.state->port.tty);
|
||||
}
|
||||
|
||||
static irqreturn_t max3100_irq(int irqno, void *dev_id)
|
||||
|
@ -429,7 +429,7 @@ max3100_set_termios(struct uart_port *port, struct ktermios *termios,
|
|||
int baud = 0;
|
||||
unsigned cflag;
|
||||
u32 param_new, param_mask, parity = 0;
|
||||
struct tty_struct *tty = s->port.info->port.tty;
|
||||
struct tty_struct *tty = s->port.state->port.tty;
|
||||
|
||||
dev_dbg(&s->spi->dev, "%s\n", __func__);
|
||||
if (!tty)
|
||||
|
@ -529,7 +529,7 @@ max3100_set_termios(struct uart_port *port, struct ktermios *termios,
|
|||
MAX3100_STATUS_OE;
|
||||
|
||||
/* we are sending char from a workqueue so enable */
|
||||
s->port.info->port.tty->low_latency = 1;
|
||||
s->port.state->port.tty->low_latency = 1;
|
||||
|
||||
if (s->poll_time > 0)
|
||||
del_timer_sync(&s->timer);
|
||||
|
|
|
@ -323,7 +323,7 @@ static void mcf_rx_chars(struct mcf_uart *pp)
|
|||
uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag);
|
||||
}
|
||||
|
||||
tty_flip_buffer_push(port->info->port.tty);
|
||||
tty_flip_buffer_push(port->state->port.tty);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
@ -331,7 +331,7 @@ static void mcf_rx_chars(struct mcf_uart *pp)
|
|||
static void mcf_tx_chars(struct mcf_uart *pp)
|
||||
{
|
||||
struct uart_port *port = &pp->port;
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
if (port->x_char) {
|
||||
/* Send special char - probably flow control */
|
||||
|
|
|
@ -745,7 +745,7 @@ static struct uart_ops mpc52xx_uart_ops = {
|
|||
static inline int
|
||||
mpc52xx_uart_int_rx_chars(struct uart_port *port)
|
||||
{
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
unsigned char ch, flag;
|
||||
unsigned short status;
|
||||
|
||||
|
@ -812,7 +812,7 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
|
|||
static inline int
|
||||
mpc52xx_uart_int_tx_chars(struct uart_port *port)
|
||||
{
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
/* Process out of band chars */
|
||||
if (port->x_char) {
|
||||
|
|
|
@ -936,7 +936,7 @@ static int serial_polled;
|
|||
static int mpsc_rx_intr(struct mpsc_port_info *pi)
|
||||
{
|
||||
struct mpsc_rx_desc *rxre;
|
||||
struct tty_struct *tty = pi->port.info->port.tty;
|
||||
struct tty_struct *tty = pi->port.state->port.tty;
|
||||
u32 cmdstat, bytes_in, i;
|
||||
int rc = 0;
|
||||
u8 *bp;
|
||||
|
@ -1109,7 +1109,7 @@ static void mpsc_setup_tx_desc(struct mpsc_port_info *pi, u32 count, u32 intr)
|
|||
|
||||
static void mpsc_copy_tx_data(struct mpsc_port_info *pi)
|
||||
{
|
||||
struct circ_buf *xmit = &pi->port.info->xmit;
|
||||
struct circ_buf *xmit = &pi->port.state->xmit;
|
||||
u8 *bp;
|
||||
u32 i;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ static void msm_enable_ms(struct uart_port *port)
|
|||
|
||||
static void handle_rx(struct uart_port *port)
|
||||
{
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
unsigned int sr;
|
||||
|
||||
/*
|
||||
|
@ -136,7 +136,7 @@ static void handle_rx(struct uart_port *port)
|
|||
|
||||
static void handle_tx(struct uart_port *port)
|
||||
{
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
struct msm_port *msm_port = UART_TO_MSM(port);
|
||||
int sent_tx;
|
||||
|
||||
|
@ -169,7 +169,7 @@ static void handle_delta_cts(struct uart_port *port)
|
|||
{
|
||||
msm_write(port, UART_CR_CMD_RESET_CTS, UART_CR);
|
||||
port->icount.cts++;
|
||||
wake_up_interruptible(&port->info->delta_msr_wait);
|
||||
wake_up_interruptible(&port->state->delta_msr_wait);
|
||||
}
|
||||
|
||||
static irqreturn_t msm_irq(int irq, void *dev_id)
|
||||
|
|
|
@ -199,7 +199,7 @@ static void mux_break_ctl(struct uart_port *port, int break_state)
|
|||
static void mux_write(struct uart_port *port)
|
||||
{
|
||||
int count;
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
if(port->x_char) {
|
||||
UART_PUT_CHAR(port, port->x_char);
|
||||
|
@ -243,7 +243,7 @@ static void mux_write(struct uart_port *port)
|
|||
static void mux_read(struct uart_port *port)
|
||||
{
|
||||
int data;
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
__u32 start_count = port->icount.rx;
|
||||
|
||||
while(1) {
|
||||
|
|
|
@ -140,7 +140,7 @@ static void netx_enable_ms(struct uart_port *port)
|
|||
|
||||
static inline void netx_transmit_buffer(struct uart_port *port)
|
||||
{
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
if (port->x_char) {
|
||||
writel(port->x_char, port->membase + UART_DR);
|
||||
|
@ -185,7 +185,7 @@ static unsigned int netx_tx_empty(struct uart_port *port)
|
|||
|
||||
static void netx_txint(struct uart_port *port)
|
||||
{
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
|
||||
netx_stop_tx(port);
|
||||
|
@ -201,7 +201,7 @@ static void netx_txint(struct uart_port *port)
|
|||
static void netx_rxint(struct uart_port *port)
|
||||
{
|
||||
unsigned char rx, flg, status;
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
|
||||
while (!(readl(port->membase + UART_FR) & FR_RXFE)) {
|
||||
rx = readl(port->membase + UART_DR);
|
||||
|
|
|
@ -126,7 +126,7 @@ static void nwpserial_config_port(struct uart_port *port, int flags)
|
|||
static irqreturn_t nwpserial_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
struct nwpserial_port *up = dev_id;
|
||||
struct tty_struct *tty = up->port.info->port.tty;
|
||||
struct tty_struct *tty = up->port.state->port.tty;
|
||||
irqreturn_t ret;
|
||||
unsigned int iir;
|
||||
unsigned char ch;
|
||||
|
@ -261,7 +261,7 @@ static void nwpserial_start_tx(struct uart_port *port)
|
|||
struct nwpserial_port *up;
|
||||
struct circ_buf *xmit;
|
||||
up = container_of(port, struct nwpserial_port, port);
|
||||
xmit = &up->port.info->xmit;
|
||||
xmit = &up->port.state->xmit;
|
||||
|
||||
if (port->x_char) {
|
||||
nwpserial_putchar(up, up->port.x_char);
|
||||
|
|
|
@ -242,12 +242,12 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap)
|
|||
}
|
||||
|
||||
/* Sanity check, make sure the old bug is no longer happening */
|
||||
if (uap->port.info == NULL || uap->port.info->port.tty == NULL) {
|
||||
if (uap->port.state == NULL || uap->port.state->port.tty == NULL) {
|
||||
WARN_ON(1);
|
||||
(void)read_zsdata(uap);
|
||||
return NULL;
|
||||
}
|
||||
tty = uap->port.info->port.tty;
|
||||
tty = uap->port.state->port.tty;
|
||||
|
||||
while (1) {
|
||||
error = 0;
|
||||
|
@ -369,7 +369,7 @@ static void pmz_status_handle(struct uart_pmac_port *uap)
|
|||
uart_handle_cts_change(&uap->port,
|
||||
!(status & CTS));
|
||||
|
||||
wake_up_interruptible(&uap->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&uap->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
if (status & BRK_ABRT)
|
||||
|
@ -420,9 +420,9 @@ static void pmz_transmit_chars(struct uart_pmac_port *uap)
|
|||
return;
|
||||
}
|
||||
|
||||
if (uap->port.info == NULL)
|
||||
if (uap->port.state == NULL)
|
||||
goto ack_tx_int;
|
||||
xmit = &uap->port.info->xmit;
|
||||
xmit = &uap->port.state->xmit;
|
||||
if (uart_circ_empty(xmit)) {
|
||||
uart_write_wakeup(&uap->port);
|
||||
goto ack_tx_int;
|
||||
|
@ -655,7 +655,7 @@ static void pmz_start_tx(struct uart_port *port)
|
|||
port->icount.tx++;
|
||||
port->x_char = 0;
|
||||
} else {
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
write_zsdata(uap, xmit->buf[xmit->tail]);
|
||||
zssync(uap);
|
||||
|
|
|
@ -100,7 +100,7 @@ static void pnx8xxx_mctrl_check(struct pnx8xxx_port *sport)
|
|||
if (changed & TIOCM_CTS)
|
||||
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
|
||||
|
||||
wake_up_interruptible(&sport->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&sport->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -112,7 +112,7 @@ static void pnx8xxx_timeout(unsigned long data)
|
|||
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)data;
|
||||
unsigned long flags;
|
||||
|
||||
if (sport->port.info) {
|
||||
if (sport->port.state) {
|
||||
spin_lock_irqsave(&sport->port.lock, flags);
|
||||
pnx8xxx_mctrl_check(sport);
|
||||
spin_unlock_irqrestore(&sport->port.lock, flags);
|
||||
|
@ -181,7 +181,7 @@ static void pnx8xxx_enable_ms(struct uart_port *port)
|
|||
|
||||
static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
|
||||
{
|
||||
struct tty_struct *tty = sport->port.info->port.tty;
|
||||
struct tty_struct *tty = sport->port.state->port.tty;
|
||||
unsigned int status, ch, flg;
|
||||
|
||||
status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
|
||||
|
@ -243,7 +243,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
|
|||
|
||||
static void pnx8xxx_tx_chars(struct pnx8xxx_port *sport)
|
||||
{
|
||||
struct circ_buf *xmit = &sport->port.info->xmit;
|
||||
struct circ_buf *xmit = &sport->port.state->xmit;
|
||||
|
||||
if (sport->port.x_char) {
|
||||
serial_out(sport, PNX8XXX_FIFO, sport->port.x_char);
|
||||
|
|
|
@ -96,7 +96,7 @@ static void serial_pxa_stop_rx(struct uart_port *port)
|
|||
|
||||
static inline void receive_chars(struct uart_pxa_port *up, int *status)
|
||||
{
|
||||
struct tty_struct *tty = up->port.info->port.tty;
|
||||
struct tty_struct *tty = up->port.state->port.tty;
|
||||
unsigned int ch, flag;
|
||||
int max_count = 256;
|
||||
|
||||
|
@ -161,7 +161,7 @@ static inline void receive_chars(struct uart_pxa_port *up, int *status)
|
|||
|
||||
static void transmit_chars(struct uart_pxa_port *up)
|
||||
{
|
||||
struct circ_buf *xmit = &up->port.info->xmit;
|
||||
struct circ_buf *xmit = &up->port.state->xmit;
|
||||
int count;
|
||||
|
||||
if (up->port.x_char) {
|
||||
|
@ -220,7 +220,7 @@ static inline void check_modem_status(struct uart_pxa_port *up)
|
|||
if (status & UART_MSR_DCTS)
|
||||
uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
|
||||
|
||||
wake_up_interruptible(&up->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&up->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -117,7 +117,7 @@ static void sa1100_mctrl_check(struct sa1100_port *sport)
|
|||
if (changed & TIOCM_CTS)
|
||||
uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
|
||||
|
||||
wake_up_interruptible(&sport->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&sport->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -129,7 +129,7 @@ static void sa1100_timeout(unsigned long data)
|
|||
struct sa1100_port *sport = (struct sa1100_port *)data;
|
||||
unsigned long flags;
|
||||
|
||||
if (sport->port.info) {
|
||||
if (sport->port.state) {
|
||||
spin_lock_irqsave(&sport->port.lock, flags);
|
||||
sa1100_mctrl_check(sport);
|
||||
spin_unlock_irqrestore(&sport->port.lock, flags);
|
||||
|
@ -189,7 +189,7 @@ static void sa1100_enable_ms(struct uart_port *port)
|
|||
static void
|
||||
sa1100_rx_chars(struct sa1100_port *sport)
|
||||
{
|
||||
struct tty_struct *tty = sport->port.info->port.tty;
|
||||
struct tty_struct *tty = sport->port.state->port.tty;
|
||||
unsigned int status, ch, flg;
|
||||
|
||||
status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
|
||||
|
@ -239,7 +239,7 @@ sa1100_rx_chars(struct sa1100_port *sport)
|
|||
|
||||
static void sa1100_tx_chars(struct sa1100_port *sport)
|
||||
{
|
||||
struct circ_buf *xmit = &sport->port.info->xmit;
|
||||
struct circ_buf *xmit = &sport->port.state->xmit;
|
||||
|
||||
if (sport->port.x_char) {
|
||||
UART_PUT_CHAR(sport, sport->port.x_char);
|
||||
|
|
|
@ -196,7 +196,7 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id)
|
|||
{
|
||||
struct s3c24xx_uart_port *ourport = dev_id;
|
||||
struct uart_port *port = &ourport->port;
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
unsigned int ufcon, ch, flag, ufstat, uerstat;
|
||||
int max_count = 64;
|
||||
|
||||
|
@ -281,7 +281,7 @@ static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
|
|||
{
|
||||
struct s3c24xx_uart_port *ourport = id;
|
||||
struct uart_port *port = &ourport->port;
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
int count = 256;
|
||||
|
||||
if (port->x_char) {
|
||||
|
@ -992,10 +992,10 @@ static int s3c24xx_serial_cpufreq_transition(struct notifier_block *nb,
|
|||
struct ktermios *termios;
|
||||
struct tty_struct *tty;
|
||||
|
||||
if (uport->info == NULL)
|
||||
if (uport->state == NULL)
|
||||
goto exit;
|
||||
|
||||
tty = uport->info->port.tty;
|
||||
tty = uport->state->port.tty;
|
||||
|
||||
if (tty == NULL)
|
||||
goto exit;
|
||||
|
|
|
@ -384,13 +384,13 @@ static void sbd_receive_chars(struct sbd_port *sport)
|
|||
uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag);
|
||||
}
|
||||
|
||||
tty_flip_buffer_push(uport->info->port.tty);
|
||||
tty_flip_buffer_push(uport->state->port.tty);
|
||||
}
|
||||
|
||||
static void sbd_transmit_chars(struct sbd_port *sport)
|
||||
{
|
||||
struct uart_port *uport = &sport->port;
|
||||
struct circ_buf *xmit = &sport->port.info->xmit;
|
||||
struct circ_buf *xmit = &sport->port.state->xmit;
|
||||
unsigned int mask;
|
||||
int stop_tx;
|
||||
|
||||
|
@ -440,7 +440,7 @@ static void sbd_status_handle(struct sbd_port *sport)
|
|||
|
||||
if (delta & ((M_DUART_IN_PIN2_VAL | M_DUART_IN_PIN0_VAL) <<
|
||||
S_DUART_IN_PIN_CHNG))
|
||||
wake_up_interruptible(&uport->info->delta_msr_wait);
|
||||
wake_up_interruptible(&uport->state->delta_msr_wait);
|
||||
}
|
||||
|
||||
static irqreturn_t sbd_interrupt(int irq, void *dev_id)
|
||||
|
|
|
@ -140,8 +140,8 @@ static struct tty_struct *receive_chars(struct uart_port *port)
|
|||
char flag;
|
||||
u8 status;
|
||||
|
||||
if (port->info != NULL) /* Unopened serial console */
|
||||
tty = port->info->port.tty;
|
||||
if (port->state != NULL) /* Unopened serial console */
|
||||
tty = port->state->port.tty;
|
||||
|
||||
while (limit-- > 0) {
|
||||
status = READ_SC_PORT(port, SR);
|
||||
|
@ -190,10 +190,10 @@ static void transmit_chars(struct uart_port *port)
|
|||
{
|
||||
struct circ_buf *xmit;
|
||||
|
||||
if (!port->info)
|
||||
if (!port->state)
|
||||
return;
|
||||
|
||||
xmit = &port->info->xmit;
|
||||
xmit = &port->state->xmit;
|
||||
if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
|
||||
sc26xx_disable_irq(port, IMR_TXRDY);
|
||||
return;
|
||||
|
@ -316,7 +316,7 @@ static void sc26xx_stop_tx(struct uart_port *port)
|
|||
/* port->lock held by caller. */
|
||||
static void sc26xx_start_tx(struct uart_port *port)
|
||||
{
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
while (!uart_circ_empty(xmit)) {
|
||||
if (!(READ_SC_PORT(port, SR) & SR_TXRDY)) {
|
||||
|
|
|
@ -52,7 +52,7 @@ static struct lock_class_key port_lock_key;
|
|||
|
||||
#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8)
|
||||
|
||||
#define uart_users(state) ((state)->count + (state)->info.port.blocked_open)
|
||||
#define uart_users(state) ((state)->count + (state)->port.blocked_open)
|
||||
|
||||
#ifdef CONFIG_SERIAL_CORE_CONSOLE
|
||||
#define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line)
|
||||
|
@ -71,19 +71,19 @@ static void uart_change_pm(struct uart_state *state, int pm_state);
|
|||
*/
|
||||
void uart_write_wakeup(struct uart_port *port)
|
||||
{
|
||||
struct uart_info *info = port->info;
|
||||
struct uart_state *state = port->state;
|
||||
/*
|
||||
* This means you called this function _after_ the port was
|
||||
* closed. No cookie for you.
|
||||
*/
|
||||
BUG_ON(!info);
|
||||
tasklet_schedule(&info->tlet);
|
||||
BUG_ON(!state);
|
||||
tasklet_schedule(&state->tlet);
|
||||
}
|
||||
|
||||
static void uart_stop(struct tty_struct *tty)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&port->lock, flags);
|
||||
|
@ -94,9 +94,9 @@ static void uart_stop(struct tty_struct *tty)
|
|||
static void __uart_start(struct tty_struct *tty)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
|
||||
if (!uart_circ_empty(&state->info.xmit) && state->info.xmit.buf &&
|
||||
if (!uart_circ_empty(&state->xmit) && state->xmit.buf &&
|
||||
!tty->stopped && !tty->hw_stopped)
|
||||
port->ops->start_tx(port);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ static void __uart_start(struct tty_struct *tty)
|
|||
static void uart_start(struct tty_struct *tty)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&port->lock, flags);
|
||||
|
@ -115,7 +115,7 @@ static void uart_start(struct tty_struct *tty)
|
|||
static void uart_tasklet_action(unsigned long data)
|
||||
{
|
||||
struct uart_state *state = (struct uart_state *)data;
|
||||
tty_wakeup(state->info.port.tty);
|
||||
tty_wakeup(state->port.tty);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -141,12 +141,11 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)
|
|||
*/
|
||||
static int uart_startup(struct uart_state *state, int init_hw)
|
||||
{
|
||||
struct uart_info *info = &state->info;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
unsigned long page;
|
||||
int retval = 0;
|
||||
|
||||
if (info->flags & UIF_INITIALIZED)
|
||||
if (state->flags & UIF_INITIALIZED)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
|
@ -154,7 +153,7 @@ static int uart_startup(struct uart_state *state, int init_hw)
|
|||
* once we have successfully opened the port. Also set
|
||||
* up the tty->alt_speed kludge
|
||||
*/
|
||||
set_bit(TTY_IO_ERROR, &info->port.tty->flags);
|
||||
set_bit(TTY_IO_ERROR, &state->port.tty->flags);
|
||||
|
||||
if (port->type == PORT_UNKNOWN)
|
||||
return 0;
|
||||
|
@ -163,14 +162,14 @@ static int uart_startup(struct uart_state *state, int init_hw)
|
|||
* Initialise and allocate the transmit and temporary
|
||||
* buffer.
|
||||
*/
|
||||
if (!info->xmit.buf) {
|
||||
if (!state->xmit.buf) {
|
||||
/* This is protected by the per port mutex */
|
||||
page = get_zeroed_page(GFP_KERNEL);
|
||||
if (!page)
|
||||
return -ENOMEM;
|
||||
|
||||
info->xmit.buf = (unsigned char *) page;
|
||||
uart_circ_clear(&info->xmit);
|
||||
state->xmit.buf = (unsigned char *) page;
|
||||
uart_circ_clear(&state->xmit);
|
||||
}
|
||||
|
||||
retval = port->ops->startup(port);
|
||||
|
@ -185,20 +184,20 @@ static int uart_startup(struct uart_state *state, int init_hw)
|
|||
* Setup the RTS and DTR signals once the
|
||||
* port is open and ready to respond.
|
||||
*/
|
||||
if (info->port.tty->termios->c_cflag & CBAUD)
|
||||
if (state->port.tty->termios->c_cflag & CBAUD)
|
||||
uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR);
|
||||
}
|
||||
|
||||
if (info->flags & UIF_CTS_FLOW) {
|
||||
if (state->flags & UIF_CTS_FLOW) {
|
||||
spin_lock_irq(&port->lock);
|
||||
if (!(port->ops->get_mctrl(port) & TIOCM_CTS))
|
||||
info->port.tty->hw_stopped = 1;
|
||||
state->port.tty->hw_stopped = 1;
|
||||
spin_unlock_irq(&port->lock);
|
||||
}
|
||||
|
||||
info->flags |= UIF_INITIALIZED;
|
||||
state->flags |= UIF_INITIALIZED;
|
||||
|
||||
clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
|
||||
clear_bit(TTY_IO_ERROR, &state->port.tty->flags);
|
||||
}
|
||||
|
||||
if (retval && capable(CAP_SYS_ADMIN))
|
||||
|
@ -214,9 +213,8 @@ static int uart_startup(struct uart_state *state, int init_hw)
|
|||
*/
|
||||
static void uart_shutdown(struct uart_state *state)
|
||||
{
|
||||
struct uart_info *info = &state->info;
|
||||
struct uart_port *port = state->port;
|
||||
struct tty_struct *tty = info->port.tty;
|
||||
struct uart_port *port = state->uart_port;
|
||||
struct tty_struct *tty = state->port.tty;
|
||||
|
||||
/*
|
||||
* Set the TTY IO error marker
|
||||
|
@ -224,8 +222,8 @@ static void uart_shutdown(struct uart_state *state)
|
|||
if (tty)
|
||||
set_bit(TTY_IO_ERROR, &tty->flags);
|
||||
|
||||
if (info->flags & UIF_INITIALIZED) {
|
||||
info->flags &= ~UIF_INITIALIZED;
|
||||
if (state->flags & UIF_INITIALIZED) {
|
||||
state->flags &= ~UIF_INITIALIZED;
|
||||
|
||||
/*
|
||||
* Turn off DTR and RTS early.
|
||||
|
@ -240,7 +238,7 @@ static void uart_shutdown(struct uart_state *state)
|
|||
* any outstanding file descriptors should be pointing at
|
||||
* hung_up_tty_fops now.
|
||||
*/
|
||||
wake_up_interruptible(&info->delta_msr_wait);
|
||||
wake_up_interruptible(&state->delta_msr_wait);
|
||||
|
||||
/*
|
||||
* Free the IRQ and disable the port.
|
||||
|
@ -256,14 +254,14 @@ static void uart_shutdown(struct uart_state *state)
|
|||
/*
|
||||
* kill off our tasklet
|
||||
*/
|
||||
tasklet_kill(&info->tlet);
|
||||
tasklet_kill(&state->tlet);
|
||||
|
||||
/*
|
||||
* Free the transmit buffer page.
|
||||
*/
|
||||
if (info->xmit.buf) {
|
||||
free_page((unsigned long)info->xmit.buf);
|
||||
info->xmit.buf = NULL;
|
||||
if (state->xmit.buf) {
|
||||
free_page((unsigned long)state->xmit.buf);
|
||||
state->xmit.buf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -430,8 +428,8 @@ EXPORT_SYMBOL(uart_get_divisor);
|
|||
static void
|
||||
uart_change_speed(struct uart_state *state, struct ktermios *old_termios)
|
||||
{
|
||||
struct tty_struct *tty = state->info.port.tty;
|
||||
struct uart_port *port = state->port;
|
||||
struct tty_struct *tty = state->port.tty;
|
||||
struct uart_port *port = state->uart_port;
|
||||
struct ktermios *termios;
|
||||
|
||||
/*
|
||||
|
@ -447,14 +445,14 @@ uart_change_speed(struct uart_state *state, struct ktermios *old_termios)
|
|||
* Set flags based on termios cflag
|
||||
*/
|
||||
if (termios->c_cflag & CRTSCTS)
|
||||
state->info.flags |= UIF_CTS_FLOW;
|
||||
state->flags |= UIF_CTS_FLOW;
|
||||
else
|
||||
state->info.flags &= ~UIF_CTS_FLOW;
|
||||
state->flags &= ~UIF_CTS_FLOW;
|
||||
|
||||
if (termios->c_cflag & CLOCAL)
|
||||
state->info.flags &= ~UIF_CHECK_CD;
|
||||
state->flags &= ~UIF_CHECK_CD;
|
||||
else
|
||||
state->info.flags |= UIF_CHECK_CD;
|
||||
state->flags |= UIF_CHECK_CD;
|
||||
|
||||
port->ops->set_termios(port, termios, old_termios);
|
||||
}
|
||||
|
@ -482,7 +480,7 @@ static int uart_put_char(struct tty_struct *tty, unsigned char ch)
|
|||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
|
||||
return __uart_put_char(state->port, &state->info.xmit, ch);
|
||||
return __uart_put_char(state->uart_port, &state->xmit, ch);
|
||||
}
|
||||
|
||||
static void uart_flush_chars(struct tty_struct *tty)
|
||||
|
@ -508,8 +506,8 @@ uart_write(struct tty_struct *tty, const unsigned char *buf, int count)
|
|||
return -EL3HLT;
|
||||
}
|
||||
|
||||
port = state->port;
|
||||
circ = &state->info.xmit;
|
||||
port = state->uart_port;
|
||||
circ = &state->xmit;
|
||||
|
||||
if (!circ->buf)
|
||||
return 0;
|
||||
|
@ -539,9 +537,9 @@ static int uart_write_room(struct tty_struct *tty)
|
|||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
spin_lock_irqsave(&state->port->lock, flags);
|
||||
ret = uart_circ_chars_free(&state->info.xmit);
|
||||
spin_unlock_irqrestore(&state->port->lock, flags);
|
||||
spin_lock_irqsave(&state->uart_port->lock, flags);
|
||||
ret = uart_circ_chars_free(&state->xmit);
|
||||
spin_unlock_irqrestore(&state->uart_port->lock, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -551,9 +549,9 @@ static int uart_chars_in_buffer(struct tty_struct *tty)
|
|||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
spin_lock_irqsave(&state->port->lock, flags);
|
||||
ret = uart_circ_chars_pending(&state->info.xmit);
|
||||
spin_unlock_irqrestore(&state->port->lock, flags);
|
||||
spin_lock_irqsave(&state->uart_port->lock, flags);
|
||||
ret = uart_circ_chars_pending(&state->xmit);
|
||||
spin_unlock_irqrestore(&state->uart_port->lock, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -572,11 +570,11 @@ static void uart_flush_buffer(struct tty_struct *tty)
|
|||
return;
|
||||
}
|
||||
|
||||
port = state->port;
|
||||
port = state->uart_port;
|
||||
pr_debug("uart_flush_buffer(%d) called\n", tty->index);
|
||||
|
||||
spin_lock_irqsave(&port->lock, flags);
|
||||
uart_circ_clear(&state->info.xmit);
|
||||
uart_circ_clear(&state->xmit);
|
||||
if (port->ops->flush_buffer)
|
||||
port->ops->flush_buffer(port);
|
||||
spin_unlock_irqrestore(&port->lock, flags);
|
||||
|
@ -590,7 +588,7 @@ static void uart_flush_buffer(struct tty_struct *tty)
|
|||
static void uart_send_xchar(struct tty_struct *tty, char ch)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
unsigned long flags;
|
||||
|
||||
if (port->ops->send_xchar)
|
||||
|
@ -613,13 +611,13 @@ static void uart_throttle(struct tty_struct *tty)
|
|||
uart_send_xchar(tty, STOP_CHAR(tty));
|
||||
|
||||
if (tty->termios->c_cflag & CRTSCTS)
|
||||
uart_clear_mctrl(state->port, TIOCM_RTS);
|
||||
uart_clear_mctrl(state->uart_port, TIOCM_RTS);
|
||||
}
|
||||
|
||||
static void uart_unthrottle(struct tty_struct *tty)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
|
||||
if (I_IXOFF(tty)) {
|
||||
if (port->x_char)
|
||||
|
@ -635,7 +633,7 @@ static void uart_unthrottle(struct tty_struct *tty)
|
|||
static int uart_get_info(struct uart_state *state,
|
||||
struct serial_struct __user *retinfo)
|
||||
{
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
struct serial_struct tmp;
|
||||
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
|
@ -674,7 +672,7 @@ static int uart_set_info(struct uart_state *state,
|
|||
struct serial_struct __user *newinfo)
|
||||
{
|
||||
struct serial_struct new_serial;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
unsigned long new_port;
|
||||
unsigned int change_irq, change_port, closing_wait;
|
||||
unsigned int old_custom_divisor, close_delay;
|
||||
|
@ -840,15 +838,15 @@ static int uart_set_info(struct uart_state *state,
|
|||
state->closing_wait = closing_wait;
|
||||
if (new_serial.xmit_fifo_size)
|
||||
port->fifosize = new_serial.xmit_fifo_size;
|
||||
if (state->info.port.tty)
|
||||
state->info.port.tty->low_latency =
|
||||
if (state->port.tty)
|
||||
state->port.tty->low_latency =
|
||||
(port->flags & UPF_LOW_LATENCY) ? 1 : 0;
|
||||
|
||||
check_and_exit:
|
||||
retval = 0;
|
||||
if (port->type == PORT_UNKNOWN)
|
||||
goto exit;
|
||||
if (state->info.flags & UIF_INITIALIZED) {
|
||||
if (state->flags & UIF_INITIALIZED) {
|
||||
if (((old_flags ^ port->flags) & UPF_SPD_MASK) ||
|
||||
old_custom_divisor != port->custom_divisor) {
|
||||
/*
|
||||
|
@ -861,7 +859,7 @@ static int uart_set_info(struct uart_state *state,
|
|||
printk(KERN_NOTICE
|
||||
"%s sets custom speed on %s. This "
|
||||
"is deprecated.\n", current->comm,
|
||||
tty_name(state->info.port.tty, buf));
|
||||
tty_name(state->port.tty, buf));
|
||||
}
|
||||
uart_change_speed(state, NULL);
|
||||
}
|
||||
|
@ -880,7 +878,7 @@ static int uart_set_info(struct uart_state *state,
|
|||
static int uart_get_lsr_info(struct uart_state *state,
|
||||
unsigned int __user *value)
|
||||
{
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
unsigned int result;
|
||||
|
||||
result = port->ops->tx_empty(port);
|
||||
|
@ -892,8 +890,8 @@ static int uart_get_lsr_info(struct uart_state *state,
|
|||
* interrupt happens).
|
||||
*/
|
||||
if (port->x_char ||
|
||||
((uart_circ_chars_pending(&state->info.xmit) > 0) &&
|
||||
!state->info.port.tty->stopped && !state->info.port.tty->hw_stopped))
|
||||
((uart_circ_chars_pending(&state->xmit) > 0) &&
|
||||
!state->port.tty->stopped && !state->port.tty->hw_stopped))
|
||||
result &= ~TIOCSER_TEMT;
|
||||
|
||||
return put_user(result, value);
|
||||
|
@ -902,7 +900,7 @@ static int uart_get_lsr_info(struct uart_state *state,
|
|||
static int uart_tiocmget(struct tty_struct *tty, struct file *file)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
int result = -EIO;
|
||||
|
||||
mutex_lock(&state->mutex);
|
||||
|
@ -924,7 +922,7 @@ uart_tiocmset(struct tty_struct *tty, struct file *file,
|
|||
unsigned int set, unsigned int clear)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
int ret = -EIO;
|
||||
|
||||
mutex_lock(&state->mutex);
|
||||
|
@ -940,7 +938,7 @@ uart_tiocmset(struct tty_struct *tty, struct file *file,
|
|||
static int uart_break_ctl(struct tty_struct *tty, int break_state)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
|
||||
mutex_lock(&state->mutex);
|
||||
|
||||
|
@ -953,7 +951,7 @@ static int uart_break_ctl(struct tty_struct *tty, int break_state)
|
|||
|
||||
static int uart_do_autoconfig(struct uart_state *state)
|
||||
{
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
int flags, ret;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
|
@ -1003,7 +1001,7 @@ static int uart_do_autoconfig(struct uart_state *state)
|
|||
static int
|
||||
uart_wait_modem_status(struct uart_state *state, unsigned long arg)
|
||||
{
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
struct uart_icount cprev, cnow;
|
||||
int ret;
|
||||
|
@ -1020,7 +1018,7 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg)
|
|||
port->ops->enable_ms(port);
|
||||
spin_unlock_irq(&port->lock);
|
||||
|
||||
add_wait_queue(&state->info.delta_msr_wait, &wait);
|
||||
add_wait_queue(&state->delta_msr_wait, &wait);
|
||||
for (;;) {
|
||||
spin_lock_irq(&port->lock);
|
||||
memcpy(&cnow, &port->icount, sizeof(struct uart_icount));
|
||||
|
@ -1048,7 +1046,7 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg)
|
|||
}
|
||||
|
||||
current->state = TASK_RUNNING;
|
||||
remove_wait_queue(&state->info.delta_msr_wait, &wait);
|
||||
remove_wait_queue(&state->delta_msr_wait, &wait);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1064,7 +1062,7 @@ static int uart_get_count(struct uart_state *state,
|
|||
{
|
||||
struct serial_icounter_struct icount;
|
||||
struct uart_icount cnow;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
|
||||
spin_lock_irq(&port->lock);
|
||||
memcpy(&cnow, &port->icount, sizeof(struct uart_icount));
|
||||
|
@ -1160,7 +1158,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
|
|||
break;
|
||||
|
||||
default: {
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
if (port->ops->ioctl)
|
||||
ret = port->ops->ioctl(port, cmd, arg);
|
||||
break;
|
||||
|
@ -1175,7 +1173,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
|
|||
static void uart_set_ldisc(struct tty_struct *tty)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
|
||||
if (port->ops->set_ldisc)
|
||||
port->ops->set_ldisc(port);
|
||||
|
@ -1207,7 +1205,7 @@ static void uart_set_termios(struct tty_struct *tty,
|
|||
|
||||
/* Handle transition to B0 status */
|
||||
if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD))
|
||||
uart_clear_mctrl(state->port, TIOCM_RTS | TIOCM_DTR);
|
||||
uart_clear_mctrl(state->uart_port, TIOCM_RTS | TIOCM_DTR);
|
||||
|
||||
/* Handle transition away from B0 status */
|
||||
if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
|
||||
|
@ -1215,25 +1213,25 @@ static void uart_set_termios(struct tty_struct *tty,
|
|||
if (!(cflag & CRTSCTS) ||
|
||||
!test_bit(TTY_THROTTLED, &tty->flags))
|
||||
mask |= TIOCM_RTS;
|
||||
uart_set_mctrl(state->port, mask);
|
||||
uart_set_mctrl(state->uart_port, mask);
|
||||
}
|
||||
|
||||
/* Handle turning off CRTSCTS */
|
||||
if ((old_termios->c_cflag & CRTSCTS) && !(cflag & CRTSCTS)) {
|
||||
spin_lock_irqsave(&state->port->lock, flags);
|
||||
spin_lock_irqsave(&state->uart_port->lock, flags);
|
||||
tty->hw_stopped = 0;
|
||||
__uart_start(tty);
|
||||
spin_unlock_irqrestore(&state->port->lock, flags);
|
||||
spin_unlock_irqrestore(&state->uart_port->lock, flags);
|
||||
}
|
||||
|
||||
/* Handle turning on CRTSCTS */
|
||||
if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) {
|
||||
spin_lock_irqsave(&state->port->lock, flags);
|
||||
if (!(state->port->ops->get_mctrl(state->port) & TIOCM_CTS)) {
|
||||
spin_lock_irqsave(&state->uart_port->lock, flags);
|
||||
if (!(state->uart_port->ops->get_mctrl(state->uart_port) & TIOCM_CTS)) {
|
||||
tty->hw_stopped = 1;
|
||||
state->port->ops->stop_tx(state->port);
|
||||
state->uart_port->ops->stop_tx(state->uart_port);
|
||||
}
|
||||
spin_unlock_irqrestore(&state->port->lock, flags);
|
||||
spin_unlock_irqrestore(&state->uart_port->lock, flags);
|
||||
}
|
||||
#if 0
|
||||
/*
|
||||
|
@ -1244,7 +1242,7 @@ static void uart_set_termios(struct tty_struct *tty,
|
|||
*/
|
||||
if (!(old_termios->c_cflag & CLOCAL) &&
|
||||
(tty->termios->c_cflag & CLOCAL))
|
||||
wake_up_interruptible(&info->port.open_wait);
|
||||
wake_up_interruptible(&state->uart_port.open_wait);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1260,10 +1258,10 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
|
|||
|
||||
BUG_ON(!kernel_locked());
|
||||
|
||||
if (!state || !state->port)
|
||||
if (!state || !state->uart_port)
|
||||
return;
|
||||
|
||||
port = state->port;
|
||||
port = state->uart_port;
|
||||
|
||||
pr_debug("uart_close(%d) called\n", port->line);
|
||||
|
||||
|
@ -1306,7 +1304,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
|
|||
* At this point, we stop accepting input. To do this, we
|
||||
* disable the receive line status interrupts.
|
||||
*/
|
||||
if (state->info.flags & UIF_INITIALIZED) {
|
||||
if (state->flags & UIF_INITIALIZED) {
|
||||
unsigned long flags;
|
||||
spin_lock_irqsave(&port->lock, flags);
|
||||
port->ops->stop_rx(port);
|
||||
|
@ -1325,9 +1323,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
|
|||
tty_ldisc_flush(tty);
|
||||
|
||||
tty->closing = 0;
|
||||
state->info.port.tty = NULL;
|
||||
state->port.tty = NULL;
|
||||
|
||||
if (state->info.port.blocked_open) {
|
||||
if (state->port.blocked_open) {
|
||||
if (state->close_delay)
|
||||
msleep_interruptible(state->close_delay);
|
||||
} else if (!uart_console(port)) {
|
||||
|
@ -1337,8 +1335,8 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
|
|||
/*
|
||||
* Wake up anyone trying to open this port.
|
||||
*/
|
||||
state->info.flags &= ~UIF_NORMAL_ACTIVE;
|
||||
wake_up_interruptible(&state->info.port.open_wait);
|
||||
state->flags &= ~UIF_NORMAL_ACTIVE;
|
||||
wake_up_interruptible(&state->port.open_wait);
|
||||
|
||||
done:
|
||||
mutex_unlock(&state->mutex);
|
||||
|
@ -1347,7 +1345,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
|
|||
static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
unsigned long char_time, expire;
|
||||
|
||||
if (port->type == PORT_UNKNOWN || port->fifosize == 0)
|
||||
|
@ -1412,20 +1410,19 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
|
|||
static void uart_hangup(struct tty_struct *tty)
|
||||
{
|
||||
struct uart_state *state = tty->driver_data;
|
||||
struct uart_info *info = &state->info;
|
||||
|
||||
BUG_ON(!kernel_locked());
|
||||
pr_debug("uart_hangup(%d)\n", state->port->line);
|
||||
pr_debug("uart_hangup(%d)\n", state->uart_port->line);
|
||||
|
||||
mutex_lock(&state->mutex);
|
||||
if (info->flags & UIF_NORMAL_ACTIVE) {
|
||||
if (state->flags & UIF_NORMAL_ACTIVE) {
|
||||
uart_flush_buffer(tty);
|
||||
uart_shutdown(state);
|
||||
state->count = 0;
|
||||
info->flags &= ~UIF_NORMAL_ACTIVE;
|
||||
info->port.tty = NULL;
|
||||
wake_up_interruptible(&info->port.open_wait);
|
||||
wake_up_interruptible(&info->delta_msr_wait);
|
||||
state->flags &= ~UIF_NORMAL_ACTIVE;
|
||||
state->port.tty = NULL;
|
||||
wake_up_interruptible(&state->port.open_wait);
|
||||
wake_up_interruptible(&state->delta_msr_wait);
|
||||
}
|
||||
mutex_unlock(&state->mutex);
|
||||
}
|
||||
|
@ -1438,8 +1435,8 @@ static void uart_hangup(struct tty_struct *tty)
|
|||
*/
|
||||
static void uart_update_termios(struct uart_state *state)
|
||||
{
|
||||
struct tty_struct *tty = state->info.port.tty;
|
||||
struct uart_port *port = state->port;
|
||||
struct tty_struct *tty = state->port.tty;
|
||||
struct uart_port *port = state->uart_port;
|
||||
|
||||
if (uart_console(port) && port->cons->cflag) {
|
||||
tty->termios->c_cflag = port->cons->cflag;
|
||||
|
@ -1473,27 +1470,26 @@ static int
|
|||
uart_block_til_ready(struct file *filp, struct uart_state *state)
|
||||
{
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
struct uart_info *info = &state->info;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
unsigned int mctrl;
|
||||
|
||||
info->port.blocked_open++;
|
||||
state->port.blocked_open++;
|
||||
state->count--;
|
||||
|
||||
add_wait_queue(&info->port.open_wait, &wait);
|
||||
add_wait_queue(&state->port.open_wait, &wait);
|
||||
while (1) {
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
|
||||
/*
|
||||
* If we have been hung up, tell userspace/restart open.
|
||||
*/
|
||||
if (tty_hung_up_p(filp) || info->port.tty == NULL)
|
||||
if (tty_hung_up_p(filp) || state->port.tty == NULL)
|
||||
break;
|
||||
|
||||
/*
|
||||
* If the port has been closed, tell userspace/restart open.
|
||||
*/
|
||||
if (!(info->flags & UIF_INITIALIZED))
|
||||
if (!(state->flags & UIF_INITIALIZED))
|
||||
break;
|
||||
|
||||
/*
|
||||
|
@ -1506,8 +1502,8 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
|
|||
* have set TTY_IO_ERROR for a non-existant port.
|
||||
*/
|
||||
if ((filp->f_flags & O_NONBLOCK) ||
|
||||
(info->port.tty->termios->c_cflag & CLOCAL) ||
|
||||
(info->port.tty->flags & (1 << TTY_IO_ERROR)))
|
||||
(state->port.tty->termios->c_cflag & CLOCAL) ||
|
||||
(state->port.tty->flags & (1 << TTY_IO_ERROR)))
|
||||
break;
|
||||
|
||||
/*
|
||||
|
@ -1515,7 +1511,7 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
|
|||
* not set RTS here - we want to make sure we catch
|
||||
* the data from the modem.
|
||||
*/
|
||||
if (info->port.tty->termios->c_cflag & CBAUD)
|
||||
if (state->port.tty->termios->c_cflag & CBAUD)
|
||||
uart_set_mctrl(port, TIOCM_DTR);
|
||||
|
||||
/*
|
||||
|
@ -1537,15 +1533,15 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
|
|||
break;
|
||||
}
|
||||
set_current_state(TASK_RUNNING);
|
||||
remove_wait_queue(&info->port.open_wait, &wait);
|
||||
remove_wait_queue(&state->port.open_wait, &wait);
|
||||
|
||||
state->count++;
|
||||
info->port.blocked_open--;
|
||||
state->port.blocked_open--;
|
||||
|
||||
if (signal_pending(current))
|
||||
return -ERESTARTSYS;
|
||||
|
||||
if (!info->port.tty || tty_hung_up_p(filp))
|
||||
if (!state->port.tty || tty_hung_up_p(filp))
|
||||
return -EAGAIN;
|
||||
|
||||
return 0;
|
||||
|
@ -1563,7 +1559,7 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
|
|||
}
|
||||
|
||||
state->count++;
|
||||
if (!state->port || state->port->flags & UPF_DEAD) {
|
||||
if (!state->uart_port || state->uart_port->flags & UPF_DEAD) {
|
||||
ret = -ENXIO;
|
||||
goto err_unlock;
|
||||
}
|
||||
|
@ -1606,10 +1602,11 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
|
|||
|
||||
/*
|
||||
* We take the semaphore inside uart_get to guarantee that we won't
|
||||
* be re-entered while allocating the info structure, or while we
|
||||
* be re-entered while allocating the state structure, or while we
|
||||
* request any IRQs that the driver may need. This also has the nice
|
||||
* side-effect that it delays the action of uart_hangup, so we can
|
||||
* guarantee that info->port.tty will always contain something reasonable.
|
||||
* guarantee that state->port.tty will always contain something
|
||||
* reasonable.
|
||||
*/
|
||||
state = uart_get(drv, line);
|
||||
if (IS_ERR(state)) {
|
||||
|
@ -1623,10 +1620,10 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
|
|||
* Any failures from here onwards should not touch the count.
|
||||
*/
|
||||
tty->driver_data = state;
|
||||
state->port->info = &state->info;
|
||||
tty->low_latency = (state->port->flags & UPF_LOW_LATENCY) ? 1 : 0;
|
||||
state->uart_port->state = state;
|
||||
tty->low_latency = (state->uart_port->flags & UPF_LOW_LATENCY) ? 1 : 0;
|
||||
tty->alt_speed = 0;
|
||||
state->info.port.tty = tty;
|
||||
state->port.tty = tty;
|
||||
|
||||
/*
|
||||
* If the port is in the middle of closing, bail out now.
|
||||
|
@ -1659,8 +1656,8 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
|
|||
/*
|
||||
* If this is the first open to succeed, adjust things to suit.
|
||||
*/
|
||||
if (retval == 0 && !(state->info.flags & UIF_NORMAL_ACTIVE)) {
|
||||
state->info.flags |= UIF_NORMAL_ACTIVE;
|
||||
if (retval == 0 && !(state->flags & UIF_NORMAL_ACTIVE)) {
|
||||
state->flags |= UIF_NORMAL_ACTIVE;
|
||||
|
||||
uart_update_termios(state);
|
||||
}
|
||||
|
@ -1688,7 +1685,7 @@ static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i)
|
|||
{
|
||||
struct uart_state *state = drv->state + i;
|
||||
int pm_state;
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
char stat_buf[32];
|
||||
unsigned int status;
|
||||
int mmio;
|
||||
|
@ -1958,7 +1955,7 @@ EXPORT_SYMBOL_GPL(uart_set_options);
|
|||
|
||||
static void uart_change_pm(struct uart_state *state, int pm_state)
|
||||
{
|
||||
struct uart_port *port = state->port;
|
||||
struct uart_port *port = state->uart_port;
|
||||
|
||||
if (state->pm_state != pm_state) {
|
||||
if (port->ops->pm)
|
||||
|
@ -2005,11 +2002,11 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
|
|||
}
|
||||
port->suspended = 1;
|
||||
|
||||
if (state->info.flags & UIF_INITIALIZED) {
|
||||
if (state->flags & UIF_INITIALIZED) {
|
||||
const struct uart_ops *ops = port->ops;
|
||||
int tries;
|
||||
|
||||
state->info.flags = (state->info.flags & ~UIF_INITIALIZED)
|
||||
state->flags = (state->flags & ~UIF_INITIALIZED)
|
||||
| UIF_SUSPENDED;
|
||||
|
||||
spin_lock_irq(&port->lock);
|
||||
|
@ -2084,15 +2081,15 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
|
|||
/*
|
||||
* If that's unset, use the tty termios setting.
|
||||
*/
|
||||
if (state->info.port.tty && termios.c_cflag == 0)
|
||||
termios = *state->info.port.tty->termios;
|
||||
if (state->port.tty && termios.c_cflag == 0)
|
||||
termios = *state->port.tty->termios;
|
||||
|
||||
uart_change_pm(state, 0);
|
||||
port->ops->set_termios(port, &termios, NULL);
|
||||
console_start(port->cons);
|
||||
}
|
||||
|
||||
if (state->info.flags & UIF_SUSPENDED) {
|
||||
if (state->flags & UIF_SUSPENDED) {
|
||||
const struct uart_ops *ops = port->ops;
|
||||
int ret;
|
||||
|
||||
|
@ -2107,7 +2104,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
|
|||
ops->set_mctrl(port, port->mctrl);
|
||||
ops->start_tx(port);
|
||||
spin_unlock_irq(&port->lock);
|
||||
state->info.flags |= UIF_INITIALIZED;
|
||||
state->flags |= UIF_INITIALIZED;
|
||||
} else {
|
||||
/*
|
||||
* Failed to resume - maybe hardware went away?
|
||||
|
@ -2117,7 +2114,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
|
|||
uart_shutdown(state);
|
||||
}
|
||||
|
||||
state->info.flags &= ~UIF_SUSPENDED;
|
||||
state->flags &= ~UIF_SUSPENDED;
|
||||
}
|
||||
|
||||
mutex_unlock(&state->mutex);
|
||||
|
@ -2232,10 +2229,10 @@ static int uart_poll_init(struct tty_driver *driver, int line, char *options)
|
|||
int parity = 'n';
|
||||
int flow = 'n';
|
||||
|
||||
if (!state || !state->port)
|
||||
if (!state || !state->uart_port)
|
||||
return -1;
|
||||
|
||||
port = state->port;
|
||||
port = state->uart_port;
|
||||
if (!(port->ops->poll_get_char && port->ops->poll_put_char))
|
||||
return -1;
|
||||
|
||||
|
@ -2253,10 +2250,10 @@ static int uart_poll_get_char(struct tty_driver *driver, int line)
|
|||
struct uart_state *state = drv->state + line;
|
||||
struct uart_port *port;
|
||||
|
||||
if (!state || !state->port)
|
||||
if (!state || !state->uart_port)
|
||||
return -1;
|
||||
|
||||
port = state->port;
|
||||
port = state->uart_port;
|
||||
return port->ops->poll_get_char(port);
|
||||
}
|
||||
|
||||
|
@ -2266,10 +2263,10 @@ static void uart_poll_put_char(struct tty_driver *driver, int line, char ch)
|
|||
struct uart_state *state = drv->state + line;
|
||||
struct uart_port *port;
|
||||
|
||||
if (!state || !state->port)
|
||||
if (!state || !state->uart_port)
|
||||
return;
|
||||
|
||||
port = state->port;
|
||||
port = state->uart_port;
|
||||
port->ops->poll_put_char(port, ch);
|
||||
}
|
||||
#endif
|
||||
|
@ -2365,9 +2362,9 @@ int uart_register_driver(struct uart_driver *drv)
|
|||
state->closing_wait = 30000; /* 30 seconds */
|
||||
mutex_init(&state->mutex);
|
||||
|
||||
tty_port_init(&state->info.port);
|
||||
init_waitqueue_head(&state->info.delta_msr_wait);
|
||||
tasklet_init(&state->info.tlet, uart_tasklet_action,
|
||||
tty_port_init(&state->port);
|
||||
init_waitqueue_head(&state->delta_msr_wait);
|
||||
tasklet_init(&state->tlet, uart_tasklet_action,
|
||||
(unsigned long)state);
|
||||
}
|
||||
|
||||
|
@ -2430,16 +2427,16 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
|
|||
|
||||
mutex_lock(&port_mutex);
|
||||
mutex_lock(&state->mutex);
|
||||
if (state->port) {
|
||||
if (state->uart_port) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
state->port = port;
|
||||
state->uart_port = port;
|
||||
state->pm_state = -1;
|
||||
|
||||
port->cons = drv->cons;
|
||||
port->info = &state->info;
|
||||
port->state = state;
|
||||
|
||||
/*
|
||||
* If this port is a console, then the spinlock is already
|
||||
|
@ -2488,13 +2485,12 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
|
|||
int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
|
||||
{
|
||||
struct uart_state *state = drv->state + port->line;
|
||||
struct uart_info *info;
|
||||
|
||||
BUG_ON(in_interrupt());
|
||||
|
||||
if (state->port != port)
|
||||
if (state->uart_port != port)
|
||||
printk(KERN_ALERT "Removing wrong port: %p != %p\n",
|
||||
state->port, port);
|
||||
state->uart_port, port);
|
||||
|
||||
mutex_lock(&port_mutex);
|
||||
|
||||
|
@ -2511,9 +2507,8 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
|
|||
*/
|
||||
tty_unregister_device(drv->tty_driver, port->line);
|
||||
|
||||
info = &state->info;
|
||||
if (info && info->port.tty)
|
||||
tty_vhangup(info->port.tty);
|
||||
if (state->port.tty)
|
||||
tty_vhangup(state->port.tty);
|
||||
|
||||
/*
|
||||
* Free the port IO and memory resources, if any.
|
||||
|
@ -2529,10 +2524,9 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
|
|||
/*
|
||||
* Kill the tasklet, and free resources.
|
||||
*/
|
||||
if (info)
|
||||
tasklet_kill(&info->tlet);
|
||||
tasklet_kill(&state->tlet);
|
||||
|
||||
state->port = NULL;
|
||||
state->uart_port = NULL;
|
||||
mutex_unlock(&port_mutex);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -154,7 +154,7 @@ static void ks8695uart_disable_ms(struct uart_port *port)
|
|||
static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_port *port = dev_id;
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
unsigned int status, ch, lsr, flg, max_count = 256;
|
||||
|
||||
status = UART_GET_LSR(port); /* clears pending LSR interrupts */
|
||||
|
@ -210,7 +210,7 @@ static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id)
|
|||
static irqreturn_t ks8695uart_tx_chars(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_port *port = dev_id;
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
unsigned int count;
|
||||
|
||||
if (port->x_char) {
|
||||
|
@ -266,7 +266,7 @@ static irqreturn_t ks8695uart_modem_status(int irq, void *dev_id)
|
|||
if (status & URMS_URTERI)
|
||||
port->icount.rng++;
|
||||
|
||||
wake_up_interruptible(&port->info->delta_msr_wait);
|
||||
wake_up_interruptible(&port->state->delta_msr_wait);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ static void lh7a40xuart_enable_ms (struct uart_port* port)
|
|||
|
||||
static void lh7a40xuart_rx_chars (struct uart_port* port)
|
||||
{
|
||||
struct tty_struct* tty = port->info->port.tty;
|
||||
struct tty_struct* tty = port->state->port.tty;
|
||||
int cbRxMax = 256; /* (Gross) limit on receive */
|
||||
unsigned int data; /* Received data and status */
|
||||
unsigned int flag;
|
||||
|
@ -184,7 +184,7 @@ static void lh7a40xuart_rx_chars (struct uart_port* port)
|
|||
|
||||
static void lh7a40xuart_tx_chars (struct uart_port* port)
|
||||
{
|
||||
struct circ_buf* xmit = &port->info->xmit;
|
||||
struct circ_buf* xmit = &port->state->xmit;
|
||||
int cbTxMax = port->fifosize;
|
||||
|
||||
if (port->x_char) {
|
||||
|
@ -241,7 +241,7 @@ static void lh7a40xuart_modem_status (struct uart_port* port)
|
|||
if (delta & CTS)
|
||||
uart_handle_cts_change (port, status & CTS);
|
||||
|
||||
wake_up_interruptible (&port->info->delta_msr_wait);
|
||||
wake_up_interruptible (&port->state->delta_msr_wait);
|
||||
}
|
||||
|
||||
static irqreturn_t lh7a40xuart_int (int irq, void* dev_id)
|
||||
|
|
|
@ -272,7 +272,7 @@ static void serial_txx9_initialize(struct uart_port *port)
|
|||
static inline void
|
||||
receive_chars(struct uart_txx9_port *up, unsigned int *status)
|
||||
{
|
||||
struct tty_struct *tty = up->port.info->port.tty;
|
||||
struct tty_struct *tty = up->port.state->port.tty;
|
||||
unsigned char ch;
|
||||
unsigned int disr = *status;
|
||||
int max_count = 256;
|
||||
|
@ -348,7 +348,7 @@ receive_chars(struct uart_txx9_port *up, unsigned int *status)
|
|||
|
||||
static inline void transmit_chars(struct uart_txx9_port *up)
|
||||
{
|
||||
struct circ_buf *xmit = &up->port.info->xmit;
|
||||
struct circ_buf *xmit = &up->port.state->xmit;
|
||||
int count;
|
||||
|
||||
if (up->port.x_char) {
|
||||
|
|
|
@ -361,7 +361,7 @@ static inline int sci_rxroom(struct uart_port *port)
|
|||
|
||||
static void sci_transmit_chars(struct uart_port *port)
|
||||
{
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
unsigned int stopped = uart_tx_stopped(port);
|
||||
unsigned short status;
|
||||
unsigned short ctrl;
|
||||
|
@ -426,7 +426,7 @@ static void sci_transmit_chars(struct uart_port *port)
|
|||
static inline void sci_receive_chars(struct uart_port *port)
|
||||
{
|
||||
struct sci_port *sci_port = to_sci_port(port);
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
int i, count, copied = 0;
|
||||
unsigned short status;
|
||||
unsigned char flag;
|
||||
|
@ -546,7 +546,7 @@ static inline int sci_handle_errors(struct uart_port *port)
|
|||
{
|
||||
int copied = 0;
|
||||
unsigned short status = sci_in(port, SCxSR);
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
|
||||
if (status & SCxSR_ORER(port)) {
|
||||
/* overrun error */
|
||||
|
@ -600,7 +600,7 @@ static inline int sci_handle_errors(struct uart_port *port)
|
|||
|
||||
static inline int sci_handle_fifo_overrun(struct uart_port *port)
|
||||
{
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
int copied = 0;
|
||||
|
||||
if (port->type != PORT_SCIF)
|
||||
|
@ -623,7 +623,7 @@ static inline int sci_handle_breaks(struct uart_port *port)
|
|||
{
|
||||
int copied = 0;
|
||||
unsigned short status = sci_in(port, SCxSR);
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
struct sci_port *s = to_sci_port(port);
|
||||
|
||||
if (uart_handle_break(port))
|
||||
|
|
|
@ -469,9 +469,9 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags)
|
|||
return;
|
||||
}
|
||||
|
||||
if (port->sc_port.info) {
|
||||
if (port->sc_port.state) {
|
||||
/* The serial_core stuffs are initilized, use them */
|
||||
tty = port->sc_port.info->port.tty;
|
||||
tty = port->sc_port.state->port.tty;
|
||||
}
|
||||
else {
|
||||
/* Not registered yet - can't pass to tty layer. */
|
||||
|
@ -550,9 +550,9 @@ static void sn_transmit_chars(struct sn_cons_port *port, int raw)
|
|||
|
||||
BUG_ON(!port->sc_is_asynch);
|
||||
|
||||
if (port->sc_port.info) {
|
||||
if (port->sc_port.state) {
|
||||
/* We're initilized, using serial core infrastructure */
|
||||
xmit = &port->sc_port.info->xmit;
|
||||
xmit = &port->sc_port.state->xmit;
|
||||
} else {
|
||||
/* Probably sn_sal_switch_to_asynch has been run but serial core isn't
|
||||
* initilized yet. Just return. Writes are going through
|
||||
|
@ -927,7 +927,7 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
|
|||
/* We can't look at the xmit buffer if we're not registered with serial core
|
||||
* yet. So only do the fancy recovery after registering
|
||||
*/
|
||||
if (!port->sc_port.info) {
|
||||
if (!port->sc_port.state) {
|
||||
/* Not yet registered with serial core - simple case */
|
||||
puts_raw_fixed(port->sc_ops->sal_puts_raw, s, count);
|
||||
return;
|
||||
|
@ -936,8 +936,8 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
|
|||
/* somebody really wants this output, might be an
|
||||
* oops, kdb, panic, etc. make sure they get it. */
|
||||
if (spin_is_locked(&port->sc_port.lock)) {
|
||||
int lhead = port->sc_port.info->xmit.head;
|
||||
int ltail = port->sc_port.info->xmit.tail;
|
||||
int lhead = port->sc_port.state->xmit.head;
|
||||
int ltail = port->sc_port.state->xmit.tail;
|
||||
int counter, got_lock = 0;
|
||||
|
||||
/*
|
||||
|
@ -962,13 +962,13 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
|
|||
break;
|
||||
} else {
|
||||
/* still locked */
|
||||
if ((lhead != port->sc_port.info->xmit.head)
|
||||
if ((lhead != port->sc_port.state->xmit.head)
|
||||
|| (ltail !=
|
||||
port->sc_port.info->xmit.tail)) {
|
||||
port->sc_port.state->xmit.tail)) {
|
||||
lhead =
|
||||
port->sc_port.info->xmit.head;
|
||||
port->sc_port.state->xmit.head;
|
||||
ltail =
|
||||
port->sc_port.info->xmit.tail;
|
||||
port->sc_port.state->xmit.tail;
|
||||
counter = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,8 +184,8 @@ static struct tty_struct *receive_chars(struct uart_port *port)
|
|||
{
|
||||
struct tty_struct *tty = NULL;
|
||||
|
||||
if (port->info != NULL) /* Unopened serial console */
|
||||
tty = port->info->port.tty;
|
||||
if (port->state != NULL) /* Unopened serial console */
|
||||
tty = port->state->port.tty;
|
||||
|
||||
if (sunhv_ops->receive_chars(port, tty))
|
||||
sun_do_break();
|
||||
|
@ -197,10 +197,10 @@ static void transmit_chars(struct uart_port *port)
|
|||
{
|
||||
struct circ_buf *xmit;
|
||||
|
||||
if (!port->info)
|
||||
if (!port->state)
|
||||
return;
|
||||
|
||||
xmit = &port->info->xmit;
|
||||
xmit = &port->state->xmit;
|
||||
if (uart_circ_empty(xmit) || uart_tx_stopped(port))
|
||||
return;
|
||||
|
||||
|
|
|
@ -117,8 +117,8 @@ receive_chars(struct uart_sunsab_port *up,
|
|||
int count = 0;
|
||||
int i;
|
||||
|
||||
if (up->port.info != NULL) /* Unopened serial console */
|
||||
tty = up->port.info->port.tty;
|
||||
if (up->port.state != NULL) /* Unopened serial console */
|
||||
tty = up->port.state->port.tty;
|
||||
|
||||
/* Read number of BYTES (Character + Status) available. */
|
||||
if (stat->sreg.isr0 & SAB82532_ISR0_RPF) {
|
||||
|
@ -229,7 +229,7 @@ static void sunsab_tx_idle(struct uart_sunsab_port *);
|
|||
static void transmit_chars(struct uart_sunsab_port *up,
|
||||
union sab82532_irq_status *stat)
|
||||
{
|
||||
struct circ_buf *xmit = &up->port.info->xmit;
|
||||
struct circ_buf *xmit = &up->port.state->xmit;
|
||||
int i;
|
||||
|
||||
if (stat->sreg.isr1 & SAB82532_ISR1_ALLS) {
|
||||
|
@ -297,7 +297,7 @@ static void check_status(struct uart_sunsab_port *up,
|
|||
up->port.icount.dsr++;
|
||||
}
|
||||
|
||||
wake_up_interruptible(&up->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&up->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
static irqreturn_t sunsab_interrupt(int irq, void *dev_id)
|
||||
|
@ -429,7 +429,7 @@ static void sunsab_tx_idle(struct uart_sunsab_port *up)
|
|||
static void sunsab_start_tx(struct uart_port *port)
|
||||
{
|
||||
struct uart_sunsab_port *up = (struct uart_sunsab_port *) port;
|
||||
struct circ_buf *xmit = &up->port.info->xmit;
|
||||
struct circ_buf *xmit = &up->port.state->xmit;
|
||||
int i;
|
||||
|
||||
up->interrupt_mask1 &= ~(SAB82532_IMR1_ALLS|SAB82532_IMR1_XPR);
|
||||
|
|
|
@ -311,7 +311,7 @@ static void sunsu_enable_ms(struct uart_port *port)
|
|||
static struct tty_struct *
|
||||
receive_chars(struct uart_sunsu_port *up, unsigned char *status)
|
||||
{
|
||||
struct tty_struct *tty = up->port.info->port.tty;
|
||||
struct tty_struct *tty = up->port.state->port.tty;
|
||||
unsigned char ch, flag;
|
||||
int max_count = 256;
|
||||
int saw_console_brk = 0;
|
||||
|
@ -389,7 +389,7 @@ receive_chars(struct uart_sunsu_port *up, unsigned char *status)
|
|||
|
||||
static void transmit_chars(struct uart_sunsu_port *up)
|
||||
{
|
||||
struct circ_buf *xmit = &up->port.info->xmit;
|
||||
struct circ_buf *xmit = &up->port.state->xmit;
|
||||
int count;
|
||||
|
||||
if (up->port.x_char) {
|
||||
|
@ -441,7 +441,7 @@ static void check_modem_status(struct uart_sunsu_port *up)
|
|||
if (status & UART_MSR_DCTS)
|
||||
uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
|
||||
|
||||
wake_up_interruptible(&up->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&up->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
static irqreturn_t sunsu_serial_interrupt(int irq, void *dev_id)
|
||||
|
|
|
@ -328,9 +328,9 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up,
|
|||
unsigned char ch, r1, flag;
|
||||
|
||||
tty = NULL;
|
||||
if (up->port.info != NULL && /* Unopened serial console */
|
||||
up->port.info->port.tty != NULL) /* Keyboard || mouse */
|
||||
tty = up->port.info->port.tty;
|
||||
if (up->port.state != NULL && /* Unopened serial console */
|
||||
up->port.state->port.tty != NULL) /* Keyboard || mouse */
|
||||
tty = up->port.state->port.tty;
|
||||
|
||||
for (;;) {
|
||||
|
||||
|
@ -451,7 +451,7 @@ static void sunzilog_status_handle(struct uart_sunzilog_port *up,
|
|||
uart_handle_cts_change(&up->port,
|
||||
(status & CTS));
|
||||
|
||||
wake_up_interruptible(&up->port.info->delta_msr_wait);
|
||||
wake_up_interruptible(&up->port.state->delta_msr_wait);
|
||||
}
|
||||
|
||||
up->prev_status = status;
|
||||
|
@ -501,9 +501,9 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up,
|
|||
return;
|
||||
}
|
||||
|
||||
if (up->port.info == NULL)
|
||||
if (up->port.state == NULL)
|
||||
goto ack_tx_int;
|
||||
xmit = &up->port.info->xmit;
|
||||
xmit = &up->port.state->xmit;
|
||||
if (uart_circ_empty(xmit))
|
||||
goto ack_tx_int;
|
||||
|
||||
|
@ -705,7 +705,7 @@ static void sunzilog_start_tx(struct uart_port *port)
|
|||
port->icount.tx++;
|
||||
port->x_char = 0;
|
||||
} else {
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
writeb(xmit->buf[xmit->tail], &channel->data);
|
||||
ZSDELAY();
|
||||
|
|
|
@ -77,7 +77,7 @@ static void timbuart_flush_buffer(struct uart_port *port)
|
|||
|
||||
static void timbuart_rx_chars(struct uart_port *port)
|
||||
{
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
|
||||
while (ioread32(port->membase + TIMBUART_ISR) & RXDP) {
|
||||
u8 ch = ioread8(port->membase + TIMBUART_RXFIFO);
|
||||
|
@ -86,7 +86,7 @@ static void timbuart_rx_chars(struct uart_port *port)
|
|||
}
|
||||
|
||||
spin_unlock(&port->lock);
|
||||
tty_flip_buffer_push(port->info->port.tty);
|
||||
tty_flip_buffer_push(port->state->port.tty);
|
||||
spin_lock(&port->lock);
|
||||
|
||||
dev_dbg(port->dev, "%s - total read %d bytes\n",
|
||||
|
@ -95,7 +95,7 @@ static void timbuart_rx_chars(struct uart_port *port)
|
|||
|
||||
static void timbuart_tx_chars(struct uart_port *port)
|
||||
{
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
while (!(ioread32(port->membase + TIMBUART_ISR) & TXBF) &&
|
||||
!uart_circ_empty(xmit)) {
|
||||
|
@ -118,7 +118,7 @@ static void timbuart_handle_tx_port(struct uart_port *port, u32 isr, u32 *ier)
|
|||
{
|
||||
struct timbuart_port *uart =
|
||||
container_of(port, struct timbuart_port, port);
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
if (uart_circ_empty(xmit) || uart_tx_stopped(port))
|
||||
return;
|
||||
|
@ -231,7 +231,7 @@ static void timbuart_mctrl_check(struct uart_port *port, u32 isr, u32 *ier)
|
|||
iowrite32(CTS_DELTA, port->membase + TIMBUART_ISR);
|
||||
cts = timbuart_get_mctrl(port);
|
||||
uart_handle_cts_change(port, cts & TIOCM_CTS);
|
||||
wake_up_interruptible(&port->info->delta_msr_wait);
|
||||
wake_up_interruptible(&port->state->delta_msr_wait);
|
||||
}
|
||||
|
||||
*ier |= CTS_DELTA;
|
||||
|
|
|
@ -75,7 +75,7 @@ static struct uart_port ulite_ports[ULITE_NR_UARTS];
|
|||
|
||||
static int ulite_receive(struct uart_port *port, int stat)
|
||||
{
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
unsigned char ch = 0;
|
||||
char flag = TTY_NORMAL;
|
||||
|
||||
|
@ -125,7 +125,7 @@ static int ulite_receive(struct uart_port *port, int stat)
|
|||
|
||||
static int ulite_transmit(struct uart_port *port, int stat)
|
||||
{
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
if (stat & ULITE_STATUS_TXFULL)
|
||||
return 0;
|
||||
|
@ -162,7 +162,7 @@ static irqreturn_t ulite_isr(int irq, void *dev_id)
|
|||
busy |= ulite_transmit(port, stat);
|
||||
} while (busy);
|
||||
|
||||
tty_flip_buffer_push(port->info->port.tty);
|
||||
tty_flip_buffer_push(port->state->port.tty);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ static int qe_uart_tx_pump(struct uart_qe_port *qe_port)
|
|||
unsigned char *p;
|
||||
unsigned int count;
|
||||
struct uart_port *port = &qe_port->port;
|
||||
struct circ_buf *xmit = &port->info->xmit;
|
||||
struct circ_buf *xmit = &port->state->xmit;
|
||||
|
||||
bdp = qe_port->rx_cur;
|
||||
|
||||
|
@ -466,7 +466,7 @@ static void qe_uart_int_rx(struct uart_qe_port *qe_port)
|
|||
int i;
|
||||
unsigned char ch, *cp;
|
||||
struct uart_port *port = &qe_port->port;
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
struct qe_bd *bdp;
|
||||
u16 status;
|
||||
unsigned int flg;
|
||||
|
|
|
@ -318,7 +318,7 @@ static inline void receive_chars(struct uart_port *port, uint8_t *status)
|
|||
char flag;
|
||||
int max_count = RX_MAX_COUNT;
|
||||
|
||||
tty = port->info->port.tty;
|
||||
tty = port->state->port.tty;
|
||||
lsr = *status;
|
||||
|
||||
do {
|
||||
|
@ -386,7 +386,7 @@ static inline void check_modem_status(struct uart_port *port)
|
|||
if (msr & UART_MSR_DCTS)
|
||||
uart_handle_cts_change(port, msr & UART_MSR_CTS);
|
||||
|
||||
wake_up_interruptible(&port->info->delta_msr_wait);
|
||||
wake_up_interruptible(&port->state->delta_msr_wait);
|
||||
}
|
||||
|
||||
static inline void transmit_chars(struct uart_port *port)
|
||||
|
@ -394,7 +394,7 @@ static inline void transmit_chars(struct uart_port *port)
|
|||
struct circ_buf *xmit;
|
||||
int max_count = TX_MAX_COUNT;
|
||||
|
||||
xmit = &port->info->xmit;
|
||||
xmit = &port->state->xmit;
|
||||
|
||||
if (port->x_char) {
|
||||
siu_write(port, UART_TX, port->x_char);
|
||||
|
|
|
@ -602,12 +602,12 @@ static void zs_receive_chars(struct zs_port *zport)
|
|||
uart_insert_char(uport, status, Rx_OVR, ch, flag);
|
||||
}
|
||||
|
||||
tty_flip_buffer_push(uport->info->port.tty);
|
||||
tty_flip_buffer_push(uport->state->port.tty);
|
||||
}
|
||||
|
||||
static void zs_raw_transmit_chars(struct zs_port *zport)
|
||||
{
|
||||
struct circ_buf *xmit = &zport->port.info->xmit;
|
||||
struct circ_buf *xmit = &zport->port.state->xmit;
|
||||
|
||||
/* XON/XOFF chars. */
|
||||
if (zport->port.x_char) {
|
||||
|
@ -686,7 +686,7 @@ static void zs_status_handle(struct zs_port *zport, struct zs_port *zport_a)
|
|||
uport->icount.rng++;
|
||||
|
||||
if (delta)
|
||||
wake_up_interruptible(&uport->info->delta_msr_wait);
|
||||
wake_up_interruptible(&uport->state->delta_msr_wait);
|
||||
|
||||
spin_lock(&scc->zlock);
|
||||
}
|
||||
|
|
|
@ -186,7 +186,6 @@
|
|||
#include <linux/sysrq.h>
|
||||
|
||||
struct uart_port;
|
||||
struct uart_info;
|
||||
struct serial_struct;
|
||||
struct device;
|
||||
|
||||
|
@ -284,7 +283,7 @@ struct uart_port {
|
|||
|
||||
unsigned int read_status_mask; /* driver specific */
|
||||
unsigned int ignore_status_mask; /* driver specific */
|
||||
struct uart_info *info; /* pointer to parent info */
|
||||
struct uart_state *state; /* pointer to parent state */
|
||||
struct uart_icount icount; /* statistics */
|
||||
|
||||
struct console *cons; /* struct console, if any */
|
||||
|
@ -343,8 +342,22 @@ struct uart_port {
|
|||
*/
|
||||
typedef unsigned int __bitwise__ uif_t;
|
||||
|
||||
struct uart_info {
|
||||
|
||||
/*
|
||||
* This is the state information which is persistent across opens.
|
||||
* The low level driver must not to touch any elements contained
|
||||
* within.
|
||||
*/
|
||||
struct uart_state {
|
||||
struct tty_port port;
|
||||
unsigned int close_delay; /* msec */
|
||||
unsigned int closing_wait; /* msec */
|
||||
|
||||
#define USF_CLOSING_WAIT_INF (0)
|
||||
#define USF_CLOSING_WAIT_NONE (~0U)
|
||||
|
||||
int count;
|
||||
int pm_state;
|
||||
struct circ_buf xmit;
|
||||
uif_t flags;
|
||||
|
||||
|
@ -362,24 +375,7 @@ struct uart_info {
|
|||
|
||||
struct tasklet_struct tlet;
|
||||
wait_queue_head_t delta_msr_wait;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the state information which is persistent across opens.
|
||||
* The low level driver must not to touch any elements contained
|
||||
* within.
|
||||
*/
|
||||
struct uart_state {
|
||||
unsigned int close_delay; /* msec */
|
||||
unsigned int closing_wait; /* msec */
|
||||
|
||||
#define USF_CLOSING_WAIT_INF (0)
|
||||
#define USF_CLOSING_WAIT_NONE (~0U)
|
||||
|
||||
int count;
|
||||
int pm_state;
|
||||
struct uart_info info;
|
||||
struct uart_port *port;
|
||||
struct uart_port *uart_port;
|
||||
|
||||
struct mutex mutex;
|
||||
};
|
||||
|
@ -462,7 +458,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
|
|||
|
||||
static inline int uart_tx_stopped(struct uart_port *port)
|
||||
{
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
if(tty->stopped || tty->hw_stopped)
|
||||
return 1;
|
||||
return 0;
|
||||
|
@ -477,7 +473,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
|
|||
#ifdef SUPPORT_SYSRQ
|
||||
if (port->sysrq) {
|
||||
if (ch && time_before(jiffies, port->sysrq)) {
|
||||
handle_sysrq(ch, port->info->port.tty);
|
||||
handle_sysrq(ch, port->state->port.tty);
|
||||
port->sysrq = 0;
|
||||
return 1;
|
||||
}
|
||||
|
@ -495,7 +491,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
|
|||
*/
|
||||
static inline int uart_handle_break(struct uart_port *port)
|
||||
{
|
||||
struct uart_info *info = port->info;
|
||||
struct uart_state *state = port->state;
|
||||
#ifdef SUPPORT_SYSRQ
|
||||
if (port->cons && port->cons->index == port->line) {
|
||||
if (!port->sysrq) {
|
||||
|
@ -506,7 +502,7 @@ static inline int uart_handle_break(struct uart_port *port)
|
|||
}
|
||||
#endif
|
||||
if (port->flags & UPF_SAK)
|
||||
do_SAK(info->port.tty);
|
||||
do_SAK(state->port.tty);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -518,7 +514,7 @@ static inline int uart_handle_break(struct uart_port *port)
|
|||
static inline void
|
||||
uart_handle_dcd_change(struct uart_port *port, unsigned int status)
|
||||
{
|
||||
struct uart_info *info = port->info;
|
||||
struct uart_state *state = port->state;
|
||||
|
||||
port->icount.dcd++;
|
||||
|
||||
|
@ -527,11 +523,11 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status)
|
|||
hardpps();
|
||||
#endif
|
||||
|
||||
if (info->flags & UIF_CHECK_CD) {
|
||||
if (state->flags & UIF_CHECK_CD) {
|
||||
if (status)
|
||||
wake_up_interruptible(&info->port.open_wait);
|
||||
else if (info->port.tty)
|
||||
tty_hangup(info->port.tty);
|
||||
wake_up_interruptible(&state->port.open_wait);
|
||||
else if (state->port.tty)
|
||||
tty_hangup(state->port.tty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,12 +539,12 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status)
|
|||
static inline void
|
||||
uart_handle_cts_change(struct uart_port *port, unsigned int status)
|
||||
{
|
||||
struct uart_info *info = port->info;
|
||||
struct tty_struct *tty = info->port.tty;
|
||||
struct uart_state *state = port->state;
|
||||
struct tty_struct *tty = state->port.tty;
|
||||
|
||||
port->icount.cts++;
|
||||
|
||||
if (info->flags & UIF_CTS_FLOW) {
|
||||
if (state->flags & UIF_CTS_FLOW) {
|
||||
if (tty->hw_stopped) {
|
||||
if (status) {
|
||||
tty->hw_stopped = 0;
|
||||
|
@ -570,7 +566,7 @@ static inline void
|
|||
uart_insert_char(struct uart_port *port, unsigned int status,
|
||||
unsigned int overrun, unsigned int ch, unsigned int flag)
|
||||
{
|
||||
struct tty_struct *tty = port->info->port.tty;
|
||||
struct tty_struct *tty = port->state->port.tty;
|
||||
|
||||
if ((status & port->ignore_status_mask & ~overrun) == 0)
|
||||
tty_insert_flip_char(tty, ch, flag);
|
||||
|
|
Loading…
Reference in a new issue