diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-01-03 15:53:02 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-15 22:17:29 -0800 |
commit | 2f69335710884ae6112fc8196ebe29b5cda7b79b (patch) | |
tree | c97bec97e703faace437235d3bcbbf80c078ad21 /drivers/tty | |
parent | 227434f8986c3827a1faedd1feb437acd6285315 (diff) |
TTY: convert more flipping functions
Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty pointer in
many call sites. Only tty_port will be needed and hence no more
tty_port_tty_get calls in those paths.
Now 4 string flipping ones are on turn:
* tty_insert_flip_string_flags
* tty_insert_flip_string_fixed_flag
* tty_prepare_flip_string
* tty_prepare_flip_string_flags
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/cyclades.c | 2 | ||||
-rw-r--r-- | drivers/tty/isicom.c | 4 | ||||
-rw-r--r-- | drivers/tty/moxa.c | 4 | ||||
-rw-r--r-- | drivers/tty/rocket.c | 2 | ||||
-rw-r--r-- | drivers/tty/serial/msm_smd_tty.c | 2 | ||||
-rw-r--r-- | drivers/tty/tty_buffer.c | 32 |
6 files changed, 23 insertions, 23 deletions
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c index b85acc74eb0d..0b7573dbf439 100644 --- a/drivers/tty/cyclades.c +++ b/drivers/tty/cyclades.c @@ -968,7 +968,7 @@ static void cyz_handle_rx(struct cyclades_port *info, struct tty_struct *tty) for performance, but because of buffer boundaries, there may be several steps to the operation */ while (1) { - len = tty_prepare_flip_string(tty, &buf, + len = tty_prepare_flip_string(port, &buf, char_count); if (!len) break; diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c index 3205b2e9090b..e9fc15f00f48 100644 --- a/drivers/tty/isicom.c +++ b/drivers/tty/isicom.c @@ -650,8 +650,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) break; } } else { /* Data Packet */ - - count = tty_prepare_flip_string(tty, &rp, byte_count & ~1); + count = tty_prepare_flip_string(&port->port, &rp, + byte_count & ~1); pr_debug("%s: Can rx %d of %d bytes.\n", __func__, count, byte_count); word_count = count >> 1; diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c index f9d28503bdec..fcaac4870d5f 100644 --- a/drivers/tty/moxa.c +++ b/drivers/tty/moxa.c @@ -1966,7 +1966,7 @@ static int MoxaPortReadData(struct moxa_port *port) ofs = baseAddr + DynPage_addr + bufhead + head; len = (tail >= head) ? (tail - head) : (rx_mask + 1 - head); - len = tty_prepare_flip_string(tty, &dst, + len = tty_prepare_flip_string(&port->port, &dst, min(len, count)); memcpy_fromio(dst, ofs, len); head = (head + len) & rx_mask; @@ -1978,7 +1978,7 @@ static int MoxaPortReadData(struct moxa_port *port) while (count > 0) { writew(pageno, baseAddr + Control_reg); ofs = baseAddr + DynPage_addr + pageofs; - len = tty_prepare_flip_string(tty, &dst, + len = tty_prepare_flip_string(&port->port, &dst, min(Page_size - pageofs, count)); memcpy_fromio(dst, ofs, len); diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index e42009a00529..77d7bc94afaa 100644 --- a/drivers/tty/rocket.c +++ b/drivers/tty/rocket.c @@ -399,7 +399,7 @@ static void rp_do_receive(struct r_port *info, * characters at time by doing repeated word IO * transfer. */ - space = tty_prepare_flip_string(tty, &cbuf, ToRecv); + space = tty_prepare_flip_string(&info->port, &cbuf, ToRecv); if (space < ToRecv) { #ifdef ROCKET_DEBUG_RECEIVE printk(KERN_INFO "rp_do_receive:insufficient space ToRecv=%d space=%d\n", ToRecv, space); diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c index 925d1fa153db..b43b4ec39269 100644 --- a/drivers/tty/serial/msm_smd_tty.c +++ b/drivers/tty/serial/msm_smd_tty.c @@ -70,7 +70,7 @@ static void smd_tty_notify(void *priv, unsigned event) if (avail == 0) break; - avail = tty_prepare_flip_string(tty, &ptr, avail); + avail = tty_prepare_flip_string(&info->port, &ptr, avail); if (smd_read(info->ch, ptr, avail) != avail) { /* shouldn't be possible since we're in interrupt diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index f897332fb4ee..31873e42602a 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -257,7 +257,7 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room); /** * tty_insert_flip_string_fixed_flag - Add characters to the tty buffer - * @tty: tty structure + * @port: tty port * @chars: characters * @flag: flag value for each character * @size: size @@ -268,10 +268,10 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room); * Locking: Called functions may take port->buf.lock */ -int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, +int tty_insert_flip_string_fixed_flag(struct tty_port *port, const unsigned char *chars, char flag, size_t size) { - struct tty_bufhead *buf = &tty->port->buf; + struct tty_bufhead *buf = &port->buf; int copied = 0; do { int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE); @@ -280,7 +280,7 @@ int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, struct tty_buffer *tb; spin_lock_irqsave(&buf->lock, flags); - space = __tty_buffer_request_room(tty->port, goal); + space = __tty_buffer_request_room(port, goal); tb = buf->tail; /* If there is no space then tb may be NULL */ if (unlikely(space == 0)) { @@ -302,7 +302,7 @@ EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag); /** * tty_insert_flip_string_flags - Add characters to the tty buffer - * @tty: tty structure + * @port: tty port * @chars: characters * @flags: flag bytes * @size: size @@ -314,10 +314,10 @@ EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag); * Locking: Called functions may take port->buf.lock */ -int tty_insert_flip_string_flags(struct tty_struct *tty, +int tty_insert_flip_string_flags(struct tty_port *port, const unsigned char *chars, const char *flags, size_t size) { - struct tty_bufhead *buf = &tty->port->buf; + struct tty_bufhead *buf = &port->buf; int copied = 0; do { int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE); @@ -326,7 +326,7 @@ int tty_insert_flip_string_flags(struct tty_struct *tty, struct tty_buffer *tb; spin_lock_irqsave(&buf->lock, __flags); - space = __tty_buffer_request_room(tty->port, goal); + space = __tty_buffer_request_room(port, goal); tb = buf->tail; /* If there is no space then tb may be NULL */ if (unlikely(space == 0)) { @@ -376,7 +376,7 @@ EXPORT_SYMBOL(tty_schedule_flip); /** * tty_prepare_flip_string - make room for characters - * @tty: tty + * @port: tty port * @chars: return pointer for character write area * @size: desired size * @@ -389,16 +389,16 @@ EXPORT_SYMBOL(tty_schedule_flip); * Locking: May call functions taking port->buf.lock */ -int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, +int tty_prepare_flip_string(struct tty_port *port, unsigned char **chars, size_t size) { - struct tty_bufhead *buf = &tty->port->buf; + struct tty_bufhead *buf = &port->buf; int space; unsigned long flags; struct tty_buffer *tb; spin_lock_irqsave(&buf->lock, flags); - space = __tty_buffer_request_room(tty->port, size); + space = __tty_buffer_request_room(port, size); tb = buf->tail; if (likely(space)) { @@ -413,7 +413,7 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string); /** * tty_prepare_flip_string_flags - make room for characters - * @tty: tty + * @port: tty port * @chars: return pointer for character write area * @flags: return pointer for status flag write area * @size: desired size @@ -427,16 +427,16 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string); * Locking: May call functions taking port->buf.lock */ -int tty_prepare_flip_string_flags(struct tty_struct *tty, +int tty_prepare_flip_string_flags(struct tty_port *port, unsigned char **chars, char **flags, size_t size) { - struct tty_bufhead *buf = &tty->port->buf; + struct tty_bufhead *buf = &port->buf; int space; unsigned long __flags; struct tty_buffer *tb; spin_lock_irqsave(&buf->lock, __flags); - space = __tty_buffer_request_room(tty->port, size); + space = __tty_buffer_request_room(port, size); tb = buf->tail; if (likely(space)) { |