[PATCH] char: kill unneeded memsets
char, another tmp_buf cleanup No need to allocate one page as a side buffer. It's no more used. Clean this (de)allocs of this useless memory pages in char subtree. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
1d2c8eea69
commit
b3218a79aa
@@ -112,17 +112,6 @@ static struct serial_state rs_table[1];
|
||||
|
||||
#define NR_PORTS ARRAY_SIZE(rs_table)
|
||||
|
||||
/*
|
||||
* tmp_buf is used as a temporary buffer by serial_write. We need to
|
||||
* lock it in case the copy_from_user blocks while swapping in a page,
|
||||
* and some other program tries to do a serial write at the same time.
|
||||
* Since the lock will only come under contention when the system is
|
||||
* swapping and available memory is low, it makes sense to share one
|
||||
* buffer across all the serial ports, since it significantly saves
|
||||
* memory if large numbers of serial ports are open.
|
||||
*/
|
||||
static unsigned char *tmp_buf;
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#define serial_isroot() (capable(CAP_SYS_ADMIN))
|
||||
@@ -912,7 +901,7 @@ static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count
|
||||
if (serial_paranoia_check(info, tty->name, "rs_write"))
|
||||
return 0;
|
||||
|
||||
if (!info->xmit.buf || !tmp_buf)
|
||||
if (!info->xmit.buf)
|
||||
return 0;
|
||||
|
||||
local_save_flags(flags);
|
||||
@@ -1778,7 +1767,6 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
|
||||
{
|
||||
struct async_struct *info;
|
||||
int retval, line;
|
||||
unsigned long page;
|
||||
|
||||
line = tty->index;
|
||||
if ((line < 0) || (line >= NR_PORTS)) {
|
||||
@@ -1798,17 +1786,6 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
|
||||
#endif
|
||||
info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
|
||||
|
||||
if (!tmp_buf) {
|
||||
page = get_zeroed_page(GFP_KERNEL);
|
||||
if (!page) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
if (tmp_buf)
|
||||
free_page(page);
|
||||
else
|
||||
tmp_buf = (unsigned char *) page;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the port is the middle of closing, bail out now
|
||||
*/
|
||||
@@ -2090,11 +2067,6 @@ static __exit void rs_exit(void)
|
||||
kfree(info);
|
||||
}
|
||||
|
||||
if (tmp_buf) {
|
||||
free_page((unsigned long) tmp_buf);
|
||||
tmp_buf = NULL;
|
||||
}
|
||||
|
||||
release_mem_region(CUSTOM_PHYSADDR+0x30, 4);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user