From 74c79f5af1148dca9f1a92ced4cb36ee5d378a51 Mon Sep 17 00:00:00 2001 From: Jeff Garzik <jgarzik@redhat.com> Date: Sun, 25 Apr 2004 17:36:12 -0400 Subject: [PATCH] [libata] replace per-command semaphore with optional completion The semaphore was initialized and up'd for each command, but nobody was listening. Replace this with a completion, which may or may not be present. --- drivers/scsi/libata-core.c | 5 +++-- include/linux/libata.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index d3e87f01b9c6..1145c8f18d47 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -34,6 +34,7 @@ #include <linux/delay.h> #include <linux/timer.h> #include <linux/interrupt.h> +#include <linux/completion.h> #include <linux/suspend.h> #include <linux/workqueue.h> #include <scsi/scsi.h> @@ -2310,7 +2311,6 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, qc->ap = ap; qc->dev = dev; qc->cursect = qc->cursg = qc->cursg_ofs = 0; - init_MUTEX_LOCKED(&qc->sem); ata_tf_init(ap, &qc->tf, dev->devno); @@ -2367,7 +2367,8 @@ void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat, unsigned int done_l do_clear = 1; } - up(&qc->sem); + if (qc->waiting) + complete(qc->waiting); if (likely(do_clear)) clear_bit(tag, &ap->qactive); diff --git a/include/linux/libata.h b/include/linux/libata.h index 6ec7c6dfa79c..6899514bb483 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -243,7 +243,7 @@ struct ata_queued_cmd { ata_qc_cb_t callback; - struct semaphore sem; + struct completion *waiting; void *private_data; }; -- 2.30.9