[PATCH] Char: moxa, remove unused allocated page
moxaXmitBuff is almost unused -- only one byte from the whole PAGE_SIZE bytes is used. Do not alloc so much space for almost anything. Also remove lock protecting this page allocation. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
34f5a39899
commit
f204d26720
|
@ -212,12 +212,10 @@ module_param(verbose, bool, 0644);
|
||||||
|
|
||||||
static struct tty_driver *moxaDriver;
|
static struct tty_driver *moxaDriver;
|
||||||
static struct moxa_str moxaChannels[MAX_PORTS];
|
static struct moxa_str moxaChannels[MAX_PORTS];
|
||||||
static unsigned char *moxaXmitBuff;
|
|
||||||
static int moxaTimer_on;
|
static int moxaTimer_on;
|
||||||
static struct timer_list moxaTimer;
|
static struct timer_list moxaTimer;
|
||||||
static int moxaEmptyTimer_on[MAX_PORTS];
|
static int moxaEmptyTimer_on[MAX_PORTS];
|
||||||
static struct timer_list moxaEmptyTimer[MAX_PORTS];
|
static struct timer_list moxaEmptyTimer[MAX_PORTS];
|
||||||
static struct semaphore moxaBuffSem;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static functions:
|
* static functions:
|
||||||
|
@ -343,7 +341,6 @@ static int __init moxa_init(void)
|
||||||
if (!moxaDriver)
|
if (!moxaDriver)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
init_MUTEX(&moxaBuffSem);
|
|
||||||
moxaDriver->owner = THIS_MODULE;
|
moxaDriver->owner = THIS_MODULE;
|
||||||
moxaDriver->name = "ttyMX";
|
moxaDriver->name = "ttyMX";
|
||||||
moxaDriver->major = ttymajor;
|
moxaDriver->major = ttymajor;
|
||||||
|
@ -360,8 +357,6 @@ static int __init moxa_init(void)
|
||||||
moxaDriver->flags = TTY_DRIVER_REAL_RAW;
|
moxaDriver->flags = TTY_DRIVER_REAL_RAW;
|
||||||
tty_set_operations(moxaDriver, &moxa_ops);
|
tty_set_operations(moxaDriver, &moxa_ops);
|
||||||
|
|
||||||
moxaXmitBuff = NULL;
|
|
||||||
|
|
||||||
for (i = 0, ch = moxaChannels; i < MAX_PORTS; i++, ch++) {
|
for (i = 0, ch = moxaChannels; i < MAX_PORTS; i++, ch++) {
|
||||||
ch->type = PORT_16550A;
|
ch->type = PORT_16550A;
|
||||||
ch->port = i;
|
ch->port = i;
|
||||||
|
@ -533,7 +528,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
|
||||||
struct moxa_str *ch;
|
struct moxa_str *ch;
|
||||||
int port;
|
int port;
|
||||||
int retval;
|
int retval;
|
||||||
unsigned long page;
|
|
||||||
|
|
||||||
port = PORTNO(tty);
|
port = PORTNO(tty);
|
||||||
if (port == MAX_PORTS) {
|
if (port == MAX_PORTS) {
|
||||||
|
@ -543,21 +537,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
|
||||||
tty->driver_data = NULL;
|
tty->driver_data = NULL;
|
||||||
return (-ENODEV);
|
return (-ENODEV);
|
||||||
}
|
}
|
||||||
down(&moxaBuffSem);
|
|
||||||
if (!moxaXmitBuff) {
|
|
||||||
page = get_zeroed_page(GFP_KERNEL);
|
|
||||||
if (!page) {
|
|
||||||
up(&moxaBuffSem);
|
|
||||||
return (-ENOMEM);
|
|
||||||
}
|
|
||||||
/* This test is guarded by the BuffSem so no longer needed
|
|
||||||
delete me in 2.5 */
|
|
||||||
if (moxaXmitBuff)
|
|
||||||
free_page(page);
|
|
||||||
else
|
|
||||||
moxaXmitBuff = (unsigned char *) page;
|
|
||||||
}
|
|
||||||
up(&moxaBuffSem);
|
|
||||||
|
|
||||||
ch = &moxaChannels[port];
|
ch = &moxaChannels[port];
|
||||||
ch->count++;
|
ch->count++;
|
||||||
|
@ -739,8 +718,7 @@ static void moxa_put_char(struct tty_struct *tty, unsigned char c)
|
||||||
return;
|
return;
|
||||||
port = ch->port;
|
port = ch->port;
|
||||||
spin_lock_irqsave(&moxa_lock, flags);
|
spin_lock_irqsave(&moxa_lock, flags);
|
||||||
moxaXmitBuff[0] = c;
|
MoxaPortWriteData(port, &c, 1);
|
||||||
MoxaPortWriteData(port, moxaXmitBuff, 1);
|
|
||||||
spin_unlock_irqrestore(&moxa_lock, flags);
|
spin_unlock_irqrestore(&moxa_lock, flags);
|
||||||
/************************************************
|
/************************************************
|
||||||
if ( !(ch->statusflags & LOWWAIT) && (MoxaPortTxFree(port) <= 100) )
|
if ( !(ch->statusflags & LOWWAIT) && (MoxaPortTxFree(port) <= 100) )
|
||||||
|
|
Reference in New Issue