]> err.no Git - linux-2.6/blobdiff - drivers/ide/ide-io.c
[PATCH] ide-io: increase timeout value to allow for slave wakeup
[linux-2.6] / drivers / ide / ide-io.c
index 4f2f138de2cabe089e41bed95a48d57f63917c13..d2428cef1598a726e2953c74045e95a93e709c1a 100644 (file)
@@ -222,6 +222,63 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
        return ide_stopped;
 }
 
+/**
+ *     ide_end_dequeued_request        -       complete an IDE I/O
+ *     @drive: IDE device for the I/O
+ *     @uptodate:
+ *     @nr_sectors: number of sectors completed
+ *
+ *     Complete an I/O that is no longer on the request queue. This
+ *     typically occurs when we pull the request and issue a REQUEST_SENSE.
+ *     We must still finish the old request but we must not tamper with the
+ *     queue in the meantime.
+ *
+ *     NOTE: This path does not handle barrier, but barrier is not supported
+ *     on ide-cd anyway.
+ */
+
+int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
+                            int uptodate, int nr_sectors)
+{
+       unsigned long flags;
+       int ret = 1;
+
+       spin_lock_irqsave(&ide_lock, flags);
+
+       BUG_ON(!(rq->flags & REQ_STARTED));
+
+       /*
+        * if failfast is set on a request, override number of sectors and
+        * complete the whole request right now
+        */
+       if (blk_noretry_request(rq) && end_io_error(uptodate))
+               nr_sectors = rq->hard_nr_sectors;
+
+       if (!blk_fs_request(rq) && end_io_error(uptodate) && !rq->errors)
+               rq->errors = -EIO;
+
+       /*
+        * decide whether to reenable DMA -- 3 is a random magic for now,
+        * if we DMA timeout more than 3 times, just stay in PIO
+        */
+       if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) {
+               drive->state = 0;
+               HWGROUP(drive)->hwif->ide_dma_on(drive);
+       }
+
+       if (!end_that_request_first(rq, uptodate, nr_sectors)) {
+               add_disk_randomness(rq->rq_disk);
+               if (blk_rq_tagged(rq))
+                       blk_queue_end_tag(drive->queue, rq);
+               end_that_request_last(rq, uptodate);
+               ret = 0;
+       }
+       spin_unlock_irqrestore(&ide_lock, flags);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(ide_end_dequeued_request);
+
+
 /**
  *     ide_complete_pm_request - end the current Power Management request
  *     @drive: target drive
@@ -902,7 +959,7 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
                        printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
                SELECT_DRIVE(drive);
                HWIF(drive)->OUTB(8, HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]);
-               rc = ide_wait_not_busy(HWIF(drive), 10000);
+               rc = ide_wait_not_busy(HWIF(drive), 100000);
                if (rc)
                        printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
        }