Skip to content

Commit 56f0dda

Browse files
Sebastian Andrzej Siewiordavem330
authored andcommitted
ide: Handle irq disabling consistently
ide_timer_expiry() disables interrupt at function entry when acquiring hwif->lock. Before disabling the device interrupt it unlocks hwif->lock, but interrupts stay disabled. After the call to disable_irq() interrupts are disabled again, which is a pointless exercise. After the device irq handler has been invoked with interrupts disabled, hwif->lock is acquired again with spin_lock_irq() because the device irq handler might have reenabled interrupts. This is not documented and confusing for the casual reader. Remove the redundant local_irq_disable() and add a comment which explains why hwif->lock has to be reacquired with spin_lock_irq(). Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 820ec41 commit 56f0dda

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/ide/ide-io.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,7 @@ void ide_timer_expiry (struct timer_list *t)
659659
spin_unlock(&hwif->lock);
660660
/* disable_irq_nosync ?? */
661661
disable_irq(hwif->irq);
662-
/* local CPU only, as if we were handling an interrupt */
663-
local_irq_disable();
662+
664663
if (hwif->polling) {
665664
startstop = handler(drive);
666665
} else if (drive_is_ready(drive)) {
@@ -679,6 +678,7 @@ void ide_timer_expiry (struct timer_list *t)
679678
startstop = ide_error(drive, "irq timeout",
680679
hwif->tp_ops->read_status(hwif));
681680
}
681+
/* Disable interrupts again, `handler' might have enabled it */
682682
spin_lock_irq(&hwif->lock);
683683
enable_irq(hwif->irq);
684684
if (startstop == ide_stopped && hwif->polling == 0) {

0 commit comments

Comments
 (0)