diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 13:41:04 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 13:41:04 -0800 |
commit | 21eaab6d19ed43e82ed39c8deb7f192134fb4a0e (patch) | |
tree | d995205afdcb7f47462bcd28067dc0c4ab0b7b02 /drivers/staging/fwserial | |
parent | 74e1a2a39355b2d3ae8c60c78d8add162c6d7183 (diff) | |
parent | 9e17df37d710f8998e9cb10a548304fe33d4a5c2 (diff) | |
download | blackbird-op-linux-21eaab6d19ed43e82ed39c8deb7f192134fb4a0e.tar.gz blackbird-op-linux-21eaab6d19ed43e82ed39c8deb7f192134fb4a0e.zip |
Merge tag 'tty-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial patches from Greg Kroah-Hartman:
"Here's the big tty/serial driver patches for 3.9-rc1.
More tty port rework and fixes from Jiri here, as well as lots of
individual serial driver updates and fixes.
All of these have been in the linux-next tree for a while."
* tag 'tty-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (140 commits)
tty: mxser: improve error handling in mxser_probe() and mxser_module_init()
serial: imx: fix uninitialized variable warning
serial: tegra: assume CONFIG_OF
TTY: do not update atime/mtime on read/write
lguest: select CONFIG_TTY to build properly.
ARM defconfigs: add missing inclusions of linux/platform_device.h
fb/exynos: include platform_device.h
ARM: sa1100/assabet: include platform_device.h directly
serial: imx: Fix recursive locking bug
pps: Fix build breakage from decoupling pps from tty
tty: Remove ancient hardpps()
pps: Additional cleanups in uart_handle_dcd_change
pps: Move timestamp read into PPS code proper
pps: Don't crash the machine when exiting will do
pps: Fix a use-after free bug when unregistering a source.
pps: Use pps_lookup_dev to reduce ldisc coupling
pps: Add pps_lookup_dev() function
tty: serial: uartlite: Support uartlite on big and little endian systems
tty: serial: uartlite: Fix sparse and checkpatch warnings
serial/arc-uart: Miscll DT related updates (Grant's review comments)
...
Fix up trivial conflicts, mostly just due to the TTY config option
clashing with the EXPERIMENTAL removal.
Diffstat (limited to 'drivers/staging/fwserial')
-rw-r--r-- | drivers/staging/fwserial/Kconfig | 2 | ||||
-rw-r--r-- | drivers/staging/fwserial/fwserial.c | 51 |
2 files changed, 22 insertions, 31 deletions
diff --git a/drivers/staging/fwserial/Kconfig b/drivers/staging/fwserial/Kconfig index b2f8331e4acf..a0812d99136f 100644 --- a/drivers/staging/fwserial/Kconfig +++ b/drivers/staging/fwserial/Kconfig @@ -1,6 +1,6 @@ config FIREWIRE_SERIAL tristate "TTY over Firewire" - depends on FIREWIRE + depends on FIREWIRE && TTY help This enables TTY over IEEE 1394, providing high-speed serial connectivity to cabled peers. This driver implements a diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index 8859c75f16fa..5a6fb44f38a8 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -500,16 +500,11 @@ static void fwtty_do_hangup(struct work_struct *work) static void fwtty_emit_breaks(struct work_struct *work) { struct fwtty_port *port = to_port(to_delayed_work(work), emit_breaks); - struct tty_struct *tty; static const char buf[16]; unsigned long now = jiffies; unsigned long elapsed = now - port->break_last; int n, t, c, brk = 0; - tty = tty_port_tty_get(&port->port); - if (!tty) - return; - /* generate breaks at the line rate (but at least 1) */ n = (elapsed * port->cps) / HZ + 1; port->break_last = now; @@ -518,15 +513,14 @@ static void fwtty_emit_breaks(struct work_struct *work) while (n) { t = min(n, 16); - c = tty_insert_flip_string_fixed_flag(tty, buf, TTY_BREAK, t); + c = tty_insert_flip_string_fixed_flag(&port->port, buf, + TTY_BREAK, t); n -= c; brk += c; if (c < t) break; } - tty_flip_buffer_push(tty); - - tty_kref_put(tty); + tty_flip_buffer_push(&port->port); if (port->mstatus & (UART_LSR_BI << 24)) schedule_delayed_work(&port->emit_breaks, FREQ_BREAKS); @@ -540,13 +534,9 @@ static void fwtty_pushrx(struct work_struct *work) struct buffered_rx *buf, *next; int n, c = 0; - tty = tty_port_tty_get(&port->port); - if (!tty) - return; - spin_lock_bh(&port->lock); list_for_each_entry_safe(buf, next, &port->buf_list, list) { - n = tty_insert_flip_string_fixed_flag(tty, buf->data, + n = tty_insert_flip_string_fixed_flag(&port->port, buf->data, TTY_NORMAL, buf->n); c += n; port->buffered -= n; @@ -555,7 +545,11 @@ static void fwtty_pushrx(struct work_struct *work) memmove(buf->data, buf->data + n, buf->n - n); buf->n -= n; } - __fwtty_throttle(port, tty); + tty = tty_port_tty_get(&port->port); + if (tty) { + __fwtty_throttle(port, tty); + tty_kref_put(tty); + } break; } else { list_del(&buf->list); @@ -563,13 +557,11 @@ static void fwtty_pushrx(struct work_struct *work) } } if (c > 0) - tty_flip_buffer_push(tty); + tty_flip_buffer_push(&port->port); if (list_empty(&port->buf_list)) clear_bit(BUFFERING_RX, &port->flags); spin_unlock_bh(&port->lock); - - tty_kref_put(tty); } static int fwtty_buffer_rx(struct fwtty_port *port, unsigned char *d, size_t n) @@ -607,10 +599,6 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len) unsigned lsr; int err = 0; - tty = tty_port_tty_get(&port->port); - if (!tty) - return -ENOENT; - fwtty_dbg(port, "%d", n); profile_size_distrib(port->stats.reads, n); @@ -630,7 +618,7 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len) lsr &= port->status_mask; if (lsr & ~port->ignore_mask & UART_LSR_OE) { - if (!tty_insert_flip_char(tty, 0, TTY_OVERRUN)) { + if (!tty_insert_flip_char(&port->port, 0, TTY_OVERRUN)) { err = -EIO; goto out; } @@ -644,18 +632,23 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len) } if (!test_bit(BUFFERING_RX, &port->flags)) { - c = tty_insert_flip_string_fixed_flag(tty, data, TTY_NORMAL, n); + c = tty_insert_flip_string_fixed_flag(&port->port, data, + TTY_NORMAL, n); if (c > 0) - tty_flip_buffer_push(tty); + tty_flip_buffer_push(&port->port); n -= c; if (n) { /* start buffering and throttling */ n -= fwtty_buffer_rx(port, &data[c], n); - spin_lock_bh(&port->lock); - __fwtty_throttle(port, tty); - spin_unlock_bh(&port->lock); + tty = tty_port_tty_get(&port->port); + if (tty) { + spin_lock_bh(&port->lock); + __fwtty_throttle(port, tty); + spin_unlock_bh(&port->lock); + tty_kref_put(tty); + } } } else n -= fwtty_buffer_rx(port, data, n); @@ -666,8 +659,6 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len) } out: - tty_kref_put(tty); - port->icount.rx += len; port->stats.lost += n; return err; |