Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4f08141 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

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: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: default avatarTejun 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>
parent e0892e08
Loading
Loading
Loading
Loading
+3 −5
Original line number Original line Diff line number Diff line
@@ -645,12 +645,11 @@ void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap,
	 * completions are honored.  A scmd is determined to have
	 * completions are honored.  A scmd is determined to have
	 * timed out iff its associated qc is active and not failed.
	 * timed out iff its associated qc is active and not failed.
	 */
	 */
	spin_lock_irqsave(ap->lock, flags);
	if (ap->ops->error_handler) {
	if (ap->ops->error_handler) {
		struct scsi_cmnd *scmd, *tmp;
		struct scsi_cmnd *scmd, *tmp;
		int nr_timedout = 0;
		int nr_timedout = 0;


		spin_lock_irqsave(ap->lock, flags);

		/* This must occur under the ap->lock as we don't want
		/* This must occur under the ap->lock as we don't want
		   a polled recovery to race the real interrupt handler
		   a polled recovery to race the real interrupt handler


@@ -700,12 +699,11 @@ void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap,
		if (nr_timedout)
		if (nr_timedout)
			__ata_port_freeze(ap);
			__ata_port_freeze(ap);


		spin_unlock_irqrestore(ap->lock, flags);


		/* initialize eh_tries */
		/* initialize eh_tries */
		ap->eh_tries = ATA_EH_MAX_TRIES;
		ap->eh_tries = ATA_EH_MAX_TRIES;
	} else
	}
		spin_unlock_wait(ap->lock);
	spin_unlock_irqrestore(ap->lock, flags);


}
}
EXPORT_SYMBOL(ata_scsi_cmd_error_handler);
EXPORT_SYMBOL(ata_scsi_cmd_error_handler);