mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
f0f947c124
commit
1fc359fc3e
3 changed files with 22 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue