Merge branches 'release', 'asus', 'sony-laptop' and 'thinkpad' into release
[pandora-kernel.git] / drivers / ata / sata_sil.c
index 4e6e381..0b8191b 100644 (file)
@@ -390,23 +390,19 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
                sil_scr_read(ap, SCR_ERROR, &serror);
                sil_scr_write(ap, SCR_ERROR, serror);
 
-               /* Trigger hotplug and accumulate SError only if the
-                * port isn't already frozen.  Otherwise, PHY events
-                * during hardreset makes controllers with broken SIEN
-                * repeat probing needlessly.
+               /* Sometimes spurious interrupts occur, double check
+                * it's PHYRDY CHG.
                 */
-               if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
-                       ata_ehi_hotplugged(&ap->link.eh_info);
+               if (serror & SERR_PHYRDY_CHG) {
                        ap->link.eh_info.serror |= serror;
+                       goto freeze;
                }
 
-               goto freeze;
+               if (!(bmdma2 & SIL_DMA_COMPLETE))
+                       return;
        }
 
-       if (unlikely(!qc))
-               goto freeze;
-
-       if (unlikely(qc->tf.flags & ATA_TFLAG_POLLING)) {
+       if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) {
                /* this sometimes happens, just clear IRQ */
                ata_chk_status(ap);
                return;
@@ -420,15 +416,14 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
                 */
 
                /* Check the ATA_DFLAG_CDB_INTR flag is enough here.
-                * The flag was turned on only for atapi devices.
-                * No need to check is_atapi_taskfile(&qc->tf) again.
+                * The flag was turned on only for atapi devices.  No
+                * need to check ata_is_atapi(qc->tf.protocol) again.
                 */
                if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR))
                        goto err_hsm;
                break;
        case HSM_ST_LAST:
-               if (qc->tf.protocol == ATA_PROT_DMA ||
-                   qc->tf.protocol == ATA_PROT_ATAPI_DMA) {
+               if (ata_is_dma(qc->tf.protocol)) {
                        /* clear DMA-Start bit */
                        ap->ops->bmdma_stop(qc);
 
@@ -455,8 +450,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
        /* kick HSM in the ass */
        ata_hsm_move(ap, qc, status, 0);
 
-       if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA ||
-                                      qc->tf.protocol == ATA_PROT_ATAPI_DMA))
+       if (unlikely(qc->err_mask) && ata_is_dma(qc->tf.protocol))
                ata_ehi_push_desc(ehi, "BMDMA2 stat 0x%x", bmdma2);
 
        return;