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 /include/linux | |
| 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 'include/linux')
| -rw-r--r-- | include/linux/tty.h | 12 | ||||
| -rw-r--r-- | include/linux/tty_flip.h | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index 57a70d1d0412..87bbaa31ebf5 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -31,8 +31,6 @@ | |||
| 31 | 31 | ||
| 32 | struct tty_buffer { | 32 | struct tty_buffer { |
| 33 | struct tty_buffer *next; | 33 | struct tty_buffer *next; |
| 34 | char *char_buf_ptr; | ||
| 35 | unsigned char *flag_buf_ptr; | ||
| 36 | int used; | 34 | int used; |
| 37 | int size; | 35 | int size; |
| 38 | int commit; | 36 | int commit; |
| @@ -41,6 +39,16 @@ struct tty_buffer { | |||
| 41 | unsigned long data[0]; | 39 | unsigned long data[0]; |
| 42 | }; | 40 | }; |
| 43 | 41 | ||
| 42 | static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs) | ||
| 43 | { | ||
| 44 | return ((unsigned char *)b->data) + ofs; | ||
| 45 | } | ||
| 46 | |||
| 47 | static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs) | ||
| 48 | { | ||
| 49 | return (char *)char_buf_ptr(b, ofs) + b->size; | ||
| 50 | } | ||
| 51 | |||
| 44 | /* | 52 | /* |
| 45 | * We default to dicing tty buffer allocations to this many characters | 53 | * We default to dicing tty buffer allocations to this many characters |
| 46 | * in order to avoid multiple page allocations. We know the size of | 54 | * in order to avoid multiple page allocations. We know the size of |
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index e0f252633b47..ad0303994c32 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h | |||
| @@ -18,8 +18,8 @@ static inline int tty_insert_flip_char(struct tty_port *port, | |||
| 18 | { | 18 | { |
| 19 | struct tty_buffer *tb = port->buf.tail; | 19 | struct tty_buffer *tb = port->buf.tail; |
| 20 | if (tb && tb->used < tb->size) { | 20 | if (tb && tb->used < tb->size) { |
| 21 | tb->flag_buf_ptr[tb->used] = flag; | 21 | *flag_buf_ptr(tb, tb->used) = flag; |
| 22 | tb->char_buf_ptr[tb->used++] = ch; | 22 | *char_buf_ptr(tb, tb->used++) = ch; |
| 23 | return 1; | 23 | return 1; |
| 24 | } | 24 | } |
| 25 | return tty_insert_flip_string_flags(port, &ch, &flag, 1); | 25 | return tty_insert_flip_string_flags(port, &ch, &flag, 1); |
