diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 11:36:43 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 11:36:43 -0400 |
commit | 784506cbddd17bcd5929f827df39b0c7014e3f1e (patch) | |
tree | 1daf7f9d1f8dafe309742c6d136c90923fa2f720 | |
parent | 4764b68405ac918e9ac9939b1a2d1469102e5af7 (diff) |
ide: sanitize handling of IDE_HFLAG_NO_SET_MODE host flag
* Check for IDE_HFLAG_NO_SET_MODE host flag in ide_set_pio(),
ide_set_[pio,dma]_mode(), ide_set_xfer_rate() and set_pio_mode().
* Remove no longer needed IDE_HFLAG_NO_SET_MODE host flag checking
from ide_tune_dma().
* Remove superfluous ->set_pio_mode checking from do_special().
This is a part of preparations for adding 'struct ide_port_ops'.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-dma.c | 3 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 4 | ||||
-rw-r--r-- | drivers/ide/ide-lib.c | 12 | ||||
-rw-r--r-- | drivers/ide/ide.c | 4 |
4 files changed, 13 insertions, 10 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index aaece2c06c9d..8757e5ef6c95 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -706,9 +706,6 @@ static int ide_tune_dma(ide_drive_t *drive) | |||
706 | if (!speed) | 706 | if (!speed) |
707 | return 0; | 707 | return 0; |
708 | 708 | ||
709 | if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE) | ||
710 | return 1; | ||
711 | |||
712 | if (ide_set_dma_mode(drive, speed)) | 709 | if (ide_set_dma_mode(drive, speed)) |
713 | return 0; | 710 | return 0; |
714 | 711 | ||
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 31e5afadb7e9..51d181ee9cf7 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -726,10 +726,6 @@ static ide_startstop_t do_special (ide_drive_t *drive) | |||
726 | s->b.set_tune = 0; | 726 | s->b.set_tune = 0; |
727 | 727 | ||
728 | if (set_pio_mode_abuse(drive->hwif, req_pio)) { | 728 | if (set_pio_mode_abuse(drive->hwif, req_pio)) { |
729 | |||
730 | if (hwif->set_pio_mode == NULL) | ||
731 | return ide_stopped; | ||
732 | |||
733 | /* | 729 | /* |
734 | * take ide_lock for drive->[no_]unmask/[no_]io_32bit | 730 | * take ide_lock for drive->[no_]unmask/[no_]io_32bit |
735 | */ | 731 | */ |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index fa4c194b5ede..c859de77aa8f 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -290,7 +290,8 @@ void ide_set_pio(ide_drive_t *drive, u8 req_pio) | |||
290 | ide_hwif_t *hwif = drive->hwif; | 290 | ide_hwif_t *hwif = drive->hwif; |
291 | u8 host_pio, pio; | 291 | u8 host_pio, pio; |
292 | 292 | ||
293 | if (hwif->set_pio_mode == NULL) | 293 | if (hwif->set_pio_mode == NULL || |
294 | (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) | ||
294 | return; | 295 | return; |
295 | 296 | ||
296 | BUG_ON(hwif->pio_mask == 0x00); | 297 | BUG_ON(hwif->pio_mask == 0x00); |
@@ -343,6 +344,9 @@ int ide_set_pio_mode(ide_drive_t *drive, const u8 mode) | |||
343 | { | 344 | { |
344 | ide_hwif_t *hwif = drive->hwif; | 345 | ide_hwif_t *hwif = drive->hwif; |
345 | 346 | ||
347 | if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE) | ||
348 | return 0; | ||
349 | |||
346 | if (hwif->set_pio_mode == NULL) | 350 | if (hwif->set_pio_mode == NULL) |
347 | return -1; | 351 | return -1; |
348 | 352 | ||
@@ -370,6 +374,9 @@ int ide_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
370 | { | 374 | { |
371 | ide_hwif_t *hwif = drive->hwif; | 375 | ide_hwif_t *hwif = drive->hwif; |
372 | 376 | ||
377 | if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE) | ||
378 | return 0; | ||
379 | |||
373 | if (hwif->set_dma_mode == NULL) | 380 | if (hwif->set_dma_mode == NULL) |
374 | return -1; | 381 | return -1; |
375 | 382 | ||
@@ -400,7 +407,8 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) | |||
400 | { | 407 | { |
401 | ide_hwif_t *hwif = drive->hwif; | 408 | ide_hwif_t *hwif = drive->hwif; |
402 | 409 | ||
403 | if (hwif->set_dma_mode == NULL) | 410 | if (hwif->set_dma_mode == NULL || |
411 | (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) | ||
404 | return -1; | 412 | return -1; |
405 | 413 | ||
406 | rate = ide_rate_filter(drive, rate); | 414 | rate = ide_rate_filter(drive, rate); |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index f04b53cb023f..d868ca44d033 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -584,11 +584,13 @@ out: | |||
584 | int set_pio_mode(ide_drive_t *drive, int arg) | 584 | int set_pio_mode(ide_drive_t *drive, int arg) |
585 | { | 585 | { |
586 | struct request rq; | 586 | struct request rq; |
587 | ide_hwif_t *hwif = drive->hwif; | ||
587 | 588 | ||
588 | if (arg < 0 || arg > 255) | 589 | if (arg < 0 || arg > 255) |
589 | return -EINVAL; | 590 | return -EINVAL; |
590 | 591 | ||
591 | if (drive->hwif->set_pio_mode == NULL) | 592 | if (hwif->set_pio_mode == NULL || |
593 | (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) | ||
592 | return -ENOSYS; | 594 | return -ENOSYS; |
593 | 595 | ||
594 | if (drive->special.b.set_tune) | 596 | if (drive->special.b.set_tune) |