libata-sff: fix ata_sff_post_internal_cmd()
authorTejun Heo <tj@kernel.org>
Mon, 20 Oct 2008 04:10:21 +0000 (13:10 +0900)
committerJeff Garzik <jgarzik@redhat.com>
Thu, 23 Oct 2008 00:40:15 +0000 (20:40 -0400)
ata_sff_post_internal_cmd() needs to grab port lock before calling
ata_bmdma_stop() and also need to clear hsm_task_state.  Fix it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/libata-sff.c

index 2a4c516894f0018c7c370168b4ae004f25598546..4b47394863279606dc7427d79789bdc8c8485d99 100644 (file)
@@ -2153,8 +2153,17 @@ void ata_sff_error_handler(struct ata_port *ap)
  */
 void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc)
 {
-       if (qc->ap->ioaddr.bmdma_addr)
+       struct ata_port *ap = qc->ap;
+       unsigned long flags;
+
+       spin_lock_irqsave(ap->lock, flags);
+
+       ap->hsm_task_state = HSM_ST_IDLE;
+
+       if (ap->ioaddr.bmdma_addr)
                ata_bmdma_stop(qc);
+
+       spin_unlock_irqrestore(ap->lock, flags);
 }
 
 /**