summaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-lib.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 17:36:43 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 17:36:43 +0200
commit784506cbddd17bcd5929f827df39b0c7014e3f1e (patch)
tree1daf7f9d1f8dafe309742c6d136c90923fa2f720 /drivers/ide/ide-lib.c
parent4764b68405ac918e9ac9939b1a2d1469102e5af7 (diff)
downloadlinux-784506cbddd17bcd5929f827df39b0c7014e3f1e.tar.bz2
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>
Diffstat (limited to 'drivers/ide/ide-lib.c')
-rw-r--r--drivers/ide/ide-lib.c12
1 files changed, 10 insertions, 2 deletions
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)
ide_hwif_t *hwif = drive->hwif;
u8 host_pio, pio;
- if (hwif->set_pio_mode == NULL)
+ if (hwif->set_pio_mode == NULL ||
+ (hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
return;
BUG_ON(hwif->pio_mask == 0x00);
@@ -343,6 +344,9 @@ int ide_set_pio_mode(ide_drive_t *drive, const u8 mode)
{
ide_hwif_t *hwif = drive->hwif;
+ if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
+ return 0;
+
if (hwif->set_pio_mode == NULL)
return -1;
@@ -370,6 +374,9 @@ int ide_set_dma_mode(ide_drive_t *drive, const u8 mode)
{
ide_hwif_t *hwif = drive->hwif;
+ if (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)
+ return 0;
+
if (hwif->set_dma_mode == NULL)
return -1;
@@ -400,7 +407,8 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate)
{
ide_hwif_t *hwif = drive->hwif;
- if (hwif->set_dma_mode == NULL)
+ if (hwif->set_dma_mode == NULL ||
+ (hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
return -1;
rate = ide_rate_filter(drive, rate);