crisv10: use flags from tty_port
First, remove STD_FLAGS as the value, or its subvalues (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) is not tested anywhere -- there is no point to initialize flags to that. Second, use flags member from tty_port when we have it now. So that we do not waste space. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
ee79706905
Коммит
b1d984cf7d
|
@ -169,7 +169,6 @@ static int get_lsr_info(struct e100_serial *info, unsigned int *value);
|
|||
|
||||
|
||||
#define DEF_BAUD 115200 /* 115.2 kbit/s */
|
||||
#define STD_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
|
||||
#define DEF_RX 0x20 /* or SERIAL_CTRL_W >> 8 */
|
||||
/* Default value of tx_ctrl register: has txd(bit 7)=1 (idle) as default */
|
||||
#define DEF_TX 0x80 /* or SERIAL_CTRL_B */
|
||||
|
@ -246,7 +245,6 @@ static struct e100_serial rs_table[] = {
|
|||
.ifirstadr = R_DMA_CH7_FIRST,
|
||||
.icmdadr = R_DMA_CH7_CMD,
|
||||
.idescradr = R_DMA_CH7_DESCR,
|
||||
.flags = STD_FLAGS,
|
||||
.rx_ctrl = DEF_RX,
|
||||
.tx_ctrl = DEF_TX,
|
||||
.iseteop = 2,
|
||||
|
@ -300,7 +298,6 @@ static struct e100_serial rs_table[] = {
|
|||
.ifirstadr = R_DMA_CH9_FIRST,
|
||||
.icmdadr = R_DMA_CH9_CMD,
|
||||
.idescradr = R_DMA_CH9_DESCR,
|
||||
.flags = STD_FLAGS,
|
||||
.rx_ctrl = DEF_RX,
|
||||
.tx_ctrl = DEF_TX,
|
||||
.iseteop = 3,
|
||||
|
@ -356,7 +353,6 @@ static struct e100_serial rs_table[] = {
|
|||
.ifirstadr = R_DMA_CH3_FIRST,
|
||||
.icmdadr = R_DMA_CH3_CMD,
|
||||
.idescradr = R_DMA_CH3_DESCR,
|
||||
.flags = STD_FLAGS,
|
||||
.rx_ctrl = DEF_RX,
|
||||
.tx_ctrl = DEF_TX,
|
||||
.iseteop = 0,
|
||||
|
@ -410,7 +406,6 @@ static struct e100_serial rs_table[] = {
|
|||
.ifirstadr = R_DMA_CH5_FIRST,
|
||||
.icmdadr = R_DMA_CH5_CMD,
|
||||
.idescradr = R_DMA_CH5_DESCR,
|
||||
.flags = STD_FLAGS,
|
||||
.rx_ctrl = DEF_RX,
|
||||
.tx_ctrl = DEF_TX,
|
||||
.iseteop = 1,
|
||||
|
@ -2721,7 +2716,7 @@ startup(struct e100_serial * info)
|
|||
|
||||
/* if it was already initialized, skip this */
|
||||
|
||||
if (info->flags & ASYNC_INITIALIZED) {
|
||||
if (info->port.flags & ASYNC_INITIALIZED) {
|
||||
local_irq_restore(flags);
|
||||
free_page(xmit_page);
|
||||
return 0;
|
||||
|
@ -2846,7 +2841,7 @@ startup(struct e100_serial * info)
|
|||
|
||||
#endif /* CONFIG_SVINTO_SIM */
|
||||
|
||||
info->flags |= ASYNC_INITIALIZED;
|
||||
info->port.flags |= ASYNC_INITIALIZED;
|
||||
|
||||
local_irq_restore(flags);
|
||||
return 0;
|
||||
|
@ -2891,7 +2886,7 @@ shutdown(struct e100_serial * info)
|
|||
|
||||
#endif /* CONFIG_SVINTO_SIM */
|
||||
|
||||
if (!(info->flags & ASYNC_INITIALIZED))
|
||||
if (!(info->port.flags & ASYNC_INITIALIZED))
|
||||
return;
|
||||
|
||||
#ifdef SERIAL_DEBUG_OPEN
|
||||
|
@ -2922,7 +2917,7 @@ shutdown(struct e100_serial * info)
|
|||
if (info->port.tty)
|
||||
set_bit(TTY_IO_ERROR, &info->port.tty->flags);
|
||||
|
||||
info->flags &= ~ASYNC_INITIALIZED;
|
||||
info->port.flags &= ~ASYNC_INITIALIZED;
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
|
@ -2947,7 +2942,7 @@ change_speed(struct e100_serial *info)
|
|||
/* possibly, the tx/rx should be disabled first to do this safely */
|
||||
|
||||
/* change baud-rate and write it to the hardware */
|
||||
if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) {
|
||||
if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) {
|
||||
/* Special baudrate */
|
||||
u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */
|
||||
unsigned long alt_source =
|
||||
|
@ -3397,7 +3392,7 @@ get_serial_info(struct e100_serial * info,
|
|||
tmp.line = info->line;
|
||||
tmp.port = (int)info->ioport;
|
||||
tmp.irq = info->irq;
|
||||
tmp.flags = info->flags;
|
||||
tmp.flags = info->port.flags;
|
||||
tmp.baud_base = info->baud_base;
|
||||
tmp.close_delay = info->close_delay;
|
||||
tmp.closing_wait = info->closing_wait;
|
||||
|
@ -3424,9 +3419,9 @@ set_serial_info(struct e100_serial *info,
|
|||
if ((new_serial.type != info->type) ||
|
||||
(new_serial.close_delay != info->close_delay) ||
|
||||
((new_serial.flags & ~ASYNC_USR_MASK) !=
|
||||
(info->flags & ~ASYNC_USR_MASK)))
|
||||
(info->port.flags & ~ASYNC_USR_MASK)))
|
||||
return -EPERM;
|
||||
info->flags = ((info->flags & ~ASYNC_USR_MASK) |
|
||||
info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) |
|
||||
(new_serial.flags & ASYNC_USR_MASK));
|
||||
goto check_and_exit;
|
||||
}
|
||||
|
@ -3440,16 +3435,16 @@ set_serial_info(struct e100_serial *info,
|
|||
*/
|
||||
|
||||
info->baud_base = new_serial.baud_base;
|
||||
info->flags = ((info->flags & ~ASYNC_FLAGS) |
|
||||
info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) |
|
||||
(new_serial.flags & ASYNC_FLAGS));
|
||||
info->custom_divisor = new_serial.custom_divisor;
|
||||
info->type = new_serial.type;
|
||||
info->close_delay = new_serial.close_delay;
|
||||
info->closing_wait = new_serial.closing_wait;
|
||||
info->port.low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
|
||||
info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
|
||||
|
||||
check_and_exit:
|
||||
if (info->flags & ASYNC_INITIALIZED) {
|
||||
if (info->port.flags & ASYNC_INITIALIZED) {
|
||||
change_speed(info);
|
||||
} else
|
||||
retval = startup(info);
|
||||
|
@ -3789,12 +3784,12 @@ rs_close(struct tty_struct *tty, struct file * filp)
|
|||
local_irq_restore(flags);
|
||||
return;
|
||||
}
|
||||
info->flags |= ASYNC_CLOSING;
|
||||
info->port.flags |= ASYNC_CLOSING;
|
||||
/*
|
||||
* Save the termios structure, since this port may have
|
||||
* separate termios for callout and dialin.
|
||||
*/
|
||||
if (info->flags & ASYNC_NORMAL_ACTIVE)
|
||||
if (info->port.flags & ASYNC_NORMAL_ACTIVE)
|
||||
info->normal_termios = tty->termios;
|
||||
/*
|
||||
* Now we wait for the transmit buffer to clear; and we notify
|
||||
|
@ -3815,7 +3810,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
|
|||
e100_disable_rx(info);
|
||||
e100_disable_rx_irq(info);
|
||||
|
||||
if (info->flags & ASYNC_INITIALIZED) {
|
||||
if (info->port.flags & ASYNC_INITIALIZED) {
|
||||
/*
|
||||
* Before we drop DTR, make sure the UART transmitter
|
||||
* has completely drained; this is especially
|
||||
|
@ -3836,7 +3831,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
|
|||
schedule_timeout_interruptible(info->close_delay);
|
||||
wake_up_interruptible(&info->open_wait);
|
||||
}
|
||||
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
|
||||
info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
|
||||
wake_up_interruptible(&info->close_wait);
|
||||
local_irq_restore(flags);
|
||||
|
||||
|
@ -3931,7 +3926,7 @@ rs_hangup(struct tty_struct *tty)
|
|||
shutdown(info);
|
||||
info->event = 0;
|
||||
info->count = 0;
|
||||
info->flags &= ~ASYNC_NORMAL_ACTIVE;
|
||||
info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
|
||||
info->port.tty = NULL;
|
||||
wake_up_interruptible(&info->open_wait);
|
||||
}
|
||||
|
@ -3955,11 +3950,11 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
|
|||
* until it's done, and then try again.
|
||||
*/
|
||||
if (tty_hung_up_p(filp) ||
|
||||
(info->flags & ASYNC_CLOSING)) {
|
||||
(info->port.flags & ASYNC_CLOSING)) {
|
||||
wait_event_interruptible_tty(tty, info->close_wait,
|
||||
!(info->flags & ASYNC_CLOSING));
|
||||
!(info->port.flags & ASYNC_CLOSING));
|
||||
#ifdef SERIAL_DO_RESTART
|
||||
if (info->flags & ASYNC_HUP_NOTIFY)
|
||||
if (info->port.flags & ASYNC_HUP_NOTIFY)
|
||||
return -EAGAIN;
|
||||
else
|
||||
return -ERESTARTSYS;
|
||||
|
@ -3974,7 +3969,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
|
|||
*/
|
||||
if ((filp->f_flags & O_NONBLOCK) ||
|
||||
(tty->flags & (1 << TTY_IO_ERROR))) {
|
||||
info->flags |= ASYNC_NORMAL_ACTIVE;
|
||||
info->port.flags |= ASYNC_NORMAL_ACTIVE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4010,9 +4005,9 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
|
|||
local_irq_restore(flags);
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
if (tty_hung_up_p(filp) ||
|
||||
!(info->flags & ASYNC_INITIALIZED)) {
|
||||
!(info->port.flags & ASYNC_INITIALIZED)) {
|
||||
#ifdef SERIAL_DO_RESTART
|
||||
if (info->flags & ASYNC_HUP_NOTIFY)
|
||||
if (info->port.flags & ASYNC_HUP_NOTIFY)
|
||||
retval = -EAGAIN;
|
||||
else
|
||||
retval = -ERESTARTSYS;
|
||||
|
@ -4021,7 +4016,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
|
|||
#endif
|
||||
break;
|
||||
}
|
||||
if (!(info->flags & ASYNC_CLOSING) && do_clocal)
|
||||
if (!(info->port.flags & ASYNC_CLOSING) && do_clocal)
|
||||
/* && (do_clocal || DCD_IS_ASSERTED) */
|
||||
break;
|
||||
if (signal_pending(current)) {
|
||||
|
@ -4047,7 +4042,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
|
|||
#endif
|
||||
if (retval)
|
||||
return retval;
|
||||
info->flags |= ASYNC_NORMAL_ACTIVE;
|
||||
info->port.flags |= ASYNC_NORMAL_ACTIVE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4088,17 +4083,17 @@ rs_open(struct tty_struct *tty, struct file * filp)
|
|||
tty->driver_data = info;
|
||||
info->port.tty = tty;
|
||||
|
||||
info->port.low_latency = !!(info->flags & ASYNC_LOW_LATENCY);
|
||||
info->port.low_latency = !!(info->port.flags & ASYNC_LOW_LATENCY);
|
||||
|
||||
/*
|
||||
* If the port is in the middle of closing, bail out now
|
||||
*/
|
||||
if (tty_hung_up_p(filp) ||
|
||||
(info->flags & ASYNC_CLOSING)) {
|
||||
(info->port.flags & ASYNC_CLOSING)) {
|
||||
wait_event_interruptible_tty(tty, info->close_wait,
|
||||
!(info->flags & ASYNC_CLOSING));
|
||||
!(info->port.flags & ASYNC_CLOSING));
|
||||
#ifdef SERIAL_DO_RESTART
|
||||
return ((info->flags & ASYNC_HUP_NOTIFY) ?
|
||||
return ((info->port.flags & ASYNC_HUP_NOTIFY) ?
|
||||
-EAGAIN : -ERESTARTSYS);
|
||||
#else
|
||||
return -EAGAIN;
|
||||
|
@ -4198,7 +4193,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
|
|||
return retval;
|
||||
}
|
||||
|
||||
if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) {
|
||||
if ((info->count == 1) && (info->port.flags & ASYNC_SPLIT_TERMIOS)) {
|
||||
tty->termios = info->normal_termios;
|
||||
change_speed(info);
|
||||
}
|
||||
|
@ -4447,7 +4442,6 @@ static int __init rs_init(void)
|
|||
info->forced_eop = 0;
|
||||
info->baud_base = DEF_BAUD_BASE;
|
||||
info->custom_divisor = 0;
|
||||
info->flags = 0;
|
||||
info->close_delay = 5*HZ/10;
|
||||
info->closing_wait = 30*HZ;
|
||||
info->x_char = 0;
|
||||
|
|
|
@ -53,8 +53,6 @@ struct e100_serial {
|
|||
volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */
|
||||
volatile u32 *idescradr; /* adr to R_DMA_CHx_DESCR */
|
||||
|
||||
int flags; /* defined in tty.h */
|
||||
|
||||
u8 rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */
|
||||
u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */
|
||||
u8 iseteop; /* bit number for R_SET_EOP for the input dma */
|
||||
|
|
Загрузка…
Ссылка в новой задаче