aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-taskfile.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-05 20:57:51 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-05 20:57:51 -0500
commitc47137a99c597330b69057158b26061a360c0e09 (patch)
treeaacd4cb968b8d7bdebdcbcce19f110469a977243 /drivers/ide/ide-taskfile.c
parent29dd59755a849cc6475faa6a75f3b804e23a6fc2 (diff)
ide: add ide_read_[alt]status() inline helpers
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r--drivers/ide/ide-taskfile.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 4e1da1c78cb5..2545dde6ee02 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -189,12 +189,11 @@ EXPORT_SYMBOL_GPL(do_rw_taskfile);
189 */ 189 */
190static ide_startstop_t set_multmode_intr(ide_drive_t *drive) 190static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
191{ 191{
192 ide_hwif_t *hwif = HWIF(drive); 192 u8 stat = ide_read_status(drive);
193 u8 stat;
194 193
195 if (OK_STAT(stat = hwif->INB(IDE_STATUS_REG),READY_STAT,BAD_STAT)) { 194 if (OK_STAT(stat, READY_STAT, BAD_STAT))
196 drive->mult_count = drive->mult_req; 195 drive->mult_count = drive->mult_req;
197 } else { 196 else {
198 drive->mult_req = drive->mult_count = 0; 197 drive->mult_req = drive->mult_count = 0;
199 drive->special.b.recalibrate = 1; 198 drive->special.b.recalibrate = 1;
200 (void) ide_dump_status(drive, "set_multmode", stat); 199 (void) ide_dump_status(drive, "set_multmode", stat);
@@ -207,11 +206,10 @@ static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
207 */ 206 */
208static ide_startstop_t set_geometry_intr(ide_drive_t *drive) 207static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
209{ 208{
210 ide_hwif_t *hwif = HWIF(drive);
211 int retries = 5; 209 int retries = 5;
212 u8 stat; 210 u8 stat;
213 211
214 while (((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) && retries--) 212 while (((stat = ide_read_status(drive)) & BUSY_STAT) && retries--)
215 udelay(10); 213 udelay(10);
216 214
217 if (OK_STAT(stat, READY_STAT, BAD_STAT)) 215 if (OK_STAT(stat, READY_STAT, BAD_STAT))
@@ -230,10 +228,9 @@ static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
230 */ 228 */
231static ide_startstop_t recal_intr(ide_drive_t *drive) 229static ide_startstop_t recal_intr(ide_drive_t *drive)
232{ 230{
233 ide_hwif_t *hwif = HWIF(drive); 231 u8 stat = ide_read_status(drive);
234 u8 stat;
235 232
236 if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG), READY_STAT, BAD_STAT)) 233 if (!OK_STAT(stat, READY_STAT, BAD_STAT))
237 return ide_error(drive, "recal_intr", stat); 234 return ide_error(drive, "recal_intr", stat);
238 return ide_stopped; 235 return ide_stopped;
239} 236}
@@ -248,10 +245,12 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
248 u8 stat; 245 u8 stat;
249 246
250 local_irq_enable_in_hardirq(); 247 local_irq_enable_in_hardirq();
251 if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG),READY_STAT,BAD_STAT)) { 248 stat = ide_read_status(drive);
249
250 if (!OK_STAT(stat, READY_STAT, BAD_STAT))
252 return ide_error(drive, "task_no_data_intr", stat); 251 return ide_error(drive, "task_no_data_intr", stat);
253 /* calls ide_end_drive_cmd */ 252 /* calls ide_end_drive_cmd */
254 } 253
255 if (args) 254 if (args)
256 ide_end_drive_cmd(drive, stat, hwif->INB(IDE_ERROR_REG)); 255 ide_end_drive_cmd(drive, stat, hwif->INB(IDE_ERROR_REG));
257 256
@@ -260,7 +259,6 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
260 259
261static u8 wait_drive_not_busy(ide_drive_t *drive) 260static u8 wait_drive_not_busy(ide_drive_t *drive)
262{ 261{
263 ide_hwif_t *hwif = HWIF(drive);
264 int retries; 262 int retries;
265 u8 stat; 263 u8 stat;
266 264
@@ -269,7 +267,9 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
269 * This can take up to 10 usec, but we will wait max 1 ms. 267 * This can take up to 10 usec, but we will wait max 1 ms.
270 */ 268 */
271 for (retries = 0; retries < 100; retries++) { 269 for (retries = 0; retries < 100; retries++) {
272 if ((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) 270 stat = ide_read_status(drive);
271
272 if (stat & BUSY_STAT)
273 udelay(10); 273 udelay(10);
274 else 274 else
275 break; 275 break;
@@ -430,7 +430,7 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive)
430{ 430{
431 ide_hwif_t *hwif = drive->hwif; 431 ide_hwif_t *hwif = drive->hwif;
432 struct request *rq = HWGROUP(drive)->rq; 432 struct request *rq = HWGROUP(drive)->rq;
433 u8 stat = hwif->INB(IDE_STATUS_REG); 433 u8 stat = ide_read_status(drive);
434 434
435 /* new way for dealing with premature shared PCI interrupts */ 435 /* new way for dealing with premature shared PCI interrupts */
436 if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) { 436 if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) {
@@ -465,7 +465,7 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive)
465{ 465{
466 ide_hwif_t *hwif = drive->hwif; 466 ide_hwif_t *hwif = drive->hwif;
467 struct request *rq = HWGROUP(drive)->rq; 467 struct request *rq = HWGROUP(drive)->rq;
468 u8 stat = hwif->INB(IDE_STATUS_REG); 468 u8 stat = ide_read_status(drive);
469 469
470 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) 470 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
471 return task_error(drive, rq, __FUNCTION__, stat); 471 return task_error(drive, rq, __FUNCTION__, stat);