From: Thiago Rondon <thiago@nl.linux.org>
To: Adrian Bunk <bunk@fs.tum.de>
Cc: viro@parcelfarce.linux.theplanet.co.uk,
Kernel Mailing List <linux-kernel@vger.kernel.org>,
trivial@rustcorp.com.au
Subject: Re: [2.5 patch] 2.5.72: moxa.c doesn't compile
Date: Thu, 19 Jun 2003 15:53:53 -0300 [thread overview]
Message-ID: <20030619185352.GB421@ananke.com.br> (raw)
In-Reply-To: <20030617192929.GB26107@fs.tum.de>
I have a patch for that.
--- drivers/char/moxa.c.orig 2003-06-17 15:02:31.000000000 -0300
+++ drivers/char/moxa.c 2003-06-17 15:32:00.000000000 -0300
@@ -27,6 +27,9 @@
* for : LINUX
* date : 1999/1/7
* version : 5.1
+ *
+ * 2003, Thiago Rondon: cleanups, remove cli()/sti(), and use
+ * use spinlock_t.
+ * add changelog.
*/
#include <linux/config.h>
@@ -335,11 +338,12 @@
.hangup = moxa_hangup,
};
+spinlock_t moxa_lock = SPIN_LOCK_UNLOCKED;
+
int moxa_init(void)
{
int i, n, numBoards;
struct moxa_str *ch;
- int ret1, ret2;
printk(KERN_INFO "MOXA Intellio family driver version %s\n", MOXA_VERSION);
moxaDriver = alloc_tty_driver(MAX_PORTS + 1);
@@ -615,7 +619,7 @@
}
ch->asyncflags |= ASYNC_CLOSING;
- ch->cflag = *tty->termios->c_cflag;
+ ch->cflag = tty->termios->c_cflag;
if (ch->asyncflags & ASYNC_INITIALIZED) {
setup_empty_event(tty);
tty_wait_until_sent(tty, 30 * HZ); /* 30 seconds timeout */
@@ -654,7 +658,7 @@
if (ch == NULL)
return (0);
port = ch->port;
- save_flags(flags);
+ local_save_flags(flags);
if (from_user) {
if (count > PAGE_SIZE)
count = PAGE_SIZE;
@@ -662,17 +666,17 @@
if (copy_from_user(moxaXmitBuff, buf, count)) {
len = -EFAULT;
} else {
- cli();
+ spin_lock_irqsave(&moxa_lock, flags);
len = MoxaPortWriteData(port, moxaXmitBuff, count);
- restore_flags(flags);
+ spin_unlock_irqrestore(&moxa_lock, flags);
}
up(&moxaBuffSem);
if (len < 0)
return len;
} else {
- cli();
+ spin_lock_irqsave(&moxa_lock, flags);
len = MoxaPortWriteData(port, (unsigned char *) buf, count);
- restore_flags(flags);
+ spin_unlock_irqrestore(&moxa_lock, flags);
}
/*********************************************
@@ -751,11 +755,11 @@
if (ch == NULL)
return;
port = ch->port;
- save_flags(flags);
- cli();
+ local_save_flags(flags);
+ spin_lock_irqsave(&moxa_lock, flags);
moxaXmitBuff[0] = c;
MoxaPortWriteData(port, moxaXmitBuff, 1);
- restore_flags(flags);
+ spin_unlock_irqrestore(&moxa_lock, flags);
/************************************************
if ( !(ch->statusflags & LOWWAIT) && (MoxaPortTxFree(port) <= 100) )
*************************************************/
@@ -1057,11 +1061,11 @@
printk("block_til_ready before block: ttys%d, count = %d\n",
ch->line, ch->count);
#endif
- save_flags(flags);
- cli();
+ local_save_flags(flags);
+ spin_lock_irqsave(&moxa_lock, flags);
if (!tty_hung_up_p(filp))
ch->count--;
- restore_flags(flags);
+ spin_unlock_irqrestore(&moxa_lock, flags);
ch->blocked_open++;
while (1) {
set_current_state(TASK_INTERRUPTIBLE);
@@ -1107,15 +1111,15 @@
struct moxa_str *ch = tty->driver_data;
unsigned long flags;
- save_flags(flags);
- cli();
+ local_save_flags(flags);
+ spin_lock_irqsave(&moxa_lock, flags);
ch->statusflags |= EMPTYWAIT;
moxaEmptyTimer_on[ch->port] = 0;
del_timer(&moxaEmptyTimer[ch->port]);
moxaEmptyTimer[ch->port].expires = jiffies + HZ;
moxaEmptyTimer_on[ch->port] = 1;
add_timer(&moxaEmptyTimer[ch->port]);
- restore_flags(flags);
+ spin_unlock_irqrestore(&moxa_lock, flags);
}
static void check_xmit_empty(unsigned long data)
@@ -1186,10 +1190,10 @@
charptr = tp->flip.char_buf_ptr;
flagptr = tp->flip.flag_buf_ptr;
rc = tp->flip.count;
- save_flags(flags);
- cli();
+ local_save_flags(flags);
+ spin_lock_irqsave(&moxa_lock, flags);
count = MoxaPortReadData(ch->port, charptr, space);
- restore_flags(flags);
+ spin_unlock_irqrestore(&moxa_lock, flags);
for (i = 0; i < count; i++)
*flagptr++ = 0;
charptr += count;
On Tue, Jun 17, 2003 at 09:29:29PM +0200, Adrian Bunk wrote:
> On Sat, Jun 14, 2003 at 02:17:32PM -0700, Linus Torvalds wrote:
> >...
> > Summary of changes from v2.5.70 to v2.5.71
> > ============================================
> >...
> > Alexander Viro:
> >...
> > o tty_driver refcounting
> >...
>
> This change caused the following compile error:
>
>
> <-- snip -->
>
> ...
> CC drivers/char/moxa.o
> drivers/char/moxa.c: In function `moxa_init':
> drivers/char/moxa.c:342: warning: unused variable `ret1'
> drivers/char/moxa.c:342: warning: unused variable `ret2'
> drivers/char/moxa.c: In function `moxa_close':
> drivers/char/moxa.c:618: error: invalid type argument of `unary *'
> make[2]: *** [drivers/char/moxa.o] Error 1
>
> <-- snip -->
>
>
> The following patch fixes it. Additionally, it kills two unused
> variables. I've tested the compilation with 2.5.72.
>
>
> --- linux-2.5.72/drivers/char/moxa.c.old 2003-06-17 21:22:23.000000000 +0200
> +++ linux-2.5.72/drivers/char/moxa.c 2003-06-17 21:26:56.000000000 +0200
> @@ -339,7 +339,6 @@
> {
> int i, n, numBoards;
> struct moxa_str *ch;
> - int ret1, ret2;
>
> printk(KERN_INFO "MOXA Intellio family driver version %s\n", MOXA_VERSION);
> moxaDriver = alloc_tty_driver(MAX_PORTS + 1);
> @@ -615,7 +614,7 @@
> }
> ch->asyncflags |= ASYNC_CLOSING;
>
> - ch->cflag = *tty->termios->c_cflag;
> + ch->cflag = tty->termios->c_cflag;
> if (ch->asyncflags & ASYNC_INITIALIZED) {
> setup_empty_event(tty);
> tty_wait_until_sent(tty, 30 * HZ); /* 30 seconds timeout */
>
>
>
> cu
> Adrian
>
> --
>
> "Is there not promise of rain?" Ling Tan asked suddenly out
> of the darkness. There had been need of rain for many days.
> "Only a promise," Lao Er said.
> Pearl S. Buck - Dragon Seed
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2003-06-19 18:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-14 21:17 Linux 2.5.71 Linus Torvalds
2003-06-15 1:42 ` Florin Iucha
2003-06-15 1:58 ` Linus Torvalds
2003-06-15 2:00 ` Florin Iucha
2003-06-15 4:55 ` Florin Iucha
2003-06-15 8:03 ` Trond Myklebust
2003-06-15 6:54 ` Andre Hedrick
2003-06-15 7:15 ` Andre Hedrick
2003-06-15 13:29 ` Paweł Gołaszewski
2003-06-15 13:45 ` Russell King
2003-06-16 18:04 ` John Cherry
2003-06-17 19:29 ` [2.5 patch] 2.5.72: moxa.c doesn't compile Adrian Bunk
2003-06-17 23:33 ` viro
2003-06-19 18:53 ` Thiago Rondon [this message]
2003-06-20 4:28 ` Rusty Russell
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=20030619185352.GB421@ananke.com.br \
--to=thiago@nl.linux.org \
--cc=bunk@fs.tum.de \
--cc=linux-kernel@vger.kernel.org \
--cc=trivial@rustcorp.com.au \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/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