diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-04-30 03:53:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:45 -0400 |
commit | 978e595f88a1fba5869aa42a4af4fba36f33ecac (patch) | |
tree | 60848f49949c5b7b518621ee36cdc6d500244539 /drivers/serial/crisv10.c | |
parent | ac0e4b7d319bf284bb64bc7e1c051417386b34a4 (diff) |
tty/serial: lay the foundations for the next set of reworks
- Stop drivers calling their own flush method indirectly, it obfuscates code
and it will change soon anyway
- A few more lock_kernel paths temporarily needed in some driver internal
waiting code
- Remove private put_char method that does a write call for one char - we
have that anyway
- Most but not yet all of the termios copy under lock fixing (some has other
dependencies to follow)
- Note a few locking bugs in drivers found in the process
- Kill remaining [ab]users of TIOCG/SSOFTCAR in the driver, these must go to
fix the termios locking
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial/crisv10.c')
-rw-r--r-- | drivers/serial/crisv10.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 88e7c1d5b919..8b9af73c1d59 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -3581,8 +3581,9 @@ rs_tiocmset(struct tty_struct *tty, struct file *file, | |||
3581 | unsigned int set, unsigned int clear) | 3581 | unsigned int set, unsigned int clear) |
3582 | { | 3582 | { |
3583 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | 3583 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
3584 | unsigned long flags; | ||
3584 | 3585 | ||
3585 | lock_kernel(); | 3586 | local_irq_save(flags); |
3586 | 3587 | ||
3587 | if (clear & TIOCM_RTS) | 3588 | if (clear & TIOCM_RTS) |
3588 | e100_rts(info, 0); | 3589 | e100_rts(info, 0); |
@@ -3604,7 +3605,7 @@ rs_tiocmset(struct tty_struct *tty, struct file *file, | |||
3604 | if (set & TIOCM_CD) | 3605 | if (set & TIOCM_CD) |
3605 | e100_cd_out(info, 1); | 3606 | e100_cd_out(info, 1); |
3606 | 3607 | ||
3607 | unlock_kernel(); | 3608 | local_irq_restore(flags); |
3608 | return 0; | 3609 | return 0; |
3609 | } | 3610 | } |
3610 | 3611 | ||
@@ -3613,8 +3614,10 @@ rs_tiocmget(struct tty_struct *tty, struct file *file) | |||
3613 | { | 3614 | { |
3614 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | 3615 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
3615 | unsigned int result; | 3616 | unsigned int result; |
3617 | unsigned long flags; | ||
3618 | |||
3619 | local_irq_save(flags); | ||
3616 | 3620 | ||
3617 | lock_kernel(); | ||
3618 | result = | 3621 | result = |
3619 | (!E100_RTS_GET(info) ? TIOCM_RTS : 0) | 3622 | (!E100_RTS_GET(info) ? TIOCM_RTS : 0) |
3620 | | (!E100_DTR_GET(info) ? TIOCM_DTR : 0) | 3623 | | (!E100_DTR_GET(info) ? TIOCM_DTR : 0) |
@@ -3623,7 +3626,7 @@ rs_tiocmget(struct tty_struct *tty, struct file *file) | |||
3623 | | (!E100_CD_GET(info) ? TIOCM_CAR : 0) | 3626 | | (!E100_CD_GET(info) ? TIOCM_CAR : 0) |
3624 | | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); | 3627 | | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); |
3625 | 3628 | ||
3626 | unlock_kernel(); | 3629 | local_irq_restore(flags); |
3627 | 3630 | ||
3628 | #ifdef SERIAL_DEBUG_IO | 3631 | #ifdef SERIAL_DEBUG_IO |
3629 | printk(KERN_DEBUG "ser%i: modem state: %i 0x%08X\n", | 3632 | printk(KERN_DEBUG "ser%i: modem state: %i 0x%08X\n", |
@@ -3702,10 +3705,6 @@ rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
3702 | { | 3705 | { |
3703 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | 3706 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
3704 | 3707 | ||
3705 | if (tty->termios->c_cflag == old_termios->c_cflag && | ||
3706 | tty->termios->c_iflag == old_termios->c_iflag) | ||
3707 | return; | ||
3708 | |||
3709 | change_speed(info); | 3708 | change_speed(info); |
3710 | 3709 | ||
3711 | /* Handle turning off CRTSCTS */ | 3710 | /* Handle turning off CRTSCTS */ |
@@ -3808,10 +3807,8 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
3808 | #endif | 3807 | #endif |
3809 | 3808 | ||
3810 | shutdown(info); | 3809 | shutdown(info); |
3811 | if (tty->driver->flush_buffer) | 3810 | rs_flush_buffer(tty); |
3812 | tty->driver->flush_buffer(tty); | 3811 | tty_ldisc_flush_buffer(tty); |
3813 | if (tty->ldisc.flush_buffer) | ||
3814 | tty->ldisc.flush_buffer(tty); | ||
3815 | tty->closing = 0; | 3812 | tty->closing = 0; |
3816 | info->event = 0; | 3813 | info->event = 0; |
3817 | info->tty = 0; | 3814 | info->tty = 0; |
@@ -3885,6 +3882,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) | |||
3885 | * Check R_DMA_CHx_STATUS bit 0-6=number of available bytes in FIFO | 3882 | * Check R_DMA_CHx_STATUS bit 0-6=number of available bytes in FIFO |
3886 | * R_DMA_CHx_HWSW bit 31-16=nbr of bytes left in DMA buffer (0=64k) | 3883 | * R_DMA_CHx_HWSW bit 31-16=nbr of bytes left in DMA buffer (0=64k) |
3887 | */ | 3884 | */ |
3885 | lock_kernel(); | ||
3888 | orig_jiffies = jiffies; | 3886 | orig_jiffies = jiffies; |
3889 | while (info->xmit.head != info->xmit.tail || /* More in send queue */ | 3887 | while (info->xmit.head != info->xmit.tail || /* More in send queue */ |
3890 | (*info->ostatusadr & 0x007f) || /* more in FIFO */ | 3888 | (*info->ostatusadr & 0x007f) || /* more in FIFO */ |
@@ -3901,6 +3899,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) | |||
3901 | curr_time_usec - info->last_tx_active_usec; | 3899 | curr_time_usec - info->last_tx_active_usec; |
3902 | } | 3900 | } |
3903 | set_current_state(TASK_RUNNING); | 3901 | set_current_state(TASK_RUNNING); |
3902 | unlock_kernel(); | ||
3904 | } | 3903 | } |
3905 | 3904 | ||
3906 | /* | 3905 | /* |