summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/tty.h12
-rw-r--r--include/linux/tty_flip.h4
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 @@
struct tty_buffer {
struct tty_buffer *next;
- char *char_buf_ptr;
- unsigned char *flag_buf_ptr;
int used;
int size;
int commit;
@@ -41,6 +39,16 @@ struct tty_buffer {
unsigned long data[0];
};
+static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs)
+{
+ return ((unsigned char *)b->data) + ofs;
+}
+
+static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs)
+{
+ return (char *)char_buf_ptr(b, ofs) + b->size;
+}
+
/*
* We default to dicing tty buffer allocations to this many characters
* 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,
{
struct tty_buffer *tb = port->buf.tail;
if (tb && tb->used < tb->size) {
- tb->flag_buf_ptr[tb->used] = flag;
- tb->char_buf_ptr[tb->used++] = ch;
+ *flag_buf_ptr(tb, tb->used) = flag;
+ *char_buf_ptr(tb, tb->used++) = ch;
return 1;
}
return tty_insert_flip_string_flags(port, &ch, &flag, 1);