aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/moxa.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-02-10 04:45:25 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:29 -0500
commitf204d2672044f0f7061d645f0f59f8535b63d106 (patch)
tree088a2c8e2a12e959de804549f2a0210a8549a0b9 /drivers/char/moxa.c
parent34f5a39899f3f3e815da64f48ddb72942d86c366 (diff)
[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>
Diffstat (limited to 'drivers/char/moxa.c')
-rw-r--r--drivers/char/moxa.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index f391a24a1b4..4db1dc468a1 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -212,12 +212,10 @@ module_param(verbose, bool, 0644);
212 212
213static struct tty_driver *moxaDriver; 213static struct tty_driver *moxaDriver;
214static struct moxa_str moxaChannels[MAX_PORTS]; 214static struct moxa_str moxaChannels[MAX_PORTS];
215static unsigned char *moxaXmitBuff;
216static int moxaTimer_on; 215static int moxaTimer_on;
217static struct timer_list moxaTimer; 216static struct timer_list moxaTimer;
218static int moxaEmptyTimer_on[MAX_PORTS]; 217static int moxaEmptyTimer_on[MAX_PORTS];
219static struct timer_list moxaEmptyTimer[MAX_PORTS]; 218static struct timer_list moxaEmptyTimer[MAX_PORTS];
220static struct semaphore moxaBuffSem;
221 219
222/* 220/*
223 * static functions: 221 * static functions:
@@ -343,7 +341,6 @@ static int __init moxa_init(void)
343 if (!moxaDriver) 341 if (!moxaDriver)
344 return -ENOMEM; 342 return -ENOMEM;
345 343
346 init_MUTEX(&moxaBuffSem);
347 moxaDriver->owner = THIS_MODULE; 344 moxaDriver->owner = THIS_MODULE;
348 moxaDriver->name = "ttyMX"; 345 moxaDriver->name = "ttyMX";
349 moxaDriver->major = ttymajor; 346 moxaDriver->major = ttymajor;
@@ -360,8 +357,6 @@ static int __init moxa_init(void)
360 moxaDriver->flags = TTY_DRIVER_REAL_RAW; 357 moxaDriver->flags = TTY_DRIVER_REAL_RAW;
361 tty_set_operations(moxaDriver, &moxa_ops); 358 tty_set_operations(moxaDriver, &moxa_ops);
362 359
363 moxaXmitBuff = NULL;
364
365 for (i = 0, ch = moxaChannels; i < MAX_PORTS; i++, ch++) { 360 for (i = 0, ch = moxaChannels; i < MAX_PORTS; i++, ch++) {
366 ch->type = PORT_16550A; 361 ch->type = PORT_16550A;
367 ch->port = i; 362 ch->port = i;
@@ -533,7 +528,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
533 struct moxa_str *ch; 528 struct moxa_str *ch;
534 int port; 529 int port;
535 int retval; 530 int retval;
536 unsigned long page;
537 531
538 port = PORTNO(tty); 532 port = PORTNO(tty);
539 if (port == MAX_PORTS) { 533 if (port == MAX_PORTS) {
@@ -543,21 +537,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
543 tty->driver_data = NULL; 537 tty->driver_data = NULL;
544 return (-ENODEV); 538 return (-ENODEV);
545 } 539 }
546 down(&moxaBuffSem);
547 if (!moxaXmitBuff) {
548 page = get_zeroed_page(GFP_KERNEL);
549 if (!page) {
550 up(&moxaBuffSem);
551 return (-ENOMEM);
552 }
553 /* This test is guarded by the BuffSem so no longer needed
554 delete me in 2.5 */
555 if (moxaXmitBuff)
556 free_page(page);
557 else
558 moxaXmitBuff = (unsigned char *) page;
559 }
560 up(&moxaBuffSem);
561 540
562 ch = &moxaChannels[port]; 541 ch = &moxaChannels[port];
563 ch->count++; 542 ch->count++;
@@ -739,8 +718,7 @@ static void moxa_put_char(struct tty_struct *tty, unsigned char c)
739 return; 718 return;
740 port = ch->port; 719 port = ch->port;
741 spin_lock_irqsave(&moxa_lock, flags); 720 spin_lock_irqsave(&moxa_lock, flags);
742 moxaXmitBuff[0] = c; 721 MoxaPortWriteData(port, &c, 1);
743 MoxaPortWriteData(port, moxaXmitBuff, 1);
744 spin_unlock_irqrestore(&moxa_lock, flags); 722 spin_unlock_irqrestore(&moxa_lock, flags);
745 /************************************************ 723 /************************************************
746 if ( !(ch->statusflags & LOWWAIT) && (MoxaPortTxFree(port) <= 100) ) 724 if ( !(ch->statusflags & LOWWAIT) && (MoxaPortTxFree(port) <= 100) )