aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 11:36:42 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 11:36:42 -0400
commitd07616f19336b514eef06e6a361988c4073e6ecb (patch)
tree0c5c57185532b45bc6de5e3590beb9c2d94869d3 /drivers/ide
parent1134b6fec57de7de2c56485bcd2afd9c16295dcb (diff)
qd65xx: always use ->selectproc method
qd_select() checks itself whether timings should be reprogrammed so remove superfluous qd_timing_ok() and always use ->selectproc method (rename qd_select() to qd65xx_select() while at it). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/legacy/qd65xx.c37
1 files changed, 10 insertions, 27 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index b693a5f21a42..ad4ec2c42a5a 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -88,12 +88,12 @@
88static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ 88static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */
89 89
90/* 90/*
91 * qd_select: 91 * qd65xx_select:
92 * 92 *
93 * This routine is invoked from ide.c to prepare for access to a given drive. 93 * This routine is invoked to prepare for access to a given drive.
94 */ 94 */
95 95
96static void qd_select (ide_drive_t *drive) 96static void qd65xx_select(ide_drive_t *drive)
97{ 97{
98 u8 index = (( (QD_TIMREG(drive)) & 0x80 ) >> 7) | 98 u8 index = (( (QD_TIMREG(drive)) & 0x80 ) >> 7) |
99 (QD_TIMREG(drive) & 0x02); 99 (QD_TIMREG(drive) & 0x02);
@@ -168,36 +168,15 @@ static int qd_find_disk_type (ide_drive_t *drive,
168} 168}
169 169
170/* 170/*
171 * qd_timing_ok:
172 *
173 * check whether timings don't conflict
174 */
175
176static int qd_timing_ok (ide_drive_t drives[])
177{
178 return (IDE_IMPLY(drives[0].present && drives[1].present,
179 IDE_IMPLY(QD_TIMREG(drives) == QD_TIMREG(drives+1),
180 QD_TIMING(drives) == QD_TIMING(drives+1))));
181 /* if same timing register, must be same timing */
182}
183
184/*
185 * qd_set_timing: 171 * qd_set_timing:
186 * 172 *
187 * records the timing, and enables selectproc as needed 173 * records the timing
188 */ 174 */
189 175
190static void qd_set_timing (ide_drive_t *drive, u8 timing) 176static void qd_set_timing (ide_drive_t *drive, u8 timing)
191{ 177{
192 ide_hwif_t *hwif = HWIF(drive);
193
194 drive->drive_data &= 0xff00; 178 drive->drive_data &= 0xff00;
195 drive->drive_data |= timing; 179 drive->drive_data |= timing;
196 if (qd_timing_ok(hwif->drives)) {
197 qd_select(drive); /* selects once */
198 hwif->selectproc = NULL;
199 } else
200 hwif->selectproc = &qd_select;
201 180
202 printk(KERN_DEBUG "%s: %#x\n", drive->name, timing); 181 printk(KERN_DEBUG "%s: %#x\n", drive->name, timing);
203} 182}
@@ -400,7 +379,8 @@ static int __init qd_probe(int base)
400 qd_setup(hwif, base, config); 379 qd_setup(hwif, base, config);
401 380
402 hwif->port_init_devs = qd6500_port_init_devs; 381 hwif->port_init_devs = qd6500_port_init_devs;
403 hwif->set_pio_mode = &qd6500_set_pio_mode; 382 hwif->set_pio_mode = qd6500_set_pio_mode;
383 hwif->selectproc = qd65xx_select;
404 384
405 idx[unit] = hwif->index; 385 idx[unit] = hwif->index;
406 386
@@ -441,7 +421,8 @@ static int __init qd_probe(int base)
441 qd_setup(hwif, base, config | (control << 8)); 421 qd_setup(hwif, base, config | (control << 8));
442 422
443 hwif->port_init_devs = qd6580_port_init_devs; 423 hwif->port_init_devs = qd6580_port_init_devs;
444 hwif->set_pio_mode = &qd6580_set_pio_mode; 424 hwif->set_pio_mode = qd6580_set_pio_mode;
425 hwif->selectproc = qd65xx_select;
445 426
446 idx[unit] = hwif->index; 427 idx[unit] = hwif->index;
447 428
@@ -460,6 +441,7 @@ static int __init qd_probe(int base)
460 qd_setup(hwif, base, config | (control << 8)); 441 qd_setup(hwif, base, config | (control << 8));
461 hwif->port_init_devs = qd6580_port_init_devs; 442 hwif->port_init_devs = qd6580_port_init_devs;
462 hwif->set_pio_mode = qd6580_set_pio_mode; 443 hwif->set_pio_mode = qd6580_set_pio_mode;
444 hwif->selectproc = qd65xx_select;
463 idx[0] = hwif->index; 445 idx[0] = hwif->index;
464 } 446 }
465 447
@@ -469,6 +451,7 @@ static int __init qd_probe(int base)
469 qd_setup(mate, base, config | (control << 8)); 451 qd_setup(mate, base, config | (control << 8));
470 mate->port_init_devs = qd6580_port_init_devs; 452 mate->port_init_devs = qd6580_port_init_devs;
471 mate->set_pio_mode = qd6580_set_pio_mode; 453 mate->set_pio_mode = qd6580_set_pio_mode;
454 mate->selectproc = qd65xx_select;
472 idx[1] = mate->index; 455 idx[1] = mate->index;
473 } 456 }
474 457