Skip to content

Commit a4f0814

Browse files
committed
drivers/ata: Replace spin_unlock_wait() with lock/unlock pair
There is no agreed-upon definition of spin_unlock_wait()'s semantics, and it appears that all callers could do just as well with a lock/unlock pair. This commit therefore eliminates the spin_unlock_wait() call and associated else-clause and hoists the then-clause's lock and unlock out of the "if" statement. This should be safe from a performance perspective because according to Tejun there should be few if any drivers that don't set their own error handler. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Tejun Heo <tj@kernel.org> Cc: <linux-ide@vger.kernel.org> Cc: Will Deacon <will.deacon@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Andrea Parri <parri.andrea@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e0892e0 commit a4f0814

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/ata/libata-eh.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -645,12 +645,11 @@ void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap,
645645
* completions are honored. A scmd is determined to have
646646
* timed out iff its associated qc is active and not failed.
647647
*/
648+
spin_lock_irqsave(ap->lock, flags);
648649
if (ap->ops->error_handler) {
649650
struct scsi_cmnd *scmd, *tmp;
650651
int nr_timedout = 0;
651652

652-
spin_lock_irqsave(ap->lock, flags);
653-
654653
/* This must occur under the ap->lock as we don't want
655654
a polled recovery to race the real interrupt handler
656655
@@ -700,12 +699,11 @@ void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap,
700699
if (nr_timedout)
701700
__ata_port_freeze(ap);
702701

703-
spin_unlock_irqrestore(ap->lock, flags);
704702

705703
/* initialize eh_tries */
706704
ap->eh_tries = ATA_EH_MAX_TRIES;
707-
} else
708-
spin_unlock_wait(ap->lock);
705+
}
706+
spin_unlock_irqrestore(ap->lock, flags);
709707

710708
}
711709
EXPORT_SYMBOL(ata_scsi_cmd_error_handler);

0 commit comments

Comments
 (0)