Commit b1d984cf authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

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: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ee797069
...@@ -169,7 +169,6 @@ static int get_lsr_info(struct e100_serial *info, unsigned int *value); ...@@ -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 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 */ #define DEF_RX 0x20 /* or SERIAL_CTRL_W >> 8 */
/* Default value of tx_ctrl register: has txd(bit 7)=1 (idle) as default */ /* Default value of tx_ctrl register: has txd(bit 7)=1 (idle) as default */
#define DEF_TX 0x80 /* or SERIAL_CTRL_B */ #define DEF_TX 0x80 /* or SERIAL_CTRL_B */
...@@ -246,7 +245,6 @@ static struct e100_serial rs_table[] = { ...@@ -246,7 +245,6 @@ static struct e100_serial rs_table[] = {
.ifirstadr = R_DMA_CH7_FIRST, .ifirstadr = R_DMA_CH7_FIRST,
.icmdadr = R_DMA_CH7_CMD, .icmdadr = R_DMA_CH7_CMD,
.idescradr = R_DMA_CH7_DESCR, .idescradr = R_DMA_CH7_DESCR,
.flags = STD_FLAGS,
.rx_ctrl = DEF_RX, .rx_ctrl = DEF_RX,
.tx_ctrl = DEF_TX, .tx_ctrl = DEF_TX,
.iseteop = 2, .iseteop = 2,
...@@ -300,7 +298,6 @@ static struct e100_serial rs_table[] = { ...@@ -300,7 +298,6 @@ static struct e100_serial rs_table[] = {
.ifirstadr = R_DMA_CH9_FIRST, .ifirstadr = R_DMA_CH9_FIRST,
.icmdadr = R_DMA_CH9_CMD, .icmdadr = R_DMA_CH9_CMD,
.idescradr = R_DMA_CH9_DESCR, .idescradr = R_DMA_CH9_DESCR,
.flags = STD_FLAGS,
.rx_ctrl = DEF_RX, .rx_ctrl = DEF_RX,
.tx_ctrl = DEF_TX, .tx_ctrl = DEF_TX,
.iseteop = 3, .iseteop = 3,
...@@ -356,7 +353,6 @@ static struct e100_serial rs_table[] = { ...@@ -356,7 +353,6 @@ static struct e100_serial rs_table[] = {
.ifirstadr = R_DMA_CH3_FIRST, .ifirstadr = R_DMA_CH3_FIRST,
.icmdadr = R_DMA_CH3_CMD, .icmdadr = R_DMA_CH3_CMD,
.idescradr = R_DMA_CH3_DESCR, .idescradr = R_DMA_CH3_DESCR,
.flags = STD_FLAGS,
.rx_ctrl = DEF_RX, .rx_ctrl = DEF_RX,
.tx_ctrl = DEF_TX, .tx_ctrl = DEF_TX,
.iseteop = 0, .iseteop = 0,
...@@ -410,7 +406,6 @@ static struct e100_serial rs_table[] = { ...@@ -410,7 +406,6 @@ static struct e100_serial rs_table[] = {
.ifirstadr = R_DMA_CH5_FIRST, .ifirstadr = R_DMA_CH5_FIRST,
.icmdadr = R_DMA_CH5_CMD, .icmdadr = R_DMA_CH5_CMD,
.idescradr = R_DMA_CH5_DESCR, .idescradr = R_DMA_CH5_DESCR,
.flags = STD_FLAGS,
.rx_ctrl = DEF_RX, .rx_ctrl = DEF_RX,
.tx_ctrl = DEF_TX, .tx_ctrl = DEF_TX,
.iseteop = 1, .iseteop = 1,
...@@ -2721,7 +2716,7 @@ startup(struct e100_serial * info) ...@@ -2721,7 +2716,7 @@ startup(struct e100_serial * info)
/* if it was already initialized, skip this */ /* if it was already initialized, skip this */
if (info->flags & ASYNC_INITIALIZED) { if (info->port.flags & ASYNC_INITIALIZED) {
local_irq_restore(flags); local_irq_restore(flags);
free_page(xmit_page); free_page(xmit_page);
return 0; return 0;
...@@ -2846,7 +2841,7 @@ startup(struct e100_serial * info) ...@@ -2846,7 +2841,7 @@ startup(struct e100_serial * info)
#endif /* CONFIG_SVINTO_SIM */ #endif /* CONFIG_SVINTO_SIM */
info->flags |= ASYNC_INITIALIZED; info->port.flags |= ASYNC_INITIALIZED;
local_irq_restore(flags); local_irq_restore(flags);
return 0; return 0;
...@@ -2891,7 +2886,7 @@ shutdown(struct e100_serial * info) ...@@ -2891,7 +2886,7 @@ shutdown(struct e100_serial * info)
#endif /* CONFIG_SVINTO_SIM */ #endif /* CONFIG_SVINTO_SIM */
if (!(info->flags & ASYNC_INITIALIZED)) if (!(info->port.flags & ASYNC_INITIALIZED))
return; return;
#ifdef SERIAL_DEBUG_OPEN #ifdef SERIAL_DEBUG_OPEN
...@@ -2922,7 +2917,7 @@ shutdown(struct e100_serial * info) ...@@ -2922,7 +2917,7 @@ shutdown(struct e100_serial * info)
if (info->port.tty) if (info->port.tty)
set_bit(TTY_IO_ERROR, &info->port.tty->flags); set_bit(TTY_IO_ERROR, &info->port.tty->flags);
info->flags &= ~ASYNC_INITIALIZED; info->port.flags &= ~ASYNC_INITIALIZED;
local_irq_restore(flags); local_irq_restore(flags);
} }
...@@ -2947,7 +2942,7 @@ change_speed(struct e100_serial *info) ...@@ -2947,7 +2942,7 @@ change_speed(struct e100_serial *info)
/* possibly, the tx/rx should be disabled first to do this safely */ /* possibly, the tx/rx should be disabled first to do this safely */
/* change baud-rate and write it to the hardware */ /* 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 */ /* Special baudrate */
u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */ u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */
unsigned long alt_source = unsigned long alt_source =
...@@ -3397,7 +3392,7 @@ get_serial_info(struct e100_serial * info, ...@@ -3397,7 +3392,7 @@ get_serial_info(struct e100_serial * info,
tmp.line = info->line; tmp.line = info->line;
tmp.port = (int)info->ioport; tmp.port = (int)info->ioport;
tmp.irq = info->irq; tmp.irq = info->irq;
tmp.flags = info->flags; tmp.flags = info->port.flags;
tmp.baud_base = info->baud_base; tmp.baud_base = info->baud_base;
tmp.close_delay = info->close_delay; tmp.close_delay = info->close_delay;
tmp.closing_wait = info->closing_wait; tmp.closing_wait = info->closing_wait;
...@@ -3424,9 +3419,9 @@ set_serial_info(struct e100_serial *info, ...@@ -3424,9 +3419,9 @@ set_serial_info(struct e100_serial *info,
if ((new_serial.type != info->type) || if ((new_serial.type != info->type) ||
(new_serial.close_delay != info->close_delay) || (new_serial.close_delay != info->close_delay) ||
((new_serial.flags & ~ASYNC_USR_MASK) != ((new_serial.flags & ~ASYNC_USR_MASK) !=
(info->flags & ~ASYNC_USR_MASK))) (info->port.flags & ~ASYNC_USR_MASK)))
return -EPERM; return -EPERM;
info->flags = ((info->flags & ~ASYNC_USR_MASK) | info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) |
(new_serial.flags & ASYNC_USR_MASK)); (new_serial.flags & ASYNC_USR_MASK));
goto check_and_exit; goto check_and_exit;
} }
...@@ -3440,16 +3435,16 @@ set_serial_info(struct e100_serial *info, ...@@ -3440,16 +3435,16 @@ set_serial_info(struct e100_serial *info,
*/ */
info->baud_base = new_serial.baud_base; 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)); (new_serial.flags & ASYNC_FLAGS));
info->custom_divisor = new_serial.custom_divisor; info->custom_divisor = new_serial.custom_divisor;
info->type = new_serial.type; info->type = new_serial.type;
info->close_delay = new_serial.close_delay; info->close_delay = new_serial.close_delay;
info->closing_wait = new_serial.closing_wait; 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: check_and_exit:
if (info->flags & ASYNC_INITIALIZED) { if (info->port.flags & ASYNC_INITIALIZED) {
change_speed(info); change_speed(info);
} else } else
retval = startup(info); retval = startup(info);
...@@ -3789,12 +3784,12 @@ rs_close(struct tty_struct *tty, struct file * filp) ...@@ -3789,12 +3784,12 @@ rs_close(struct tty_struct *tty, struct file * filp)
local_irq_restore(flags); local_irq_restore(flags);
return; return;
} }
info->flags |= ASYNC_CLOSING; info->port.flags |= ASYNC_CLOSING;
/* /*
* Save the termios structure, since this port may have * Save the termios structure, since this port may have
* separate termios for callout and dialin. * separate termios for callout and dialin.
*/ */
if (info->flags & ASYNC_NORMAL_ACTIVE) if (info->port.flags & ASYNC_NORMAL_ACTIVE)
info->normal_termios = tty->termios; info->normal_termios = tty->termios;
/* /*
* Now we wait for the transmit buffer to clear; and we notify * 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) ...@@ -3815,7 +3810,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
e100_disable_rx(info); e100_disable_rx(info);
e100_disable_rx_irq(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 * Before we drop DTR, make sure the UART transmitter
* has completely drained; this is especially * has completely drained; this is especially
...@@ -3836,7 +3831,7 @@ rs_close(struct tty_struct *tty, struct file * filp) ...@@ -3836,7 +3831,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
schedule_timeout_interruptible(info->close_delay); schedule_timeout_interruptible(info->close_delay);
wake_up_interruptible(&info->open_wait); 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); wake_up_interruptible(&info->close_wait);
local_irq_restore(flags); local_irq_restore(flags);
...@@ -3931,7 +3926,7 @@ rs_hangup(struct tty_struct *tty) ...@@ -3931,7 +3926,7 @@ rs_hangup(struct tty_struct *tty)
shutdown(info); shutdown(info);
info->event = 0; info->event = 0;
info->count = 0; info->count = 0;
info->flags &= ~ASYNC_NORMAL_ACTIVE; info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
info->port.tty = NULL; info->port.tty = NULL;
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
} }
...@@ -3955,11 +3950,11 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -3955,11 +3950,11 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
* until it's done, and then try again. * until it's done, and then try again.
*/ */
if (tty_hung_up_p(filp) || if (tty_hung_up_p(filp) ||
(info->flags & ASYNC_CLOSING)) { (info->port.flags & ASYNC_CLOSING)) {
wait_event_interruptible_tty(tty, info->close_wait, wait_event_interruptible_tty(tty, info->close_wait,
!(info->flags & ASYNC_CLOSING)); !(info->port.flags & ASYNC_CLOSING));
#ifdef SERIAL_DO_RESTART #ifdef SERIAL_DO_RESTART
if (info->flags & ASYNC_HUP_NOTIFY) if (info->port.flags & ASYNC_HUP_NOTIFY)
return -EAGAIN; return -EAGAIN;
else else
return -ERESTARTSYS; return -ERESTARTSYS;
...@@ -3974,7 +3969,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -3974,7 +3969,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
*/ */
if ((filp->f_flags & O_NONBLOCK) || if ((filp->f_flags & O_NONBLOCK) ||
(tty->flags & (1 << TTY_IO_ERROR))) { (tty->flags & (1 << TTY_IO_ERROR))) {
info->flags |= ASYNC_NORMAL_ACTIVE; info->port.flags |= ASYNC_NORMAL_ACTIVE;
return 0; return 0;
} }
...@@ -4010,9 +4005,9 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -4010,9 +4005,9 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
local_irq_restore(flags); local_irq_restore(flags);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) || if (tty_hung_up_p(filp) ||
!(info->flags & ASYNC_INITIALIZED)) { !(info->port.flags & ASYNC_INITIALIZED)) {
#ifdef SERIAL_DO_RESTART #ifdef SERIAL_DO_RESTART
if (info->flags & ASYNC_HUP_NOTIFY) if (info->port.flags & ASYNC_HUP_NOTIFY)
retval = -EAGAIN; retval = -EAGAIN;
else else
retval = -ERESTARTSYS; retval = -ERESTARTSYS;
...@@ -4021,7 +4016,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -4021,7 +4016,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
#endif #endif
break; break;
} }
if (!(info->flags & ASYNC_CLOSING) && do_clocal) if (!(info->port.flags & ASYNC_CLOSING) && do_clocal)
/* && (do_clocal || DCD_IS_ASSERTED) */ /* && (do_clocal || DCD_IS_ASSERTED) */
break; break;
if (signal_pending(current)) { if (signal_pending(current)) {
...@@ -4047,7 +4042,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -4047,7 +4042,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
#endif #endif
if (retval) if (retval)
return retval; return retval;
info->flags |= ASYNC_NORMAL_ACTIVE; info->port.flags |= ASYNC_NORMAL_ACTIVE;
return 0; return 0;
} }
...@@ -4088,17 +4083,17 @@ rs_open(struct tty_struct *tty, struct file * filp) ...@@ -4088,17 +4083,17 @@ rs_open(struct tty_struct *tty, struct file * filp)
tty->driver_data = info; tty->driver_data = info;
info->port.tty = tty; 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 the port is in the middle of closing, bail out now
*/ */
if (tty_hung_up_p(filp) || if (tty_hung_up_p(filp) ||
(info->flags & ASYNC_CLOSING)) { (info->port.flags & ASYNC_CLOSING)) {
wait_event_interruptible_tty(tty, info->close_wait, wait_event_interruptible_tty(tty, info->close_wait,
!(info->flags & ASYNC_CLOSING)); !(info->port.flags & ASYNC_CLOSING));
#ifdef SERIAL_DO_RESTART #ifdef SERIAL_DO_RESTART
return ((info->flags & ASYNC_HUP_NOTIFY) ? return ((info->port.flags & ASYNC_HUP_NOTIFY) ?
-EAGAIN : -ERESTARTSYS); -EAGAIN : -ERESTARTSYS);
#else #else
return -EAGAIN; return -EAGAIN;
...@@ -4198,7 +4193,7 @@ rs_open(struct tty_struct *tty, struct file * filp) ...@@ -4198,7 +4193,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
return retval; 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; tty->termios = info->normal_termios;
change_speed(info); change_speed(info);
} }
...@@ -4447,7 +4442,6 @@ static int __init rs_init(void) ...@@ -4447,7 +4442,6 @@ static int __init rs_init(void)
info->forced_eop = 0; info->forced_eop = 0;
info->baud_base = DEF_BAUD_BASE; info->baud_base = DEF_BAUD_BASE;
info->custom_divisor = 0; info->custom_divisor = 0;
info->flags = 0;
info->close_delay = 5*HZ/10; info->close_delay = 5*HZ/10;
info->closing_wait = 30*HZ; info->closing_wait = 30*HZ;
info->x_char = 0; info->x_char = 0;
......
...@@ -53,8 +53,6 @@ struct e100_serial { ...@@ -53,8 +53,6 @@ struct e100_serial {
volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */ volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */
volatile u32 *idescradr; /* adr to R_DMA_CHx_DESCR */ 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 rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */
u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */ u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */
u8 iseteop; /* bit number for R_SET_EOP for the input dma */ u8 iseteop; /* bit number for R_SET_EOP for the input dma */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment