diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-03-07 07:12:36 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-18 19:25:29 -0400 |
commit | b1d984cf7d6b7d4e395f1aa6a0a4d3d1ecf21495 (patch) | |
tree | fac50218bf51b62a993850d41dd37cbae476a9f2 /drivers/tty/serial/crisv10.c | |
parent | ee7970690568b0c875467f475d9c957ec0d9e099 (diff) |
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>
Diffstat (limited to 'drivers/tty/serial/crisv10.c')
-rw-r--r-- | drivers/tty/serial/crisv10.c | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index 50f56f39d436..2ae378cc65b6 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c | |||
@@ -169,7 +169,6 @@ static int get_lsr_info(struct e100_serial *info, unsigned int *value); | |||
169 | 169 | ||
170 | 170 | ||
171 | #define DEF_BAUD 115200 /* 115.2 kbit/s */ | 171 | #define DEF_BAUD 115200 /* 115.2 kbit/s */ |
172 | #define STD_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) | ||
173 | #define DEF_RX 0x20 /* or SERIAL_CTRL_W >> 8 */ | 172 | #define DEF_RX 0x20 /* or SERIAL_CTRL_W >> 8 */ |
174 | /* Default value of tx_ctrl register: has txd(bit 7)=1 (idle) as default */ | 173 | /* Default value of tx_ctrl register: has txd(bit 7)=1 (idle) as default */ |
175 | #define DEF_TX 0x80 /* or SERIAL_CTRL_B */ | 174 | #define DEF_TX 0x80 /* or SERIAL_CTRL_B */ |
@@ -246,7 +245,6 @@ static struct e100_serial rs_table[] = { | |||
246 | .ifirstadr = R_DMA_CH7_FIRST, | 245 | .ifirstadr = R_DMA_CH7_FIRST, |
247 | .icmdadr = R_DMA_CH7_CMD, | 246 | .icmdadr = R_DMA_CH7_CMD, |
248 | .idescradr = R_DMA_CH7_DESCR, | 247 | .idescradr = R_DMA_CH7_DESCR, |
249 | .flags = STD_FLAGS, | ||
250 | .rx_ctrl = DEF_RX, | 248 | .rx_ctrl = DEF_RX, |
251 | .tx_ctrl = DEF_TX, | 249 | .tx_ctrl = DEF_TX, |
252 | .iseteop = 2, | 250 | .iseteop = 2, |
@@ -300,7 +298,6 @@ static struct e100_serial rs_table[] = { | |||
300 | .ifirstadr = R_DMA_CH9_FIRST, | 298 | .ifirstadr = R_DMA_CH9_FIRST, |
301 | .icmdadr = R_DMA_CH9_CMD, | 299 | .icmdadr = R_DMA_CH9_CMD, |
302 | .idescradr = R_DMA_CH9_DESCR, | 300 | .idescradr = R_DMA_CH9_DESCR, |
303 | .flags = STD_FLAGS, | ||
304 | .rx_ctrl = DEF_RX, | 301 | .rx_ctrl = DEF_RX, |
305 | .tx_ctrl = DEF_TX, | 302 | .tx_ctrl = DEF_TX, |
306 | .iseteop = 3, | 303 | .iseteop = 3, |
@@ -356,7 +353,6 @@ static struct e100_serial rs_table[] = { | |||
356 | .ifirstadr = R_DMA_CH3_FIRST, | 353 | .ifirstadr = R_DMA_CH3_FIRST, |
357 | .icmdadr = R_DMA_CH3_CMD, | 354 | .icmdadr = R_DMA_CH3_CMD, |
358 | .idescradr = R_DMA_CH3_DESCR, | 355 | .idescradr = R_DMA_CH3_DESCR, |
359 | .flags = STD_FLAGS, | ||
360 | .rx_ctrl = DEF_RX, | 356 | .rx_ctrl = DEF_RX, |
361 | .tx_ctrl = DEF_TX, | 357 | .tx_ctrl = DEF_TX, |
362 | .iseteop = 0, | 358 | .iseteop = 0, |
@@ -410,7 +406,6 @@ static struct e100_serial rs_table[] = { | |||
410 | .ifirstadr = R_DMA_CH5_FIRST, | 406 | .ifirstadr = R_DMA_CH5_FIRST, |
411 | .icmdadr = R_DMA_CH5_CMD, | 407 | .icmdadr = R_DMA_CH5_CMD, |
412 | .idescradr = R_DMA_CH5_DESCR, | 408 | .idescradr = R_DMA_CH5_DESCR, |
413 | .flags = STD_FLAGS, | ||
414 | .rx_ctrl = DEF_RX, | 409 | .rx_ctrl = DEF_RX, |
415 | .tx_ctrl = DEF_TX, | 410 | .tx_ctrl = DEF_TX, |
416 | .iseteop = 1, | 411 | .iseteop = 1, |
@@ -2721,7 +2716,7 @@ startup(struct e100_serial * info) | |||
2721 | 2716 | ||
2722 | /* if it was already initialized, skip this */ | 2717 | /* if it was already initialized, skip this */ |
2723 | 2718 | ||
2724 | if (info->flags & ASYNC_INITIALIZED) { | 2719 | if (info->port.flags & ASYNC_INITIALIZED) { |
2725 | local_irq_restore(flags); | 2720 | local_irq_restore(flags); |
2726 | free_page(xmit_page); | 2721 | free_page(xmit_page); |
2727 | return 0; | 2722 | return 0; |
@@ -2846,7 +2841,7 @@ startup(struct e100_serial * info) | |||
2846 | 2841 | ||
2847 | #endif /* CONFIG_SVINTO_SIM */ | 2842 | #endif /* CONFIG_SVINTO_SIM */ |
2848 | 2843 | ||
2849 | info->flags |= ASYNC_INITIALIZED; | 2844 | info->port.flags |= ASYNC_INITIALIZED; |
2850 | 2845 | ||
2851 | local_irq_restore(flags); | 2846 | local_irq_restore(flags); |
2852 | return 0; | 2847 | return 0; |
@@ -2891,7 +2886,7 @@ shutdown(struct e100_serial * info) | |||
2891 | 2886 | ||
2892 | #endif /* CONFIG_SVINTO_SIM */ | 2887 | #endif /* CONFIG_SVINTO_SIM */ |
2893 | 2888 | ||
2894 | if (!(info->flags & ASYNC_INITIALIZED)) | 2889 | if (!(info->port.flags & ASYNC_INITIALIZED)) |
2895 | return; | 2890 | return; |
2896 | 2891 | ||
2897 | #ifdef SERIAL_DEBUG_OPEN | 2892 | #ifdef SERIAL_DEBUG_OPEN |
@@ -2922,7 +2917,7 @@ shutdown(struct e100_serial * info) | |||
2922 | if (info->port.tty) | 2917 | if (info->port.tty) |
2923 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); | 2918 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2924 | 2919 | ||
2925 | info->flags &= ~ASYNC_INITIALIZED; | 2920 | info->port.flags &= ~ASYNC_INITIALIZED; |
2926 | local_irq_restore(flags); | 2921 | local_irq_restore(flags); |
2927 | } | 2922 | } |
2928 | 2923 | ||
@@ -2947,7 +2942,7 @@ change_speed(struct e100_serial *info) | |||
2947 | /* possibly, the tx/rx should be disabled first to do this safely */ | 2942 | /* possibly, the tx/rx should be disabled first to do this safely */ |
2948 | 2943 | ||
2949 | /* change baud-rate and write it to the hardware */ | 2944 | /* change baud-rate and write it to the hardware */ |
2950 | if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) { | 2945 | if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) { |
2951 | /* Special baudrate */ | 2946 | /* Special baudrate */ |
2952 | u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */ | 2947 | u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */ |
2953 | unsigned long alt_source = | 2948 | unsigned long alt_source = |
@@ -3397,7 +3392,7 @@ get_serial_info(struct e100_serial * info, | |||
3397 | tmp.line = info->line; | 3392 | tmp.line = info->line; |
3398 | tmp.port = (int)info->ioport; | 3393 | tmp.port = (int)info->ioport; |
3399 | tmp.irq = info->irq; | 3394 | tmp.irq = info->irq; |
3400 | tmp.flags = info->flags; | 3395 | tmp.flags = info->port.flags; |
3401 | tmp.baud_base = info->baud_base; | 3396 | tmp.baud_base = info->baud_base; |
3402 | tmp.close_delay = info->close_delay; | 3397 | tmp.close_delay = info->close_delay; |
3403 | tmp.closing_wait = info->closing_wait; | 3398 | tmp.closing_wait = info->closing_wait; |
@@ -3424,9 +3419,9 @@ set_serial_info(struct e100_serial *info, | |||
3424 | if ((new_serial.type != info->type) || | 3419 | if ((new_serial.type != info->type) || |
3425 | (new_serial.close_delay != info->close_delay) || | 3420 | (new_serial.close_delay != info->close_delay) || |
3426 | ((new_serial.flags & ~ASYNC_USR_MASK) != | 3421 | ((new_serial.flags & ~ASYNC_USR_MASK) != |
3427 | (info->flags & ~ASYNC_USR_MASK))) | 3422 | (info->port.flags & ~ASYNC_USR_MASK))) |
3428 | return -EPERM; | 3423 | return -EPERM; |
3429 | info->flags = ((info->flags & ~ASYNC_USR_MASK) | | 3424 | info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) | |
3430 | (new_serial.flags & ASYNC_USR_MASK)); | 3425 | (new_serial.flags & ASYNC_USR_MASK)); |
3431 | goto check_and_exit; | 3426 | goto check_and_exit; |
3432 | } | 3427 | } |
@@ -3440,16 +3435,16 @@ set_serial_info(struct e100_serial *info, | |||
3440 | */ | 3435 | */ |
3441 | 3436 | ||
3442 | info->baud_base = new_serial.baud_base; | 3437 | info->baud_base = new_serial.baud_base; |
3443 | info->flags = ((info->flags & ~ASYNC_FLAGS) | | 3438 | info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) | |
3444 | (new_serial.flags & ASYNC_FLAGS)); | 3439 | (new_serial.flags & ASYNC_FLAGS)); |
3445 | info->custom_divisor = new_serial.custom_divisor; | 3440 | info->custom_divisor = new_serial.custom_divisor; |
3446 | info->type = new_serial.type; | 3441 | info->type = new_serial.type; |
3447 | info->close_delay = new_serial.close_delay; | 3442 | info->close_delay = new_serial.close_delay; |
3448 | info->closing_wait = new_serial.closing_wait; | 3443 | info->closing_wait = new_serial.closing_wait; |
3449 | info->port.low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 3444 | info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
3450 | 3445 | ||
3451 | check_and_exit: | 3446 | check_and_exit: |
3452 | if (info->flags & ASYNC_INITIALIZED) { | 3447 | if (info->port.flags & ASYNC_INITIALIZED) { |
3453 | change_speed(info); | 3448 | change_speed(info); |
3454 | } else | 3449 | } else |
3455 | retval = startup(info); | 3450 | retval = startup(info); |
@@ -3789,12 +3784,12 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
3789 | local_irq_restore(flags); | 3784 | local_irq_restore(flags); |
3790 | return; | 3785 | return; |
3791 | } | 3786 | } |
3792 | info->flags |= ASYNC_CLOSING; | 3787 | info->port.flags |= ASYNC_CLOSING; |
3793 | /* | 3788 | /* |
3794 | * Save the termios structure, since this port may have | 3789 | * Save the termios structure, since this port may have |
3795 | * separate termios for callout and dialin. | 3790 | * separate termios for callout and dialin. |
3796 | */ | 3791 | */ |
3797 | if (info->flags & ASYNC_NORMAL_ACTIVE) | 3792 | if (info->port.flags & ASYNC_NORMAL_ACTIVE) |
3798 | info->normal_termios = tty->termios; | 3793 | info->normal_termios = tty->termios; |
3799 | /* | 3794 | /* |
3800 | * Now we wait for the transmit buffer to clear; and we notify | 3795 | * 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 | e100_disable_rx(info); | 3810 | e100_disable_rx(info); |
3816 | e100_disable_rx_irq(info); | 3811 | e100_disable_rx_irq(info); |
3817 | 3812 | ||
3818 | if (info->flags & ASYNC_INITIALIZED) { | 3813 | if (info->port.flags & ASYNC_INITIALIZED) { |
3819 | /* | 3814 | /* |
3820 | * Before we drop DTR, make sure the UART transmitter | 3815 | * Before we drop DTR, make sure the UART transmitter |
3821 | * has completely drained; this is especially | 3816 | * has completely drained; this is especially |
@@ -3836,7 +3831,7 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
3836 | schedule_timeout_interruptible(info->close_delay); | 3831 | schedule_timeout_interruptible(info->close_delay); |
3837 | wake_up_interruptible(&info->open_wait); | 3832 | wake_up_interruptible(&info->open_wait); |
3838 | } | 3833 | } |
3839 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 3834 | info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
3840 | wake_up_interruptible(&info->close_wait); | 3835 | wake_up_interruptible(&info->close_wait); |
3841 | local_irq_restore(flags); | 3836 | local_irq_restore(flags); |
3842 | 3837 | ||
@@ -3931,7 +3926,7 @@ rs_hangup(struct tty_struct *tty) | |||
3931 | shutdown(info); | 3926 | shutdown(info); |
3932 | info->event = 0; | 3927 | info->event = 0; |
3933 | info->count = 0; | 3928 | info->count = 0; |
3934 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 3929 | info->port.flags &= ~ASYNC_NORMAL_ACTIVE; |
3935 | info->port.tty = NULL; | 3930 | info->port.tty = NULL; |
3936 | wake_up_interruptible(&info->open_wait); | 3931 | wake_up_interruptible(&info->open_wait); |
3937 | } | 3932 | } |
@@ -3955,11 +3950,11 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3955 | * until it's done, and then try again. | 3950 | * until it's done, and then try again. |
3956 | */ | 3951 | */ |
3957 | if (tty_hung_up_p(filp) || | 3952 | if (tty_hung_up_p(filp) || |
3958 | (info->flags & ASYNC_CLOSING)) { | 3953 | (info->port.flags & ASYNC_CLOSING)) { |
3959 | wait_event_interruptible_tty(tty, info->close_wait, | 3954 | wait_event_interruptible_tty(tty, info->close_wait, |
3960 | !(info->flags & ASYNC_CLOSING)); | 3955 | !(info->port.flags & ASYNC_CLOSING)); |
3961 | #ifdef SERIAL_DO_RESTART | 3956 | #ifdef SERIAL_DO_RESTART |
3962 | if (info->flags & ASYNC_HUP_NOTIFY) | 3957 | if (info->port.flags & ASYNC_HUP_NOTIFY) |
3963 | return -EAGAIN; | 3958 | return -EAGAIN; |
3964 | else | 3959 | else |
3965 | return -ERESTARTSYS; | 3960 | return -ERESTARTSYS; |
@@ -3974,7 +3969,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
3974 | */ | 3969 | */ |
3975 | if ((filp->f_flags & O_NONBLOCK) || | 3970 | if ((filp->f_flags & O_NONBLOCK) || |
3976 | (tty->flags & (1 << TTY_IO_ERROR))) { | 3971 | (tty->flags & (1 << TTY_IO_ERROR))) { |
3977 | info->flags |= ASYNC_NORMAL_ACTIVE; | 3972 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
3978 | return 0; | 3973 | return 0; |
3979 | } | 3974 | } |
3980 | 3975 | ||
@@ -4010,9 +4005,9 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4010 | local_irq_restore(flags); | 4005 | local_irq_restore(flags); |
4011 | set_current_state(TASK_INTERRUPTIBLE); | 4006 | set_current_state(TASK_INTERRUPTIBLE); |
4012 | if (tty_hung_up_p(filp) || | 4007 | if (tty_hung_up_p(filp) || |
4013 | !(info->flags & ASYNC_INITIALIZED)) { | 4008 | !(info->port.flags & ASYNC_INITIALIZED)) { |
4014 | #ifdef SERIAL_DO_RESTART | 4009 | #ifdef SERIAL_DO_RESTART |
4015 | if (info->flags & ASYNC_HUP_NOTIFY) | 4010 | if (info->port.flags & ASYNC_HUP_NOTIFY) |
4016 | retval = -EAGAIN; | 4011 | retval = -EAGAIN; |
4017 | else | 4012 | else |
4018 | retval = -ERESTARTSYS; | 4013 | retval = -ERESTARTSYS; |
@@ -4021,7 +4016,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4021 | #endif | 4016 | #endif |
4022 | break; | 4017 | break; |
4023 | } | 4018 | } |
4024 | if (!(info->flags & ASYNC_CLOSING) && do_clocal) | 4019 | if (!(info->port.flags & ASYNC_CLOSING) && do_clocal) |
4025 | /* && (do_clocal || DCD_IS_ASSERTED) */ | 4020 | /* && (do_clocal || DCD_IS_ASSERTED) */ |
4026 | break; | 4021 | break; |
4027 | if (signal_pending(current)) { | 4022 | if (signal_pending(current)) { |
@@ -4047,7 +4042,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, | |||
4047 | #endif | 4042 | #endif |
4048 | if (retval) | 4043 | if (retval) |
4049 | return retval; | 4044 | return retval; |
4050 | info->flags |= ASYNC_NORMAL_ACTIVE; | 4045 | info->port.flags |= ASYNC_NORMAL_ACTIVE; |
4051 | return 0; | 4046 | return 0; |
4052 | } | 4047 | } |
4053 | 4048 | ||
@@ -4088,17 +4083,17 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4088 | tty->driver_data = info; | 4083 | tty->driver_data = info; |
4089 | info->port.tty = tty; | 4084 | info->port.tty = tty; |
4090 | 4085 | ||
4091 | info->port.low_latency = !!(info->flags & ASYNC_LOW_LATENCY); | 4086 | info->port.low_latency = !!(info->port.flags & ASYNC_LOW_LATENCY); |
4092 | 4087 | ||
4093 | /* | 4088 | /* |
4094 | * If the port is in the middle of closing, bail out now | 4089 | * If the port is in the middle of closing, bail out now |
4095 | */ | 4090 | */ |
4096 | if (tty_hung_up_p(filp) || | 4091 | if (tty_hung_up_p(filp) || |
4097 | (info->flags & ASYNC_CLOSING)) { | 4092 | (info->port.flags & ASYNC_CLOSING)) { |
4098 | wait_event_interruptible_tty(tty, info->close_wait, | 4093 | wait_event_interruptible_tty(tty, info->close_wait, |
4099 | !(info->flags & ASYNC_CLOSING)); | 4094 | !(info->port.flags & ASYNC_CLOSING)); |
4100 | #ifdef SERIAL_DO_RESTART | 4095 | #ifdef SERIAL_DO_RESTART |
4101 | return ((info->flags & ASYNC_HUP_NOTIFY) ? | 4096 | return ((info->port.flags & ASYNC_HUP_NOTIFY) ? |
4102 | -EAGAIN : -ERESTARTSYS); | 4097 | -EAGAIN : -ERESTARTSYS); |
4103 | #else | 4098 | #else |
4104 | return -EAGAIN; | 4099 | return -EAGAIN; |
@@ -4198,7 +4193,7 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4198 | return retval; | 4193 | return retval; |
4199 | } | 4194 | } |
4200 | 4195 | ||
4201 | if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) { | 4196 | if ((info->count == 1) && (info->port.flags & ASYNC_SPLIT_TERMIOS)) { |
4202 | tty->termios = info->normal_termios; | 4197 | tty->termios = info->normal_termios; |
4203 | change_speed(info); | 4198 | change_speed(info); |
4204 | } | 4199 | } |
@@ -4447,7 +4442,6 @@ static int __init rs_init(void) | |||
4447 | info->forced_eop = 0; | 4442 | info->forced_eop = 0; |
4448 | info->baud_base = DEF_BAUD_BASE; | 4443 | info->baud_base = DEF_BAUD_BASE; |
4449 | info->custom_divisor = 0; | 4444 | info->custom_divisor = 0; |
4450 | info->flags = 0; | ||
4451 | info->close_delay = 5*HZ/10; | 4445 | info->close_delay = 5*HZ/10; |
4452 | info->closing_wait = 30*HZ; | 4446 | info->closing_wait = 30*HZ; |
4453 | info->x_char = 0; | 4447 | info->x_char = 0; |