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;
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;
}
static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
{
- unsigned long flags;
unsigned int index = 0, cycle_time;
u8 b;
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;
}