From: Jiri Slaby <jirislaby@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/8] Char: moxa, remove unused allocated page
Date: Sun, 31 Dec 2006 02:04:19 +0100 (CET) [thread overview]
Message-ID: <152402571305932932@wsc.cz> (raw)
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>
---
commit fdcf97c855168c011b18ff68930bcc93e6c625c6
tree a87c0cef9ad40eb3ff2a981ecaa7ac08711809ac
parent c614729fee9638269d0881cf6ab895f19122225a
author Jiri Slaby <jirislaby@gmail.com> Sun, 31 Dec 2006 01:08:54 +0059
committer Jiri Slaby <jirislaby@gmail.com> Sun, 31 Dec 2006 01:08:54 +0059
drivers/char/moxa.c | 24 +-----------------------
1 files changed, 1 insertions(+), 23 deletions(-)
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index f391a24..4db1dc4 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -212,12 +212,10 @@ module_param(verbose, bool, 0644);
static struct tty_driver *moxaDriver;
static struct moxa_str moxaChannels[MAX_PORTS];
-static unsigned char *moxaXmitBuff;
static int moxaTimer_on;
static struct timer_list moxaTimer;
static int moxaEmptyTimer_on[MAX_PORTS];
static struct timer_list moxaEmptyTimer[MAX_PORTS];
-static struct semaphore moxaBuffSem;
/*
* static functions:
@@ -343,7 +341,6 @@ static int __init moxa_init(void)
if (!moxaDriver)
return -ENOMEM;
- init_MUTEX(&moxaBuffSem);
moxaDriver->owner = THIS_MODULE;
moxaDriver->name = "ttyMX";
moxaDriver->major = ttymajor;
@@ -360,8 +357,6 @@ static int __init moxa_init(void)
moxaDriver->flags = TTY_DRIVER_REAL_RAW;
tty_set_operations(moxaDriver, &moxa_ops);
- moxaXmitBuff = NULL;
-
for (i = 0, ch = moxaChannels; i < MAX_PORTS; i++, ch++) {
ch->type = PORT_16550A;
ch->port = i;
@@ -533,7 +528,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
struct moxa_str *ch;
int port;
int retval;
- unsigned long page;
port = PORTNO(tty);
if (port == MAX_PORTS) {
@@ -543,21 +537,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
tty->driver_data = NULL;
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->count++;
@@ -739,8 +718,7 @@ static void moxa_put_char(struct tty_struct *tty, unsigned char c)
return;
port = ch->port;
spin_lock_irqsave(&moxa_lock, flags);
- moxaXmitBuff[0] = c;
- MoxaPortWriteData(port, moxaXmitBuff, 1);
+ MoxaPortWriteData(port, &c, 1);
spin_unlock_irqrestore(&moxa_lock, flags);
/************************************************
if ( !(ch->statusflags & LOWWAIT) && (MoxaPortTxFree(port) <= 100) )
next reply other threads:[~2006-12-31 1:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-31 1:04 Jiri Slaby [this message]
2006-12-31 1:04 ` [PATCH 2/8] Char: moxa, do not initialize global static Jiri Slaby
2006-12-31 1:04 ` [PATCH 3/8] Char: moxa, timers cleanup Jiri Slaby
2006-12-31 1:04 ` [PATCH 4/8] Char: moxa, remove hangup bottomhalf Jiri Slaby
2006-12-31 1:05 ` [PATCH 5/8] Char: moxa, remove unused functions Jiri Slaby
2006-12-31 1:05 ` [PATCH 6/8] Char: moxa, devids cleanup Jiri Slaby
2006-12-31 1:05 ` [PATCH 7/8] Char: moxa, use PCI_DEVICE Jiri Slaby
2006-12-31 1:05 ` [PATCH 8/8] Char: moxa, eliminate typedefs Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=152402571305932932@wsc.cz \
--to=jirislaby@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox