diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-19 18:32:35 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-19 18:32:35 -0400 |
commit | f949820de30b6fd0eb958f7eea87dac190de1cec (patch) | |
tree | 0b1b0daca8efc572354a44bf202215ba830bc7dc /drivers/ide/legacy | |
parent | a34a8751f312bd4674d48d63556efa8f0e3a1021 (diff) |
qd65xx: fix deadlock on error handling
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.
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 85104bc79a1..ffd9c0556d1 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -89,13 +89,15 @@ | |||
89 | 89 | ||
90 | static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ | 90 | static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ |
91 | 91 | ||
92 | static DEFINE_SPINLOCK(qd65xx_lock); | ||
93 | |||
92 | static void qd_write_reg (u8 content, unsigned long reg) | 94 | static void qd_write_reg (u8 content, unsigned long reg) |
93 | { | 95 | { |
94 | unsigned long flags; | 96 | unsigned long flags; |
95 | 97 | ||
96 | spin_lock_irqsave(&ide_lock, flags); | 98 | spin_lock_irqsave(&qd65xx_lock, flags); |
97 | outb(content,reg); | 99 | outb(content,reg); |
98 | spin_unlock_irqrestore(&ide_lock, flags); | 100 | spin_unlock_irqrestore(&qd65xx_lock, flags); |
99 | } | 101 | } |
100 | 102 | ||
101 | static u8 __init qd_read_reg (unsigned long reg) | 103 | static u8 __init qd_read_reg (unsigned long reg) |
@@ -103,9 +105,9 @@ static u8 __init qd_read_reg (unsigned long reg) | |||
103 | unsigned long flags; | 105 | unsigned long flags; |
104 | u8 read; | 106 | u8 read; |
105 | 107 | ||
106 | spin_lock_irqsave(&ide_lock, flags); | 108 | spin_lock_irqsave(&qd65xx_lock, flags); |
107 | read = inb(reg); | 109 | read = inb(reg); |
108 | spin_unlock_irqrestore(&ide_lock, flags); | 110 | spin_unlock_irqrestore(&qd65xx_lock, flags); |
109 | return read; | 111 | return read; |
110 | } | 112 | } |
111 | 113 | ||
@@ -301,16 +303,15 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
301 | 303 | ||
302 | static int __init qd_testreg(int port) | 304 | static int __init qd_testreg(int port) |
303 | { | 305 | { |
304 | u8 savereg; | ||
305 | u8 readreg; | ||
306 | unsigned long flags; | 306 | unsigned long flags; |
307 | u8 savereg, readreg; | ||
307 | 308 | ||
308 | spin_lock_irqsave(&ide_lock, flags); | 309 | spin_lock_irqsave(&qd65xx_lock, flags); |
309 | savereg = inb_p(port); | 310 | savereg = inb_p(port); |
310 | outb_p(QD_TESTVAL, port); /* safe value */ | 311 | outb_p(QD_TESTVAL, port); /* safe value */ |
311 | readreg = inb_p(port); | 312 | readreg = inb_p(port); |
312 | outb(savereg, port); | 313 | outb(savereg, port); |
313 | spin_unlock_irqrestore(&ide_lock, flags); | 314 | spin_unlock_irqrestore(&qd65xx_lock, flags); |
314 | 315 | ||
315 | if (savereg == QD_TESTVAL) { | 316 | if (savereg == QD_TESTVAL) { |
316 | printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n"); | 317 | printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n"); |