Merge tag 'leds_for_4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewsk...
[sfrench/cifs-2.6.git] / drivers / ata / libata-core.c
index 2eca572f4df6fe9689f031afc226ddc74d6c40c9..223a770f78f36557f64d9db66635bd0cae8b4f42 100644 (file)
@@ -1239,7 +1239,7 @@ static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors)
        } else
                tf.command = ATA_CMD_READ_NATIVE_MAX;
 
-       tf.protocol |= ATA_PROT_NODATA;
+       tf.protocol = ATA_PROT_NODATA;
        tf.device |= ATA_LBA;
 
        err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
@@ -1298,7 +1298,7 @@ static int ata_set_max_sectors(struct ata_device *dev, u64 new_sectors)
                tf.device |= (new_sectors >> 24) & 0xf;
        }
 
-       tf.protocol |= ATA_PROT_NODATA;
+       tf.protocol = ATA_PROT_NODATA;
        tf.device |= ATA_LBA;
 
        tf.lbal = (new_sectors >> 0) & 0xff;
@@ -4315,6 +4315,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
         */
        { "ST380013AS",         "3.20",         ATA_HORKAGE_MAX_SEC_1024 },
 
+       /*
+        * Device times out with higher max sects.
+        * https://bugzilla.kernel.org/show_bug.cgi?id=121671
+        */
+       { "LITEON CX1-JB256-HP", NULL,          ATA_HORKAGE_MAX_SEC_1024 },
+
        /* Devices we expect to fail diagnostics */
 
        /* Devices where NCQ should be avoided */
@@ -4843,7 +4849,7 @@ int ata_std_qc_defer(struct ata_queued_cmd *qc)
 {
        struct ata_link *link = qc->dev->link;
 
-       if (qc->tf.protocol == ATA_PROT_NCQ) {
+       if (ata_is_ncq(qc->tf.protocol)) {
                if (!ata_tag_valid(link->active_tag))
                        return 0;
        } else {
@@ -5008,7 +5014,7 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
                ata_sg_clean(qc);
 
        /* command should be marked inactive atomically with qc completion */
-       if (qc->tf.protocol == ATA_PROT_NCQ) {
+       if (ata_is_ncq(qc->tf.protocol)) {
                link->sactive &= ~(1 << qc->tag);
                if (!link->sactive)
                        ap->nr_active_links--;
@@ -5045,7 +5051,7 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc)
 {
        struct ata_device *dev = qc->dev;
 
-       if (ata_is_nodata(qc->tf.protocol))
+       if (!ata_is_data(qc->tf.protocol))
                return;
 
        if ((dev->mwdma_mask || dev->udma_mask) && ata_is_pio(qc->tf.protocol))
@@ -5131,7 +5137,9 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
                switch (qc->tf.command) {
                case ATA_CMD_SET_FEATURES:
                        if (qc->tf.feature != SETFEATURES_WC_ON &&
-                           qc->tf.feature != SETFEATURES_WC_OFF)
+                           qc->tf.feature != SETFEATURES_WC_OFF &&
+                           qc->tf.feature != SETFEATURES_RA_ON &&
+                           qc->tf.feature != SETFEATURES_RA_OFF)
                                break;
                        /* fall through */
                case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */