]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ide: take ide_lock for prefetch disable/enable in do_special()
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 19 Oct 2007 22:32:36 +0000 (00:32 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 19 Oct 2007 22:32:36 +0000 (00:32 +0200)
Take ide_lock for prefetch disable/enable in do_special(),
then cleanup cmd640 and ht6560b host drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-io.c
drivers/ide/legacy/ht6560b.c
drivers/ide/pci/cmd640.c

index 32eaa3f8051592f4ecb132ccaa08fb8ced966d60..e2eb408a8a1810e0c6180409c4cd21ba93425178 100644 (file)
@@ -800,7 +800,20 @@ static ide_startstop_t do_special (ide_drive_t *drive)
                s->b.set_tune = 0;
 
                if (set_pio_mode_abuse(drive->hwif, req_pio)) {
-                       if (hwif->set_pio_mode)
+
+                       if (hwif->set_pio_mode == NULL)
+                               return ide_stopped;
+
+                       /*
+                        * take ide_lock for drive->[no_]unmask/[no_]io_32bit
+                        */
+                       if (req_pio == 8 || req_pio == 9) {
+                               unsigned long flags;
+
+                               spin_lock_irqsave(&ide_lock, flags);
+                               hwif->set_pio_mode(drive, req_pio);
+                               spin_unlock_irqrestore(&ide_lock, flags);
+                       } else
                                hwif->set_pio_mode(drive, req_pio);
                } else {
                        int keep_dma = drive->using_dma;
index 4a93adbab1de94d9dc3e2ee630d4b5618889061d..a4245d13f11b83d2dced3d1f82d33f0caa6c34e7 100644 (file)
@@ -286,12 +286,7 @@ static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio)
        switch (pio) {
        case 8:         /* set prefetch off */
        case 9:         /* set prefetch on */
-               /*
-                * take ide_lock for drive->[no_]unmask
-                */
-               spin_lock_irqsave(&ide_lock, flags);
                ht_set_prefetch(drive, pio & 1);
-               spin_unlock_irqrestore(&ide_lock, flags);
                return;
        }
 
index 0e9275d7459ca209b6d8a52f6494222a5895dc07..4aa48104e0c1c5cb3e7d787efa2983ccd4e4899f 100644 (file)
@@ -632,7 +632,6 @@ static void cmd640_set_mode (unsigned int index, u8 pio_mode, unsigned int cycle
 
 static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
 {
-       unsigned long flags;
        unsigned int index = 0, cycle_time;
        u8 b;
 
@@ -655,12 +654,7 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
 
                case 8: /* set prefetch off */
                case 9: /* set prefetch on */
-                       /*
-                        * take ide_lock for drive->[no_]unmask/[no_]io_32bit
-                        */
-                       spin_lock_irqsave(&ide_lock, flags);
                        set_prefetch_mode(index, pio & 1);
-                       spin_unlock_irqrestore(&ide_lock, flags);
                        printk("%s: %sabled cmd640 prefetch\n", drive->name, (pio & 1) ? "en" : "dis");
                        return;
        }