Commit ce71b0ff authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

Char: cyclades, fix blockmove

tty has no longer flip buffers accessible externally. Fix it by moving the
code to the tty_*flip* helpers.
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2c7fea99
...@@ -1560,7 +1560,7 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, ...@@ -1560,7 +1560,7 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
int char_count; int char_count;
int len; int len;
#ifdef BLOCKMOVE #ifdef BLOCKMOVE
int small_count; unsigned char *buf;
#else #else
char data; char data;
#endif #endif
...@@ -1596,25 +1596,23 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, ...@@ -1596,25 +1596,23 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
/* we'd like to use memcpy(t, f, n) and memset(s, c, count) /* we'd like to use memcpy(t, f, n) and memset(s, c, count)
for performance, but because of buffer boundaries, there for performance, but because of buffer boundaries, there
may be several steps to the operation */ may be several steps to the operation */
while (0 < (small_count = min_t(unsigned int, while (1) {
rx_bufsize - new_rx_get, len = tty_prepare_flip_string(tty, &buf,
min_t(unsigned int, TTY_FLIPBUF_SIZE - char_count);
tty->flip.count, char_count)))){ if (!len)
memcpy_fromio(tty->flip.char_buf_ptr, break;
(char *)(cinfo->base_addr + rx_bufaddr +
new_rx_get),
small_count);
tty->flip.char_buf_ptr += small_count; len = min_t(unsigned int, min(len, char_count),
memset(tty->flip.flag_buf_ptr, TTY_NORMAL, rx_bufsize - new_rx_get);
small_count);
tty->flip.flag_buf_ptr += small_count; memcpy_fromio(buf, cinfo->base_addr +
new_rx_get = (new_rx_get + small_count) & rx_bufaddr + new_rx_get, len);
new_rx_get = (new_rx_get + len) &
(rx_bufsize - 1); (rx_bufsize - 1);
char_count -= small_count; char_count -= len;
info->icount.rx += small_count; info->icount.rx += len;
info->idle_stats.recv_bytes += small_count; info->idle_stats.recv_bytes += len;
tty->flip.count += small_count;
} }
#else #else
len = tty_buffer_request_room(tty, char_count); len = tty_buffer_request_room(tty, char_count);
......
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