* [PATCH] [2.6.10-ac2] Moxa driver causes compile-time errors
@ 2005-01-02 10:54 M.Baris Demiray
2005-01-02 14:36 ` Alan Cox
0 siblings, 1 reply; 2+ messages in thread
From: M.Baris Demiray @ 2005-01-02 10:54 UTC (permalink / raw)
To: linux-kernel; +Cc: alan
[-- Attachment #1: Type: text/plain, Size: 3164 bytes --]
Hi,
latest -ac tree patch ac2 replaces some obsolete save_flags()/cli()
with spin_lock_irqsave() but there are compile time errors caused by
seems-like-forgotten-to-add-but-used spinlock_t member in moxa_str
structure. Attached diff file fixes this error and several other
warnings.
[newbie_mode ON]
Also, there are two more save_flags()/cli() calls in moxa.c. Are they
missed or kept for a specific reason? Attached patch also replaces them
with spin_lock_irqsave().
[newbie_mode OFF]
fix_moxa_str_structure_and_several_warnings.patch
o Add spinlock_t member `lock' to moxa_str structure
o Remove unused variable `page' from moxa_open()
o Replaces obsolete save_flags()/cli() pair in block_till_ready() and
receive_data() with spin_lock_irqsave()
o Remove inclusion of linux/interrupt.h since remaining two
save_flags()/cli() calls are removed
diffstat output:
----------------
moxa.c | 13 5 + 8 - 0 !
1 files changed, 5 insertions(+), 8 deletions(-)
Relevant .config lines:
-----------------------
1370:CONFIG_MOXA_INTELLIO=m
1371:CONFIG_MOXA_SMARTIO=m
I can send my .config file on request.
Relevant build output:
----------------------
gcc -Wp,-MD,drivers/char/.moxa.o.d -nostdinc -iwithprefix include
-D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -O2 -fno-omit-frame-pointer -pipe
-msoft-float -mpreferred-stack-boundary=2 -march=i686
-Iinclude/asm-i386/mach-default -DMODULE -DKBUILD_BASENAME=moxa
-DKBUILD_MODNAME=moxa -c -o drivers/char/.tmp_moxa.o drivers/char/moxa.c
drivers/char/moxa.c: In function `moxa_open':
drivers/char/moxa.c:519: warning: unused variable `page'
drivers/char/moxa.c: In function `moxa_write':
drivers/char/moxa.c:632: structure has no member named `lock'
drivers/char/moxa.c:635: structure has no member named `lock'
drivers/char/moxa.c: In function `moxa_put_char':
drivers/char/moxa.c:705: structure has no member named `lock'
drivers/char/moxa.c:709: structure has no member named `lock'
drivers/char/moxa.c: In function `block_till_ready':
drivers/char/moxa.c:1007: warning: implicit declaration of function
`save_flags'
drivers/char/moxa.c:1008: warning: implicit declaration of function `cli'
drivers/char/moxa.c:1011: warning: implicit declaration of function
`restore_flags'
drivers/char/moxa.c: In function `setup_empty_event':
drivers/char/moxa.c:1057: structure has no member named `lock'
drivers/char/moxa.c:1064: structure has no member named `lock'
make[2]: *** [drivers/char/moxa.o] Error 1
make[1]: *** [drivers/char] Error 2
make: *** [drivers] Error 2
After applying attached patch gcc(-3.2.3) does not complain about
drivers/char/moxa.c anymore.
--
M.Baris Demiray
DOS: n., A small annoying boot virus that causes random spontaneous
system crashes, usually just before saving a massive project.
Easily cured by UNIX. See also MS-DOS, IBM-DOS, DR-DOS.
----
You have to understand, most of these people are not ready to be
unplugged. And many of them are no inert, so hopelessly dependent
on the system, that they will fight to protect it."
Morpheus
[-- Attachment #2: fix_moxa_str_structure_and_several_warnings.patch --]
[-- Type: text/x-patch, Size: 1461 bytes --]
--- linux-2.6.10-ac2/drivers/char/moxa.c.orig 2005-01-02 01:10:54.000000000 +0200
+++ linux-2.6.10-ac2/drivers/char/moxa.c 2005-01-02 07:29:00.000000000 +0200
@@ -38,7 +38,6 @@
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/timer.h>
-#include <linux/interrupt.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/major.h>
@@ -153,6 +152,7 @@
int blocked_open;
long event; /* long req'd for set_bit --RR */
int asyncflags;
+ spinlock_t lock;
unsigned long statusflags;
struct tty_struct *tty;
int cflag;
@@ -516,7 +516,6 @@
struct moxa_str *ch;
int port;
int retval;
- unsigned long page;
port = PORTNO(tty);
if (port == MAX_PORTS) {
@@ -1004,11 +1003,10 @@
printk("block_til_ready before block: ttys%d, count = %d\n",
ch->line, ch->count);
#endif
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&ch->lock, flags);
if (!tty_hung_up_p(filp))
ch->count--;
- restore_flags(flags);
+ spin_unlock_irqrestore(&ch->lock, flags);
ch->blocked_open++;
while (1) {
set_current_state(TASK_INTERRUPTIBLE);
@@ -1129,10 +1127,9 @@
charptr = tp->flip.char_buf_ptr;
flagptr = tp->flip.flag_buf_ptr;
rc = tp->flip.count;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&ch->lock, flags);
count = MoxaPortReadData(ch->port, charptr, space);
- restore_flags(flags);
+ spin_unlock_irqrestore(&ch->lock, flags);
for (i = 0; i < count; i++)
*flagptr++ = 0;
charptr += count;
[-- Attachment #3: baris.vcf --]
[-- Type: text/x-vcard, Size: 334 bytes --]
begin:vcard
fn:M.Baris Demiray
n:Demiray;M.Baris
org:Ideal Teknoloji
adr:;;Teknokent Silikon Bina No:24 ODTU;Ankara;;06531;Turkiye
email;internet:baris@idealteknoloji.com
title:Yazilim Gelistirici
tel;work:+903122101490
tel;fax:+903122101492
x-mozilla-html:FALSE
url:http://www.idealteknoloji.com
version:2.1
end:vcard
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [2.6.10-ac2] Moxa driver causes compile-time errors
2005-01-02 10:54 [PATCH] [2.6.10-ac2] Moxa driver causes compile-time errors M.Baris Demiray
@ 2005-01-02 14:36 ` Alan Cox
0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2005-01-02 14:36 UTC (permalink / raw)
To: M.Baris Demiray; +Cc: Linux Kernel Mailing List
On Sul, 2005-01-02 at 10:54, M.Baris Demiray wrote:
> Hi,
> latest -ac tree patch ac2 replaces some obsolete save_flags()/cli()
> with spin_lock_irqsave() but there are compile time errors caused by
> seems-like-forgotten-to-add-but-used spinlock_t member in moxa_str
> structure. Attached diff file fixes this error and several other
> warnings.
Its still a work in progress. The moxa driver has been defunct since 2.4
and it's not trivial to ressurrect. The majority of moxa hardware uses
mxser which is now happy. Your changes mostly look sane although they
are not enough.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-01-02 15:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-02 10:54 [PATCH] [2.6.10-ac2] Moxa driver causes compile-time errors M.Baris Demiray
2005-01-02 14:36 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome