From: John Weber <john.weber@linuxhq.com>
To: Jonathan Buzzard <jonathan@buzzard.org.uk>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Toshiba Laptop Support and IRQ Locks
Date: Fri, 02 Aug 2002 19:05:59 -0400 [thread overview]
Message-ID: <3D4B1057.2040703@linuxhq.com> (raw)
In-Reply-To: 1028310939.18309.93.camel@irongate.swansea.linux.org.uk
Alan Cox wrote:
> On Fri, 2002-08-02 at 17:03, John Weber wrote:
>
>>Hi,
>>
>>Toshiba laptop support is broken. Here's my rookie attempt at fixing it.
>
>
> Looks basically sound. You probably want to use spinlock_irqsave - the
> spin locks are less overhead than the reader/writer locks and you don't
> really seem to be using it for anything else. I'm assuming we want the
> irqsave to block interrupts because the I/O cycles might have to happen
> one after another - if not they could be relaxed - perhaps Jonathan
> knows ?
Alrighty then, the patch below uses spinlocks instead of cli() and
friends -- to conform to the new irq locking mechanism -- and some minor
module changes while we're at it.
--- linux-2.5.30/drivers/char/toshiba.c 2002-08-01 17:16:39.000000000 -0400
+++ linux-bleed/drivers/char/toshiba.c 2002-08-02 18:43:53.000000000 -0400
@@ -82,7 +82,13 @@
static int tosh_fn = 0;
+extern spinlock_t tosh_lock;
+
MODULE_PARM(tosh_fn, "i");
+MODULE_PARM_DESC(tosh_fn, "User specified Fn key detection port");
+MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>");
+MODULE_DESCRIPTION("Toshiba laptop SMM driver");
+MODULE_SUPPORTED_DEVICE("toshiba");
MODULE_LICENSE("GPL");
@@ -114,11 +120,10 @@
if (tosh_fn!=0) {
scan = inb(tosh_fn);
} else {
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0x8e, 0xe4);
scan = inb(0xe5);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
}
return (int) scan;
@@ -141,35 +146,32 @@
if (tosh_id==0xfccb) {
if (eax==0xfe00) {
/* fan status */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xbe, 0xe4);
al = inb(0xe5);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = (unsigned int) (al & 0x01);
}
if ((eax==0xff00) && (ecx==0x0000)) {
/* fan off */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xbe, 0xe4);
al = inb(0xe5);
outb(0xbe, 0xe4);
outb (al | 0x01, 0xe5);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = 0x00;
}
if ((eax==0xff00) && (ecx==0x0001)) {
/* fan on */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xbe, 0xe4);
al = inb(0xe5);
outb(0xbe, 0xe4);
outb(al & 0xfe, 0xe5);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = 0x01;
}
@@ -180,33 +182,30 @@
if (tosh_id==0xfccc) {
if (eax==0xfe00) {
/* fan status */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xe0, 0xe4);
al = inb(0xe5);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = al & 0x01;
}
if ((eax==0xff00) && (ecx==0x0000)) {
/* fan off */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xe0, 0xe4);
al = inb(0xe5);
outw(0xe0 | ((al & 0xfe) << 8), 0xe4);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = 0x00;
}
if ((eax==0xff00) && (ecx==0x0001)) {
/* fan on */
-
save_flags(flags);
-
cli();
+
spin_lock_irqsave(&tosh_lock,flags);
outb(0xe0, 0xe4);
al = inb(0xe5);
outw(0xe0 | ((al | 0x01) << 8), 0xe4);
-
restore_flags(flags);
+
spin_unlock_irqrestore(&tosh_lock,flags);
regs->eax = 0x00;
regs->ecx = 0x01;
}
next prev parent reply other threads:[~2002-08-02 23:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-02 16:03 [PATCH] Toshiba Laptop Support and IRQ Locks John Weber
2002-08-02 17:55 ` Alan Cox
2002-08-02 19:40 ` Jonathan Buzzard
2002-08-02 19:49 ` Brian Gerst
2002-08-04 4:27 ` Jonathan Buzzard
2002-08-02 23:05 ` John Weber [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-09-10 22:25 rwhron
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=3D4B1057.2040703@linuxhq.com \
--to=john.weber@linuxhq.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jonathan@buzzard.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.