diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:26 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:26 -0400 |
commit | 7e59ea21aab1a91ca31bc64c7d3035ebdbd336d1 (patch) | |
tree | 6cdbc937687dbba316f22e2b68cb036511fce951 /drivers | |
parent | 2a924662b646fa25cb491d50aa1202a94aa4ac55 (diff) |
ide: check drive->present in ide_get_paired_drive()
* Change ide_get_paired_drive() to return NULL if peer device
is not present and update all users accordingly.
While at it:
* ide_get_paired_drive() -> ide_get_pair_dev()
* Use ide_get_pair_dev() in cs5530.c, sc1200.c and via82cxxx.c.
There should be no functional changes caused by this patch.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/arm/palm_bk3710.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/cs5530.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/cs5535.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/opti621.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/sc1200.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/siimage.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/via82cxxx.c | 4 |
7 files changed, 14 insertions, 14 deletions
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c index 6cea984776fd..320971c78cb7 100644 --- a/drivers/ide/arm/palm_bk3710.c +++ b/drivers/ide/arm/palm_bk3710.c | |||
@@ -180,7 +180,7 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate, | |||
180 | val32 |= (t2i << (dev ? 8 : 0)); | 180 | val32 |= (t2i << (dev ? 8 : 0)); |
181 | writel(val32, base + BK3710_DATRCVR); | 181 | writel(val32, base + BK3710_DATRCVR); |
182 | 182 | ||
183 | if (mate && mate->present) { | 183 | if (mate) { |
184 | u8 mode2 = ide_get_best_pio_mode(mate, 255, 4); | 184 | u8 mode2 = ide_get_best_pio_mode(mate, 255, 4); |
185 | 185 | ||
186 | if (mode2 < mode) | 186 | if (mode2 < mode) |
@@ -230,7 +230,7 @@ static void palm_bk3710_set_pio_mode(ide_drive_t *drive, u8 pio) | |||
230 | * Obtain the drive PIO data for tuning the Palm Chip registers | 230 | * Obtain the drive PIO data for tuning the Palm Chip registers |
231 | */ | 231 | */ |
232 | cycle_time = ide_pio_cycle_time(drive, pio); | 232 | cycle_time = ide_pio_cycle_time(drive, pio); |
233 | mate = ide_get_paired_drive(drive); | 233 | mate = ide_get_pair_dev(drive); |
234 | palm_bk3710_setpiomode(base, mate, is_slave, cycle_time, pio); | 234 | palm_bk3710_setpiomode(base, mate, is_slave, cycle_time, pio); |
235 | } | 235 | } |
236 | 236 | ||
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index ef91e9d7c54f..804ecabbd65f 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
@@ -81,11 +81,11 @@ static void cs5530_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
81 | static u8 cs5530_udma_filter(ide_drive_t *drive) | 81 | static u8 cs5530_udma_filter(ide_drive_t *drive) |
82 | { | 82 | { |
83 | ide_hwif_t *hwif = drive->hwif; | 83 | ide_hwif_t *hwif = drive->hwif; |
84 | ide_drive_t *mate = &hwif->drives[(drive->dn & 1) ^ 1]; | 84 | ide_drive_t *mate = ide_get_pair_dev(drive); |
85 | u16 *mateid = mate->id; | 85 | u16 *mateid = mate->id; |
86 | u8 mask = hwif->ultra_mask; | 86 | u8 mask = hwif->ultra_mask; |
87 | 87 | ||
88 | if (mate->present == 0) | 88 | if (mate == NULL) |
89 | goto out; | 89 | goto out; |
90 | 90 | ||
91 | if (ata_id_has_dma(mateid) && __ide_dma_bad_drive(mate) == 0) { | 91 | if (ata_id_has_dma(mateid) && __ide_dma_bad_drive(mate) == 0) { |
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index dd3dc23af995..707d2e182552 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c | |||
@@ -80,12 +80,12 @@ static void cs5535_set_speed(ide_drive_t *drive, const u8 speed) | |||
80 | 80 | ||
81 | /* Set the PIO timings */ | 81 | /* Set the PIO timings */ |
82 | if (speed < XFER_SW_DMA_0) { | 82 | if (speed < XFER_SW_DMA_0) { |
83 | ide_drive_t *pair = ide_get_paired_drive(drive); | 83 | ide_drive_t *pair = ide_get_pair_dev(drive); |
84 | u8 cmd, pioa; | 84 | u8 cmd, pioa; |
85 | 85 | ||
86 | cmd = pioa = speed - XFER_PIO_0; | 86 | cmd = pioa = speed - XFER_PIO_0; |
87 | 87 | ||
88 | if (pair->present) { | 88 | if (pair) { |
89 | u8 piob = ide_get_best_pio_mode(pair, 255, 4); | 89 | u8 piob = ide_get_best_pio_mode(pair, 255, 4); |
90 | 90 | ||
91 | if (piob < cmd) | 91 | if (piob < cmd) |
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index e28e672ddafc..e913da479808 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c | |||
@@ -137,7 +137,7 @@ static u8 read_reg(int reg) | |||
137 | static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) | 137 | static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) |
138 | { | 138 | { |
139 | ide_hwif_t *hwif = drive->hwif; | 139 | ide_hwif_t *hwif = drive->hwif; |
140 | ide_drive_t *pair = ide_get_paired_drive(drive); | 140 | ide_drive_t *pair = ide_get_pair_dev(drive); |
141 | unsigned long flags; | 141 | unsigned long flags; |
142 | u8 tim, misc, addr_pio = pio, clk; | 142 | u8 tim, misc, addr_pio = pio, clk; |
143 | 143 | ||
@@ -153,7 +153,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
153 | 153 | ||
154 | drive->drive_data = XFER_PIO_0 + pio; | 154 | drive->drive_data = XFER_PIO_0 + pio; |
155 | 155 | ||
156 | if (pair->present) { | 156 | if (pair) { |
157 | if (pair->drive_data && pair->drive_data < drive->drive_data) | 157 | if (pair->drive_data && pair->drive_data < drive->drive_data) |
158 | addr_pio = pair->drive_data - XFER_PIO_0; | 158 | addr_pio = pair->drive_data - XFER_PIO_0; |
159 | } | 159 | } |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 695cc9742048..37326d2205b8 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -104,11 +104,11 @@ static void sc1200_tunepio(ide_drive_t *drive, u8 pio) | |||
104 | static u8 sc1200_udma_filter(ide_drive_t *drive) | 104 | static u8 sc1200_udma_filter(ide_drive_t *drive) |
105 | { | 105 | { |
106 | ide_hwif_t *hwif = drive->hwif; | 106 | ide_hwif_t *hwif = drive->hwif; |
107 | ide_drive_t *mate = &hwif->drives[(drive->dn & 1) ^ 1]; | 107 | ide_drive_t *mate = ide_get_pair_dev(drive); |
108 | u16 *mateid = mate->id; | 108 | u16 *mateid = mate->id; |
109 | u8 mask = hwif->ultra_mask; | 109 | u8 mask = hwif->ultra_mask; |
110 | 110 | ||
111 | if (mate->present == 0) | 111 | if (mate == NULL) |
112 | goto out; | 112 | goto out; |
113 | 113 | ||
114 | if (ata_id_has_dma(mateid) && __ide_dma_bad_drive(mate) == 0) { | 114 | if (ata_id_has_dma(mateid) && __ide_dma_bad_drive(mate) == 0) { |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 7b5bd8729f64..83c36e6035fa 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -245,7 +245,7 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) | |||
245 | 245 | ||
246 | ide_hwif_t *hwif = HWIF(drive); | 246 | ide_hwif_t *hwif = HWIF(drive); |
247 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 247 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
248 | ide_drive_t *pair = ide_get_paired_drive(drive); | 248 | ide_drive_t *pair = ide_get_pair_dev(drive); |
249 | u32 speedt = 0; | 249 | u32 speedt = 0; |
250 | u16 speedp = 0; | 250 | u16 speedp = 0; |
251 | unsigned long addr = siimage_seldev(drive, 0x04); | 251 | unsigned long addr = siimage_seldev(drive, 0x04); |
@@ -259,7 +259,7 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) | |||
259 | u8 unit = drive->select.b.unit; | 259 | u8 unit = drive->select.b.unit; |
260 | 260 | ||
261 | /* trim *taskfile* PIO to the slowest of the master/slave */ | 261 | /* trim *taskfile* PIO to the slowest of the master/slave */ |
262 | if (pair->present) { | 262 | if (pair) { |
263 | u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4); | 263 | u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4); |
264 | 264 | ||
265 | if (pair_pio < tf_pio) | 265 | if (pair_pio < tf_pio) |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 94fb9ab3223f..9cb531dc905a 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -154,7 +154,7 @@ static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) | |||
154 | static void via_set_drive(ide_drive_t *drive, const u8 speed) | 154 | static void via_set_drive(ide_drive_t *drive, const u8 speed) |
155 | { | 155 | { |
156 | ide_hwif_t *hwif = drive->hwif; | 156 | ide_hwif_t *hwif = drive->hwif; |
157 | ide_drive_t *peer = hwif->drives + (~drive->dn & 1); | 157 | ide_drive_t *peer = ide_get_pair_dev(drive); |
158 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 158 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
159 | struct ide_host *host = pci_get_drvdata(dev); | 159 | struct ide_host *host = pci_get_drvdata(dev); |
160 | struct via82cxxx_dev *vdev = host->host_priv; | 160 | struct via82cxxx_dev *vdev = host->host_priv; |
@@ -173,7 +173,7 @@ static void via_set_drive(ide_drive_t *drive, const u8 speed) | |||
173 | 173 | ||
174 | ide_timing_compute(drive, speed, &t, T, UT); | 174 | ide_timing_compute(drive, speed, &t, T, UT); |
175 | 175 | ||
176 | if (peer->present) { | 176 | if (peer) { |
177 | ide_timing_compute(peer, peer->current_speed, &p, T, UT); | 177 | ide_timing_compute(peer, peer->current_speed, &p, T, UT); |
178 | ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); | 178 | ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); |
179 | } | 179 | } |