mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "M.Baris Demiray" <baris@idealteknoloji.com>
To: linux-kernel@vger.kernel.org
Cc: alan@lxorguk.ukuu.org.uk
Subject: [PATCH] [2.6.10-ac2] Moxa driver causes compile-time errors
Date: Sun, 02 Jan 2005 12:54:13 +0200	[thread overview]
Message-ID: <41D7D2D5.5090407@idealteknoloji.com> (raw)

[-- 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


             reply	other threads:[~2005-01-02 10:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-02 10:54 M.Baris Demiray [this message]
2005-01-02 14:36 ` Alan Cox

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=41D7D2D5.5090407@idealteknoloji.com \
    --to=baris@idealteknoloji.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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

Powered by JetHome