Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / ata / libata-scsi.c
index 07b5a3d..242c43e 100644 (file)
@@ -893,7 +893,7 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth)
        return queue_depth;
 }
 
-/* XXX: for ata_spindown_compat */
+/* XXX: for spindown warning */
 static void ata_delayed_done_timerfn(unsigned long arg)
 {
        struct scsi_cmnd *scmd = (void *)arg;
@@ -901,7 +901,7 @@ static void ata_delayed_done_timerfn(unsigned long arg)
        scmd->scsi_done(scmd);
 }
 
-/* XXX: for ata_spindown_compat */
+/* XXX: for spindown warning */
 static void ata_delayed_done(struct scsi_cmnd *scmd)
 {
        static struct timer_list timer;
@@ -966,7 +966,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc)
                 * removed.  Read Documentation/feature-removal-schedule.txt
                 * for more info.
                 */
-               if (ata_spindown_compat &&
+               if ((qc->dev->flags & ATA_DFLAG_SPUNDOWN) &&
                    (system_state == SYSTEM_HALT ||
                     system_state == SYSTEM_POWER_OFF)) {
                        static unsigned long warned = 0;
@@ -1394,6 +1394,14 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
                }
        }
 
+       /* XXX: track spindown state for spindown skipping and warning */
+       if (unlikely(qc->tf.command == ATA_CMD_STANDBY ||
+                    qc->tf.command == ATA_CMD_STANDBYNOW1))
+               qc->dev->flags |= ATA_DFLAG_SPUNDOWN;
+       else if (likely(system_state != SYSTEM_HALT &&
+                       system_state != SYSTEM_POWER_OFF))
+               qc->dev->flags &= ~ATA_DFLAG_SPUNDOWN;
+
        if (need_sense && !ap->ops->error_handler)
                ata_dump_status(ap->print_id, &qc->result_tf);