diff options
author | Alan Cox <alan@linux.intel.com> | 2009-06-11 08:04:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-11 11:51:02 -0400 |
commit | c481c707fe4b07783d9a2499a9bbbb94497e9b18 (patch) | |
tree | 27f4d137c4e3896733b5001c14feeb049ae7cc4d /drivers/char | |
parent | aba6593bf77371e71331ba76dacc98b47760cba3 (diff) |
tty: remove buffer special casing
Long long ago a 4K kmalloc allocated two pages so the tty layer used the
page allocator, except on some machines where the page size was huge. This was
removed from the core tty layer with the tty buffer re-implementation but not
from tty_audit or the n_tty ldisc.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/n_tty.c | 11 | ||||
-rw-r--r-- | drivers/char/tty_audit.c | 10 |
2 files changed, 4 insertions, 17 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index f6f0e4ec2b51..b4b12b4f0ac4 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -76,19 +76,12 @@ | |||
76 | static inline unsigned char *alloc_buf(void) | 76 | static inline unsigned char *alloc_buf(void) |
77 | { | 77 | { |
78 | gfp_t prio = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; | 78 | gfp_t prio = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; |
79 | 79 | return kmalloc(N_TTY_BUF_SIZE, prio); | |
80 | if (PAGE_SIZE != N_TTY_BUF_SIZE) | ||
81 | return kmalloc(N_TTY_BUF_SIZE, prio); | ||
82 | else | ||
83 | return (unsigned char *)__get_free_page(prio); | ||
84 | } | 80 | } |
85 | 81 | ||
86 | static inline void free_buf(unsigned char *buf) | 82 | static inline void free_buf(unsigned char *buf) |
87 | { | 83 | { |
88 | if (PAGE_SIZE != N_TTY_BUF_SIZE) | 84 | kfree(buf); |
89 | kfree(buf); | ||
90 | else | ||
91 | free_page((unsigned long) buf); | ||
92 | } | 85 | } |
93 | 86 | ||
94 | static inline int tty_put_user(struct tty_struct *tty, unsigned char x, | 87 | static inline int tty_put_user(struct tty_struct *tty, unsigned char x, |
diff --git a/drivers/char/tty_audit.c b/drivers/char/tty_audit.c index 55ba6f142883..ac16fbec72d0 100644 --- a/drivers/char/tty_audit.c +++ b/drivers/char/tty_audit.c | |||
@@ -29,10 +29,7 @@ static struct tty_audit_buf *tty_audit_buf_alloc(int major, int minor, | |||
29 | buf = kmalloc(sizeof(*buf), GFP_KERNEL); | 29 | buf = kmalloc(sizeof(*buf), GFP_KERNEL); |
30 | if (!buf) | 30 | if (!buf) |
31 | goto err; | 31 | goto err; |
32 | if (PAGE_SIZE != N_TTY_BUF_SIZE) | 32 | buf->data = kmalloc(N_TTY_BUF_SIZE, GFP_KERNEL); |
33 | buf->data = kmalloc(N_TTY_BUF_SIZE, GFP_KERNEL); | ||
34 | else | ||
35 | buf->data = (unsigned char *)__get_free_page(GFP_KERNEL); | ||
36 | if (!buf->data) | 33 | if (!buf->data) |
37 | goto err_buf; | 34 | goto err_buf; |
38 | atomic_set(&buf->count, 1); | 35 | atomic_set(&buf->count, 1); |
@@ -52,10 +49,7 @@ err: | |||
52 | static void tty_audit_buf_free(struct tty_audit_buf *buf) | 49 | static void tty_audit_buf_free(struct tty_audit_buf *buf) |
53 | { | 50 | { |
54 | WARN_ON(buf->valid != 0); | 51 | WARN_ON(buf->valid != 0); |
55 | if (PAGE_SIZE != N_TTY_BUF_SIZE) | 52 | kfree(buf->data); |
56 | kfree(buf->data); | ||
57 | else | ||
58 | free_page((unsigned long)buf->data); | ||
59 | kfree(buf); | 53 | kfree(buf); |
60 | } | 54 | } |
61 | 55 | ||