aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r--drivers/ide/ide.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index dfbd74458522..ae5bf2be6f52 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -177,11 +177,7 @@ DECLARE_MUTEX(ide_cfg_sem);
177static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ 177static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */
178#endif 178#endif
179 179
180#ifdef CONFIG_IDEDMA_AUTO
181int noautodma = 0; 180int noautodma = 0;
182#else
183int noautodma = 1;
184#endif
185 181
186EXPORT_SYMBOL(noautodma); 182EXPORT_SYMBOL(noautodma);
187 183
@@ -1128,17 +1124,40 @@ static int set_io_32bit(ide_drive_t *drive, int arg)
1128static int set_using_dma (ide_drive_t *drive, int arg) 1124static int set_using_dma (ide_drive_t *drive, int arg)
1129{ 1125{
1130#ifdef CONFIG_BLK_DEV_IDEDMA 1126#ifdef CONFIG_BLK_DEV_IDEDMA
1127 ide_hwif_t *hwif = drive->hwif;
1128 int err = -EPERM;
1129
1131 if (!drive->id || !(drive->id->capability & 1)) 1130 if (!drive->id || !(drive->id->capability & 1))
1132 return -EPERM; 1131 goto out;
1133 if (HWIF(drive)->ide_dma_check == NULL) 1132
1134 return -EPERM; 1133 if (hwif->ide_dma_check == NULL)
1134 goto out;
1135
1136 err = -EBUSY;
1137 if (ide_spin_wait_hwgroup(drive))
1138 goto out;
1139 /*
1140 * set ->busy flag, unlock and let it ride
1141 */
1142 hwif->hwgroup->busy = 1;
1143 spin_unlock_irq(&ide_lock);
1144
1145 err = 0;
1146
1135 if (arg) { 1147 if (arg) {
1136 if (ide_set_dma(drive)) 1148 if (ide_set_dma(drive) || hwif->ide_dma_on(drive))
1137 return -EIO; 1149 err = -EIO;
1138 if (HWIF(drive)->ide_dma_on(drive)) return -EIO;
1139 } else 1150 } else
1140 ide_dma_off(drive); 1151 ide_dma_off(drive);
1141 return 0; 1152
1153 /*
1154 * lock, clear ->busy flag and unlock before leaving
1155 */
1156 spin_lock_irq(&ide_lock);
1157 hwif->hwgroup->busy = 0;
1158 spin_unlock_irq(&ide_lock);
1159out:
1160 return err;
1142#else 1161#else
1143 return -EPERM; 1162 return -EPERM;
1144#endif 1163#endif
@@ -1943,6 +1962,8 @@ static char *media_string(ide_drive_t *drive)
1943 return "tape"; 1962 return "tape";
1944 case ide_floppy: 1963 case ide_floppy:
1945 return "floppy"; 1964 return "floppy";
1965 case ide_optical:
1966 return "optical";
1946 default: 1967 default:
1947 return "UNKNOWN"; 1968 return "UNKNOWN";
1948 } 1969 }