aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-07-19 19:11:58 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-07-19 19:11:58 -0400
commit2134758d2a5429325cee4d4ce8959af5314eeba1 (patch)
treecc0d1326c04522e70c1f52598c9aba29aa85170f
parente5fa4b2968ff0f32b5ecfa082fd6db50b731055e (diff)
ide: drop "PIO data" argument from ide_get_best_pio_mode()
* Drop no longer needed "PIO data" argument from ide_get_best_pio_mode() and convert all users accordingly. * Remove no longer needed ide_pio_data_t. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-lib.c6
-rw-r--r--drivers/ide/legacy/ali14xx.c2
-rw-r--r--drivers/ide/legacy/dtc2278.c2
-rw-r--r--drivers/ide/legacy/ht6560b.c2
-rw-r--r--drivers/ide/legacy/qd65xx.c2
-rw-r--r--drivers/ide/legacy/umc8672.c2
-rw-r--r--drivers/ide/mips/au1xxx-ide.c2
-rw-r--r--drivers/ide/pci/aec62xx.c2
-rw-r--r--drivers/ide/pci/alim15x3.c3
-rw-r--r--drivers/ide/pci/atiixp.c2
-rw-r--r--drivers/ide/pci/cmd640.c2
-rw-r--r--drivers/ide/pci/cmd64x.c2
-rw-r--r--drivers/ide/pci/cs5520.c2
-rw-r--r--drivers/ide/pci/cs5530.c2
-rw-r--r--drivers/ide/pci/cs5535.c6
-rw-r--r--drivers/ide/pci/cy82c693.c2
-rw-r--r--drivers/ide/pci/hpt34x.c2
-rw-r--r--drivers/ide/pci/hpt366.c2
-rw-r--r--drivers/ide/pci/it8213.c4
-rw-r--r--drivers/ide/pci/it821x.c4
-rw-r--r--drivers/ide/pci/jmicron.c2
-rw-r--r--drivers/ide/pci/opti621.c4
-rw-r--r--drivers/ide/pci/pdc202xx_new.c2
-rw-r--r--drivers/ide/pci/pdc202xx_old.c2
-rw-r--r--drivers/ide/pci/piix.c2
-rw-r--r--drivers/ide/pci/sc1200.c2
-rw-r--r--drivers/ide/pci/scc_pata.c2
-rw-r--r--drivers/ide/pci/serverworks.c2
-rw-r--r--drivers/ide/pci/siimage.c4
-rw-r--r--drivers/ide/pci/sis5513.c2
-rw-r--r--drivers/ide/pci/sl82c105.c2
-rw-r--r--drivers/ide/pci/slc90e66.c2
-rw-r--r--drivers/ide/pci/tc86c001.c2
-rw-r--r--drivers/ide/pci/triflex.c2
-rw-r--r--drivers/ide/ppc/mpc8xx.c3
-rw-r--r--drivers/ide/ppc/pmac.c2
-rw-r--r--include/linux/ide.h6
37 files changed, 43 insertions, 53 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 6e85bee0bef7..df29868209f3 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -277,7 +277,6 @@ EXPORT_SYMBOL_GPL(ide_pio_cycle_time);
277 * @drive: drive to consider 277 * @drive: drive to consider
278 * @mode_wanted: preferred mode 278 * @mode_wanted: preferred mode
279 * @max_mode: highest allowed mode 279 * @max_mode: highest allowed mode
280 * @d: PIO data
281 * 280 *
282 * This routine returns the recommended PIO settings for a given drive, 281 * This routine returns the recommended PIO settings for a given drive,
283 * based on the drive->id information and the ide_pio_blacklist[]. 282 * based on the drive->id information and the ide_pio_blacklist[].
@@ -286,7 +285,7 @@ EXPORT_SYMBOL_GPL(ide_pio_cycle_time);
286 * This is used by most chipset support modules when "auto-tuning". 285 * This is used by most chipset support modules when "auto-tuning".
287 */ 286 */
288 287
289u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d) 288u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
290{ 289{
291 int pio_mode; 290 int pio_mode;
292 struct hd_driveid* id = drive->id; 291 struct hd_driveid* id = drive->id;
@@ -335,9 +334,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_p
335 if (pio_mode > max_mode) 334 if (pio_mode > max_mode)
336 pio_mode = max_mode; 335 pio_mode = max_mode;
337 336
338 if (d)
339 d->pio_mode = pio_mode;
340
341 return pio_mode; 337 return pio_mode;
342} 338}
343 339
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 30aeb8750c00..d5c7a57b71c1 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -117,7 +117,7 @@ static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio)
117 unsigned long flags; 117 unsigned long flags;
118 int bus_speed = system_bus_clock(); 118 int bus_speed = system_bus_clock();
119 119
120 pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO, NULL); 120 pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO);
121 121
122 /* calculate timing, according to PIO mode */ 122 /* calculate timing, according to PIO mode */
123 time1 = ide_pio_cycle_time(drive, pio); 123 time1 = ide_pio_cycle_time(drive, pio);
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
index 36a3f0ac6162..8c4c27e5dc10 100644
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -71,7 +71,7 @@ static void tune_dtc2278 (ide_drive_t *drive, u8 pio)
71{ 71{
72 unsigned long flags; 72 unsigned long flags;
73 73
74 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 74 pio = ide_get_best_pio_mode(drive, pio, 4);
75 75
76 if (pio >= 3) { 76 if (pio >= 3) {
77 spin_lock_irqsave(&ide_lock, flags); 77 spin_lock_irqsave(&ide_lock, flags);
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index 85d16812d902..82ed37df9566 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -208,7 +208,7 @@ static u8 ht_pio2timings(ide_drive_t *drive, u8 pio)
208 if (pio) { 208 if (pio) {
209 unsigned int cycle_time; 209 unsigned int cycle_time;
210 210
211 pio = ide_get_best_pio_mode(drive, pio, 5, NULL); 211 pio = ide_get_best_pio_mode(drive, pio, 5);
212 cycle_time = ide_pio_cycle_time(drive, pio); 212 cycle_time = ide_pio_cycle_time(drive, pio);
213 213
214 /* 214 /*
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 233905b08e93..39145102b348 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -258,7 +258,7 @@ static void qd6580_tune_drive (ide_drive_t *drive, u8 pio)
258 int recovery_time = 415; /* worst case values from the dos driver */ 258 int recovery_time = 415; /* worst case values from the dos driver */
259 259
260 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { 260 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) {
261 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 261 pio = ide_get_best_pio_mode(drive, pio, 4);
262 cycle_time = ide_pio_cycle_time(drive, pio); 262 cycle_time = ide_pio_cycle_time(drive, pio);
263 263
264 switch (pio) { 264 switch (pio) {
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
index ddc403a0bd82..caeebd41081f 100644
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -110,7 +110,7 @@ static void tune_umc (ide_drive_t *drive, u8 pio)
110 unsigned long flags; 110 unsigned long flags;
111 ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup; 111 ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup;
112 112
113 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 113 pio = ide_get_best_pio_mode(drive, pio, 4);
114 printk("%s: setting umc8672 to PIO mode%d (speed %d)\n", 114 printk("%s: setting umc8672 to PIO mode%d (speed %d)\n",
115 drive->name, pio, pio_to_umc[pio]); 115 drive->name, pio, pio_to_umc[pio]);
116 spin_lock_irqsave(&ide_lock, flags); 116 spin_lock_irqsave(&ide_lock, flags);
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 2e7013a2a7f6..b0d13c34d310 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -106,7 +106,7 @@ static void auide_tune_drive(ide_drive_t *drive, byte pio)
106 u8 speed; 106 u8 speed;
107 107
108 /* get the best pio mode for the drive */ 108 /* get the best pio mode for the drive */
109 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 109 pio = ide_get_best_pio_mode(drive, pio, 4);
110 110
111 printk(KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n", 111 printk(KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n",
112 drive->name, pio); 112 drive->name, pio);
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index f8ac91c22e64..8396d711f232 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -142,7 +142,7 @@ static int aec6260_tune_chipset (ide_drive_t *drive, u8 xferspeed)
142 142
143static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio) 143static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio)
144{ 144{
145 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 145 pio = ide_get_best_pio_mode(drive, pio, 4);
146 (void) HWIF(drive)->speedproc(drive, pio + XFER_PIO_0); 146 (void) HWIF(drive)->speedproc(drive, pio + XFER_PIO_0);
147} 147}
148 148
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 1012da6e8a42..a0c43a91b0f3 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -295,7 +295,6 @@ static int ali_get_info (char *buffer, char **addr, off_t offset, int count)
295 295
296static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) 296static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio)
297{ 297{
298 ide_pio_data_t d;
299 ide_hwif_t *hwif = HWIF(drive); 298 ide_hwif_t *hwif = HWIF(drive);
300 struct pci_dev *dev = hwif->pci_dev; 299 struct pci_dev *dev = hwif->pci_dev;
301 int s_time, a_time, c_time; 300 int s_time, a_time, c_time;
@@ -307,7 +306,7 @@ static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio)
307 u8 cd_dma_fifo = 0; 306 u8 cd_dma_fifo = 0;
308 int unit = drive->select.b.unit & 1; 307 int unit = drive->select.b.unit & 1;
309 308
310 pio = ide_get_best_pio_mode(drive, pio, 5, &d); 309 pio = ide_get_best_pio_mode(drive, pio, 5);
311 s_time = ide_pio_timings[pio].setup_time; 310 s_time = ide_pio_timings[pio].setup_time;
312 a_time = ide_pio_timings[pio].active_time; 311 a_time = ide_pio_timings[pio].active_time;
313 if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) 312 if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8)
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index 078adbe250d2..a4740e4776fd 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -155,7 +155,7 @@ static void atiixp_tune_pio(ide_drive_t *drive, u8 pio)
155 155
156static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) 156static void atiixp_tuneproc(ide_drive_t *drive, u8 pio)
157{ 157{
158 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 158 pio = ide_get_best_pio_mode(drive, pio, 4);
159 atiixp_tune_pio(drive, pio); 159 atiixp_tune_pio(drive, pio);
160 (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); 160 (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio);
161} 161}
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index 9f67ffc43421..335482981a92 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -661,7 +661,7 @@ static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted)
661 return; 661 return;
662 } 662 }
663 663
664 mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 5, NULL); 664 mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 5);
665 cycle_time = ide_pio_cycle_time(drive, mode_wanted); 665 cycle_time = ide_pio_cycle_time(drive, mode_wanted);
666 cmd640_set_mode(index, mode_wanted, cycle_time); 666 cmd640_set_mode(index, mode_wanted, cycle_time);
667 667
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index c383f6dc67dd..9cf969b61bf2 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -226,7 +226,7 @@ static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted)
226 static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0}; 226 static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0};
227 static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23}; 227 static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23};
228 228
229 pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, NULL); 229 pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5);
230 cycle_time = ide_pio_cycle_time(drive, pio_mode); 230 cycle_time = ide_pio_cycle_time(drive, pio_mode);
231 231
232 cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)\n", 232 cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)\n",
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index 5539a25eae99..ee10e48d7cef 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -126,7 +126,7 @@ static int cs5520_tune_chipset(ide_drive_t *drive, u8 xferspeed)
126 126
127static void cs5520_tune_drive(ide_drive_t *drive, u8 pio) 127static void cs5520_tune_drive(ide_drive_t *drive, u8 pio)
128{ 128{
129 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 129 pio = ide_get_best_pio_mode(drive, pio, 4);
130 cs5520_tune_chipset(drive, (XFER_PIO_0 + pio)); 130 cs5520_tune_chipset(drive, (XFER_PIO_0 + pio));
131} 131}
132 132
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index 643d66cc6729..a75c14a93182 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -82,7 +82,7 @@ static void cs5530_tunepio(ide_drive_t *drive, u8 pio)
82 82
83static void cs5530_tuneproc (ide_drive_t *drive, u8 pio) /* pio=255 means "autotune" */ 83static void cs5530_tuneproc (ide_drive_t *drive, u8 pio) /* pio=255 means "autotune" */
84{ 84{
85 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 85 pio = ide_get_best_pio_mode(drive, pio, 4);
86 86
87 if (cs5530_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0) 87 if (cs5530_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0)
88 cs5530_tunepio(drive, pio); 88 cs5530_tunepio(drive, pio);
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 503979372144..0bff4005292a 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -89,7 +89,7 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
89 89
90 pioa = speed - XFER_PIO_0; 90 pioa = speed - XFER_PIO_0;
91 piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]), 91 piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]),
92 255, 4, NULL); 92 255, 4);
93 cmd = pioa < piob ? pioa : piob; 93 cmd = pioa < piob ? pioa : piob;
94 94
95 /* Write the speed of the current drive */ 95 /* Write the speed of the current drive */
@@ -159,7 +159,7 @@ static void cs5535_tuneproc(ide_drive_t *drive, u8 xferspeed)
159 /* cs5535 max pio is pio 4, best_pio will check the blacklist. 159 /* cs5535 max pio is pio 4, best_pio will check the blacklist.
160 i think we don't need to rate_filter the incoming xferspeed 160 i think we don't need to rate_filter the incoming xferspeed
161 since we know we're only going to choose pio */ 161 since we know we're only going to choose pio */
162 xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4, NULL); 162 xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4);
163 ide_config_drive_speed(drive, modes[xferspeed]); 163 ide_config_drive_speed(drive, modes[xferspeed]);
164 cs5535_set_speed(drive, xferspeed); 164 cs5535_set_speed(drive, xferspeed);
165} 165}
@@ -174,7 +174,7 @@ static int cs5535_dma_check(ide_drive_t *drive)
174 return 0; 174 return 0;
175 175
176 if (ide_use_fast_pio(drive)) { 176 if (ide_use_fast_pio(drive)) {
177 speed = ide_get_best_pio_mode(drive, 255, 4, NULL); 177 speed = ide_get_best_pio_mode(drive, 255, 4);
178 cs5535_set_drive(drive, speed); 178 cs5535_set_drive(drive, speed);
179 } 179 }
180 180
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index 995b72563613..cb7c18187e3c 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -330,7 +330,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio)
330#endif /* CY82C693_DEBUG_LOGS */ 330#endif /* CY82C693_DEBUG_LOGS */
331 331
332 /* first let's calc the pio modes */ 332 /* first let's calc the pio modes */
333 pio = ide_get_best_pio_mode(drive, pio, CY82C693_MAX_PIO, NULL); 333 pio = ide_get_best_pio_mode(drive, pio, CY82C693_MAX_PIO);
334 334
335#if CY82C693_DEBUG_INFO 335#if CY82C693_DEBUG_INFO
336 printk (KERN_INFO "%s: Selected PIO mode %d\n", drive->name, pio); 336 printk (KERN_INFO "%s: Selected PIO mode %d\n", drive->name, pio);
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index 6d2ef0ee0f2b..2e4591303f4f 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -80,7 +80,7 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed)
80 80
81static void hpt34x_tune_drive (ide_drive_t *drive, u8 pio) 81static void hpt34x_tune_drive (ide_drive_t *drive, u8 pio)
82{ 82{
83 pio = ide_get_best_pio_mode(drive, pio, 5, NULL); 83 pio = ide_get_best_pio_mode(drive, pio, 5);
84 (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio)); 84 (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio));
85} 85}
86 86
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 182346a04f36..0a3fe9471eb6 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -652,7 +652,7 @@ static int hpt3xx_tune_chipset(ide_drive_t *drive, u8 speed)
652 652
653static void hpt3xx_tune_drive(ide_drive_t *drive, u8 pio) 653static void hpt3xx_tune_drive(ide_drive_t *drive, u8 pio)
654{ 654{
655 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 655 pio = ide_get_best_pio_mode(drive, pio, 4);
656 (void) hpt3xx_tune_chipset (drive, XFER_PIO_0 + pio); 656 (void) hpt3xx_tune_chipset (drive, XFER_PIO_0 + pio);
657} 657}
658 658
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c
index 684b0ec79f41..d8425a2499bf 100644
--- a/drivers/ide/pci/it8213.c
+++ b/drivers/ide/pci/it8213.c
@@ -82,7 +82,7 @@ static void it8213_tuneproc (ide_drive_t *drive, u8 pio)
82 { 2, 1 }, 82 { 2, 1 },
83 { 2, 3 }, }; 83 { 2, 3 }, };
84 84
85 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 85 pio = ide_get_best_pio_mode(drive, pio, 4);
86 86
87 spin_lock_irqsave(&tune_lock, flags); 87 spin_lock_irqsave(&tune_lock, flags);
88 pci_read_config_word(dev, master_port, &master_data); 88 pci_read_config_word(dev, master_port, &master_data);
@@ -214,7 +214,7 @@ static int it8213_config_drive_for_dma (ide_drive_t *drive)
214 if (ide_tune_dma(drive)) 214 if (ide_tune_dma(drive))
215 return 0; 215 return 0;
216 216
217 pio = ide_get_best_pio_mode(drive, 255, 4, NULL); 217 pio = ide_get_best_pio_mode(drive, 255, 4);
218 it8213_tune_chipset(drive, XFER_PIO_0 + pio); 218 it8213_tune_chipset(drive, XFER_PIO_0 + pio);
219 219
220 return -1; 220 return -1;
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index faccb2d4af43..790233db017b 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -255,7 +255,7 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio)
255 * on the cable. 255 * on the cable.
256 */ 256 */
257 if (pair) { 257 if (pair) {
258 u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4, NULL); 258 u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4);
259 /* trim PIO to the slowest of the master/slave */ 259 /* trim PIO to the slowest of the master/slave */
260 if (pair_pio < set_pio) 260 if (pair_pio < set_pio)
261 set_pio = pair_pio; 261 set_pio = pair_pio;
@@ -276,7 +276,7 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio)
276 276
277static void it821x_tuneproc(ide_drive_t *drive, u8 pio) 277static void it821x_tuneproc(ide_drive_t *drive, u8 pio)
278{ 278{
279 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 279 pio = ide_get_best_pio_mode(drive, pio, 4);
280 (void)it821x_tunepio(drive, pio); 280 (void)it821x_tunepio(drive, pio);
281} 281}
282 282
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index 0edb9cd45854..57d3d4186b3f 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -97,7 +97,7 @@ static void jmicron_tuneproc (ide_drive_t *drive, byte mode_wanted)
97 97
98static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed) 98static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed)
99{ 99{
100 u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5, NULL); 100 u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5);
101 if (set_speed) 101 if (set_speed)
102 (void) ide_config_drive_speed(drive, speed); 102 (void) ide_config_drive_speed(drive, speed);
103} 103}
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index 78d7adf2d0b0..1802ad0927eb 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -147,12 +147,12 @@ static void compute_pios(ide_drive_t *drive, u8 pio)
147 int d; 147 int d;
148 ide_hwif_t *hwif = HWIF(drive); 148 ide_hwif_t *hwif = HWIF(drive);
149 149
150 drive->drive_data = ide_get_best_pio_mode(drive, pio, OPTI621_MAX_PIO, NULL); 150 drive->drive_data = ide_get_best_pio_mode(drive, pio, OPTI621_MAX_PIO);
151 for (d = 0; d < 2; ++d) { 151 for (d = 0; d < 2; ++d) {
152 drive = &hwif->drives[d]; 152 drive = &hwif->drives[d];
153 if (drive->present) { 153 if (drive->present) {
154 if (drive->drive_data == PIO_DONT_KNOW) 154 if (drive->drive_data == PIO_DONT_KNOW)
155 drive->drive_data = ide_get_best_pio_mode(drive, 255, OPTI621_MAX_PIO, NULL); 155 drive->drive_data = ide_get_best_pio_mode(drive, 255, OPTI621_MAX_PIO);
156#ifdef OPTI621_DEBUG 156#ifdef OPTI621_DEBUG
157 printk("%s: Selected PIO mode %d\n", 157 printk("%s: Selected PIO mode %d\n",
158 drive->name, drive->drive_data); 158 drive->name, drive->drive_data);
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index f8508d9cccd3..a8a01b4ab607 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -219,7 +219,7 @@ static int pdcnew_tune_chipset(ide_drive_t *drive, u8 speed)
219 219
220static void pdcnew_tune_drive(ide_drive_t *drive, u8 pio) 220static void pdcnew_tune_drive(ide_drive_t *drive, u8 pio)
221{ 221{
222 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 222 pio = ide_get_best_pio_mode(drive, pio, 4);
223 (void)pdcnew_tune_chipset(drive, XFER_PIO_0 + pio); 223 (void)pdcnew_tune_chipset(drive, XFER_PIO_0 + pio);
224} 224}
225 225
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index eb4e4a61d06e..3a6882d4aa64 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -145,7 +145,7 @@ static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed)
145 145
146static void pdc202xx_tune_drive(ide_drive_t *drive, u8 pio) 146static void pdc202xx_tune_drive(ide_drive_t *drive, u8 pio)
147{ 147{
148 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 148 pio = ide_get_best_pio_mode(drive, pio, 4);
149 pdc202xx_tune_chipset(drive, XFER_PIO_0 + pio); 149 pdc202xx_tune_chipset(drive, XFER_PIO_0 + pio);
150} 150}
151 151
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index a4f88d25b16d..41a3612c6107 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -219,7 +219,7 @@ static void piix_tune_pio (ide_drive_t *drive, u8 pio)
219 */ 219 */
220static void piix_tune_drive (ide_drive_t *drive, u8 pio) 220static void piix_tune_drive (ide_drive_t *drive, u8 pio)
221{ 221{
222 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 222 pio = ide_get_best_pio_mode(drive, pio, 4);
223 piix_tune_pio(drive, pio); 223 piix_tune_pio(drive, pio);
224 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); 224 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio);
225} 225}
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index 9ac8889f8ad3..98e1a2bd9501 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -304,7 +304,7 @@ static void sc1200_tuneproc (ide_drive_t *drive, byte pio) /* mode=255 means "au
304 return; 304 return;
305 } 305 }
306 306
307 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 307 pio = ide_get_best_pio_mode(drive, pio, 4);
308 printk("SC1200: %s: setting PIO mode%d\n", drive->name, pio); 308 printk("SC1200: %s: setting PIO mode%d\n", drive->name, pio);
309 309
310 if (sc1200_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0) 310 if (sc1200_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0)
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index a1954d1c2879..2c76355b92e8 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -210,7 +210,7 @@ static void scc_tuneproc(ide_drive_t *drive, byte mode_wanted)
210 unsigned char speed = XFER_PIO_0; 210 unsigned char speed = XFER_PIO_0;
211 int offset; 211 int offset;
212 212
213 mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4, NULL); 213 mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4);
214 switch (mode_wanted) { 214 switch (mode_wanted) {
215 case 4: 215 case 4:
216 speed = XFER_PIO_4; 216 speed = XFER_PIO_4;
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index abc3cd58aaa9..1fe29d9e68fa 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -205,7 +205,7 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
205 205
206static void svwks_tune_drive (ide_drive_t *drive, u8 pio) 206static void svwks_tune_drive (ide_drive_t *drive, u8 pio)
207{ 207{
208 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 208 pio = ide_get_best_pio_mode(drive, pio, 4);
209 svwks_tune_pio(drive, pio); 209 svwks_tune_pio(drive, pio);
210 (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); 210 (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio);
211} 211}
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 47b9b94afe05..63a8a93d63d6 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -189,7 +189,7 @@ static void sil_tune_pio(ide_drive_t *drive, u8 pio)
189 189
190 /* trim *taskfile* PIO to the slowest of the master/slave */ 190 /* trim *taskfile* PIO to the slowest of the master/slave */
191 if (pair->present) { 191 if (pair->present) {
192 u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4, NULL); 192 u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4);
193 193
194 if (pair_pio < tf_pio) 194 if (pair_pio < tf_pio)
195 tf_pio = pair_pio; 195 tf_pio = pair_pio;
@@ -221,7 +221,7 @@ static void sil_tune_pio(ide_drive_t *drive, u8 pio)
221 221
222static void sil_tuneproc(ide_drive_t *drive, u8 pio) 222static void sil_tuneproc(ide_drive_t *drive, u8 pio)
223{ 223{
224 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 224 pio = ide_get_best_pio_mode(drive, pio, 4);
225 sil_tune_pio(drive, pio); 225 sil_tune_pio(drive, pio);
226 (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); 226 (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio);
227} 227}
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index bbc502087578..3c4693695ca3 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -521,7 +521,7 @@ static void config_art_rwp_pio (ide_drive_t *drive, u8 pio)
521 521
522static int sis5513_tune_drive(ide_drive_t *drive, u8 pio) 522static int sis5513_tune_drive(ide_drive_t *drive, u8 pio)
523{ 523{
524 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 524 pio = ide_get_best_pio_mode(drive, pio, 4);
525 config_art_rwp_pio(drive, pio); 525 config_art_rwp_pio(drive, pio);
526 return ide_config_drive_speed(drive, XFER_PIO_0 + pio); 526 return ide_config_drive_speed(drive, XFER_PIO_0 + pio);
527} 527}
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index cc5f69b7514f..4e8f32e643a6 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -83,7 +83,7 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio)
83 83
84 DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio)); 84 DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio));
85 85
86 pio = ide_get_best_pio_mode(drive, pio, 5, NULL); 86 pio = ide_get_best_pio_mode(drive, pio, 5);
87 87
88 drv_ctrl = get_pio_timings(drive, pio); 88 drv_ctrl = get_pio_timings(drive, pio);
89 89
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 115bcaefc8ee..562747fbee39 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -103,7 +103,7 @@ static void slc90e66_tune_pio (ide_drive_t *drive, u8 pio)
103 103
104static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) 104static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio)
105{ 105{
106 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 106 pio = ide_get_best_pio_mode(drive, pio, 4);
107 slc90e66_tune_pio(drive, pio); 107 slc90e66_tune_pio(drive, pio);
108 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); 108 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio);
109} 109}
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c
index 1d40b0820f50..2479a19f0094 100644
--- a/drivers/ide/pci/tc86c001.c
+++ b/drivers/ide/pci/tc86c001.c
@@ -47,7 +47,7 @@ static int tc86c001_tune_chipset(ide_drive_t *drive, u8 speed)
47 47
48static void tc86c001_tune_drive(ide_drive_t *drive, u8 pio) 48static void tc86c001_tune_drive(ide_drive_t *drive, u8 pio)
49{ 49{
50 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 50 pio = ide_get_best_pio_mode(drive, pio, 4);
51 (void) tc86c001_tune_chipset(drive, XFER_PIO_0 + pio); 51 (void) tc86c001_tune_chipset(drive, XFER_PIO_0 + pio);
52} 52}
53 53
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index 801314fe3524..f8fef905bacc 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -96,7 +96,7 @@ static int triflex_tune_chipset(ide_drive_t *drive, u8 xferspeed)
96 96
97static void triflex_tune_drive(ide_drive_t *drive, u8 pio) 97static void triflex_tune_drive(ide_drive_t *drive, u8 pio)
98{ 98{
99 int use_pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 99 int use_pio = ide_get_best_pio_mode(drive, pio, 4);
100 (void) triflex_tune_chipset(drive, (XFER_PIO_0 + use_pio)); 100 (void) triflex_tune_chipset(drive, (XFER_PIO_0 + use_pio));
101} 101}
102 102
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index 82de2d781f2e..f3789c0e6cc9 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -431,13 +431,12 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
431static void 431static void
432m8xx_ide_tuneproc(ide_drive_t *drive, u8 pio) 432m8xx_ide_tuneproc(ide_drive_t *drive, u8 pio)
433{ 433{
434 ide_pio_data_t d;
435#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) 434#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
436 volatile pcmconf8xx_t *pcmp; 435 volatile pcmconf8xx_t *pcmp;
437 ulong timing, mask, reg; 436 ulong timing, mask, reg;
438#endif 437#endif
439 438
440 pio = ide_get_best_pio_mode(drive, pio, 4, &d); 439 pio = ide_get_best_pio_mode(drive, pio, 4);
441 440
442#if 1 441#if 1
443 printk("%s[%d] %s: best PIO mode: %d\n", 442 printk("%s[%d] %s: best PIO mode: %d\n",
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 669330521fc1..debaa8823f51 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -627,7 +627,7 @@ pmac_ide_tuneproc(ide_drive_t *drive, u8 pio)
627 /* which drive is it ? */ 627 /* which drive is it ? */
628 timings = &pmif->timings[drive->select.b.unit & 0x01]; 628 timings = &pmif->timings[drive->select.b.unit & 0x01];
629 629
630 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 630 pio = ide_get_best_pio_mode(drive, pio, 4);
631 cycle_time = ide_pio_cycle_time(drive, pio); 631 cycle_time = ide_pio_cycle_time(drive, pio);
632 632
633 switch (pmif->kind) { 633 switch (pmif->kind) {
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 0afa52c14ffa..14a87f619d17 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1377,12 +1377,8 @@ typedef struct ide_pio_timings_s {
1377 /* active + recovery (+ setup for some chips) */ 1377 /* active + recovery (+ setup for some chips) */
1378} ide_pio_timings_t; 1378} ide_pio_timings_t;
1379 1379
1380typedef struct ide_pio_data_s {
1381 u8 pio_mode;
1382} ide_pio_data_t;
1383
1384unsigned int ide_pio_cycle_time(ide_drive_t *, u8); 1380unsigned int ide_pio_cycle_time(ide_drive_t *, u8);
1385extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d); 1381u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1386extern const ide_pio_timings_t ide_pio_timings[6]; 1382extern const ide_pio_timings_t ide_pio_timings[6];
1387 1383
1388 1384