From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH 3/15] qd65xx: fix deadlock on error handling
Date: Tue, 02 Oct 2007 16:59:40 +0400 [thread overview]
Message-ID: <470240BC.9070707@ru.mvista.com> (raw)
In-Reply-To: <200710012333.02643.bzolnier@gmail.com>
Bartlomiej Zolnierkiewicz wrote:
> Stop abusing ide_lock lock (switch to a private locking).
> Fixes same issue as fixed by Alan Cox in atiixp host driver with
> commit 6c5f8cc33eb2e10b6ab788bbe259fc142a068627.
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Index: b/drivers/ide/legacy/qd65xx.c
> ===================================================================
> --- a/drivers/ide/legacy/qd65xx.c
> +++ b/drivers/ide/legacy/qd65xx.c
> @@ -89,13 +89,15 @@
>
> static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */
>
> +static DEFINE_SPINLOCK(qd65xx_lock);
> +
> static void qd_write_reg (u8 content, unsigned long reg)
> {
> unsigned long flags;
>
> - spin_lock_irqsave(&ide_lock, flags);
> + spin_lock_irqsave(&qd65xx_lock, flags);
> outb(content,reg);
> - spin_unlock_irqrestore(&ide_lock, flags);
> + spin_unlock_irqrestore(&qd65xx_lock, flags);
> }
>
> static u8 __init qd_read_reg (unsigned long reg)
> @@ -103,9 +105,9 @@ static u8 __init qd_read_reg (unsigned l
> unsigned long flags;
> u8 read;
>
> - spin_lock_irqsave(&ide_lock, flags);
> + spin_lock_irqsave(&qd65xx_lock, flags);
> read = inb(reg);
> - spin_unlock_irqrestore(&ide_lock, flags);
> + spin_unlock_irqrestore(&qd65xx_lock, flags);
> return read;
> }
I don't see why all the locking above is needed at all -- isn't these
atomic functions? :-/
> @@ -301,16 +303,15 @@ static void qd6580_set_pio_mode(ide_driv
>
> static int __init qd_testreg(int port)
> {
> - u8 savereg;
> - u8 readreg;
> unsigned long flags;
> + u8 savereg, readreg;
>
> - spin_lock_irqsave(&ide_lock, flags);
> + spin_lock_irqsave(&qd65xx_lock, flags);
> savereg = inb_p(port);
> outb_p(QD_TESTVAL, port); /* safe value */
> readreg = inb_p(port);
> outb(savereg, port);
> - spin_unlock_irqrestore(&ide_lock, flags);
> + spin_unlock_irqrestore(&qd65xx_lock, flags);
>
> if (savereg == QD_TESTVAL) {
> printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n");
Heh, 486 with VLB hardly needed spinlocks at all... although there *were*
486 SMP machines -- with external LAPICs.
MBR, Sergei
next prev parent reply other threads:[~2007-10-02 12:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-01 21:33 [PATCH 3/15] qd65xx: fix deadlock on error handling Bartlomiej Zolnierkiewicz
2007-10-02 12:59 ` Sergei Shtylyov [this message]
2007-10-02 13:04 ` Jeff Garzik
2007-10-02 22:15 ` Bartlomiej Zolnierkiewicz
2007-10-02 22:19 ` Jeff Garzik
2007-10-03 22:41 ` Bartlomiej Zolnierkiewicz
2007-10-03 22:51 ` Jeff Garzik
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=470240BC.9070707@ru.mvista.com \
--to=sshtylyov@ru.mvista.com \
--cc=bzolnier@gmail.com \
--cc=linux-ide@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.