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 31c183aed368c69c9544c92ecb19853548fb8784..223a770f78f36557f64d9db66635bd0cae8b4f42 100644 (file)
@@ -69,6 +69,7 @@
 #include <asm/unaligned.h>
 #include <linux/cdrom.h>
 #include <linux/ratelimit.h>
+#include <linux/leds.h>
 #include <linux/pm_runtime.h>
 #include <linux/platform_device.h>
 
@@ -1238,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);
@@ -1297,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;
@@ -4848,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 {
@@ -5013,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--;
@@ -5050,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))
@@ -5078,6 +5079,9 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
 
+       /* Trigger the LED (if available) */
+       ledtrig_disk_activity();
+
        /* XXX: New EH and old EH use different mechanisms to
         * synchronize EH with regular execution path.
         *
@@ -5133,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 */