diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2013-06-15 09:36:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-23 19:47:07 -0400 |
commit | 1fc359fc3ea72314cc3ebdfa94c60e020c152cd2 (patch) | |
tree | 302ccb5a8cd9dee3c5affe1407e1413b66e8a207 /drivers/tty/tty_buffer.c | |
parent | f0f947c124e05ec977019b974b12dfe171dd7148 (diff) |
tty: Compute flip buffer ptrs
The char_buf_ptr and flag_buf_ptr values are trivially derived from
the .data field offset; compute values as needed.
Fixes a long-standing type-mismatch with the char and flag ptrs.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_buffer.c')
-rw-r--r-- | drivers/tty/tty_buffer.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index ff1b2e37c3ca..170674cb68fc 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -71,8 +71,6 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size) | |||
71 | p->next = NULL; | 71 | p->next = NULL; |
72 | p->commit = 0; | 72 | p->commit = 0; |
73 | p->read = 0; | 73 | p->read = 0; |
74 | p->char_buf_ptr = (char *)(p->data); | ||
75 | p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size; | ||
76 | port->buf.memory_used += size; | 74 | port->buf.memory_used += size; |
77 | return p; | 75 | return p; |
78 | } | 76 | } |
@@ -265,8 +263,8 @@ int tty_insert_flip_string_fixed_flag(struct tty_port *port, | |||
265 | if (unlikely(space == 0)) { | 263 | if (unlikely(space == 0)) { |
266 | break; | 264 | break; |
267 | } | 265 | } |
268 | memcpy(tb->char_buf_ptr + tb->used, chars, space); | 266 | memcpy(char_buf_ptr(tb, tb->used), chars, space); |
269 | memset(tb->flag_buf_ptr + tb->used, flag, space); | 267 | memset(flag_buf_ptr(tb, tb->used), flag, space); |
270 | tb->used += space; | 268 | tb->used += space; |
271 | copied += space; | 269 | copied += space; |
272 | chars += space; | 270 | chars += space; |
@@ -303,8 +301,8 @@ int tty_insert_flip_string_flags(struct tty_port *port, | |||
303 | if (unlikely(space == 0)) { | 301 | if (unlikely(space == 0)) { |
304 | break; | 302 | break; |
305 | } | 303 | } |
306 | memcpy(tb->char_buf_ptr + tb->used, chars, space); | 304 | memcpy(char_buf_ptr(tb, tb->used), chars, space); |
307 | memcpy(tb->flag_buf_ptr + tb->used, flags, space); | 305 | memcpy(flag_buf_ptr(tb, tb->used), flags, space); |
308 | tb->used += space; | 306 | tb->used += space; |
309 | copied += space; | 307 | copied += space; |
310 | chars += space; | 308 | chars += space; |
@@ -364,8 +362,8 @@ int tty_prepare_flip_string(struct tty_port *port, unsigned char **chars, | |||
364 | int space = tty_buffer_request_room(port, size); | 362 | int space = tty_buffer_request_room(port, size); |
365 | if (likely(space)) { | 363 | if (likely(space)) { |
366 | struct tty_buffer *tb = port->buf.tail; | 364 | struct tty_buffer *tb = port->buf.tail; |
367 | *chars = tb->char_buf_ptr + tb->used; | 365 | *chars = char_buf_ptr(tb, tb->used); |
368 | memset(tb->flag_buf_ptr + tb->used, TTY_NORMAL, space); | 366 | memset(flag_buf_ptr(tb, tb->used), TTY_NORMAL, space); |
369 | tb->used += space; | 367 | tb->used += space; |
370 | } | 368 | } |
371 | return space; | 369 | return space; |
@@ -394,8 +392,8 @@ int tty_prepare_flip_string_flags(struct tty_port *port, | |||
394 | int space = tty_buffer_request_room(port, size); | 392 | int space = tty_buffer_request_room(port, size); |
395 | if (likely(space)) { | 393 | if (likely(space)) { |
396 | struct tty_buffer *tb = port->buf.tail; | 394 | struct tty_buffer *tb = port->buf.tail; |
397 | *chars = tb->char_buf_ptr + tb->used; | 395 | *chars = char_buf_ptr(tb, tb->used); |
398 | *flags = tb->flag_buf_ptr + tb->used; | 396 | *flags = flag_buf_ptr(tb, tb->used); |
399 | tb->used += space; | 397 | tb->used += space; |
400 | } | 398 | } |
401 | return space; | 399 | return space; |
@@ -407,8 +405,8 @@ static int | |||
407 | receive_buf(struct tty_struct *tty, struct tty_buffer *head, int count) | 405 | receive_buf(struct tty_struct *tty, struct tty_buffer *head, int count) |
408 | { | 406 | { |
409 | struct tty_ldisc *disc = tty->ldisc; | 407 | struct tty_ldisc *disc = tty->ldisc; |
410 | char *p = head->char_buf_ptr + head->read; | 408 | unsigned char *p = char_buf_ptr(head, head->read); |
411 | unsigned char *f = head->flag_buf_ptr + head->read; | 409 | char *f = flag_buf_ptr(head, head->read); |
412 | 410 | ||
413 | if (disc->ops->receive_buf2) | 411 | if (disc->ops->receive_buf2) |
414 | count = disc->ops->receive_buf2(tty, p, f, count); | 412 | count = disc->ops->receive_buf2(tty, p, f, count); |