diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:16 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:16 -0400 |
commit | 0bfeee7d4190938291a76536c7f6cd8f4e2dc30c (patch) | |
tree | 94d8a02a4f184852836ae1e1ef5cbb8415238127 | |
parent | 3b36f66b81bc0d69ec7dfa736592224f6ca366b7 (diff) |
ide: use ide_legacy_device_add() for qd65xx (take 2)
* Add 'unsigned long config' argument to ide_legacy_device_add()
for setting hwif->config_data.
* Use ide_find_port_slot() instead of ide_find_port() in
ide_legacy_device_add().
* Handle IDE_HFLAG_QD_2ND_PORT and IDE_HFLAG_SINGLE host flags in
ide_legacy_device_add().
* Convert qd65xx host driver to use ide_legacy_device_add().
v2:
* Update ali14xx, dtc2278, ht6560b and umc8672 host drivers.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-probe.c | 19 | ||||
-rw-r--r-- | drivers/ide/legacy/ali14xx.c | 2 | ||||
-rw-r--r-- | drivers/ide/legacy/dtc2278.c | 2 | ||||
-rw-r--r-- | drivers/ide/legacy/ht6560b.c | 2 | ||||
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 58 | ||||
-rw-r--r-- | drivers/ide/legacy/umc8672.c | 2 | ||||
-rw-r--r-- | include/linux/ide.h | 2 |
7 files changed, 26 insertions, 61 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 8cad2b4c694f..ba16ade15c8c 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1634,7 +1634,7 @@ void ide_port_scan(ide_hwif_t *hwif) | |||
1634 | } | 1634 | } |
1635 | EXPORT_SYMBOL_GPL(ide_port_scan); | 1635 | EXPORT_SYMBOL_GPL(ide_port_scan); |
1636 | 1636 | ||
1637 | int ide_legacy_device_add(const struct ide_port_info *d) | 1637 | int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config) |
1638 | { | 1638 | { |
1639 | ide_hwif_t *hwif, *mate; | 1639 | ide_hwif_t *hwif, *mate; |
1640 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 1640 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
@@ -1648,15 +1648,24 @@ int ide_legacy_device_add(const struct ide_port_info *d) | |||
1648 | ide_std_init_ports(&hw[1], 0x170, 0x376); | 1648 | ide_std_init_ports(&hw[1], 0x170, 0x376); |
1649 | hw[1].irq = 15; | 1649 | hw[1].irq = 15; |
1650 | 1650 | ||
1651 | hwif = ide_find_port(); | 1651 | hwif = ide_find_port_slot(d); |
1652 | if (hwif) { | 1652 | if (hwif) { |
1653 | ide_init_port_hw(hwif, &hw[0]); | 1653 | u8 j = (d->host_flags & IDE_HFLAG_QD_2ND_PORT) ? 1 : 0; |
1654 | idx[0] = hwif->index; | 1654 | |
1655 | ide_init_port_hw(hwif, &hw[j]); | ||
1656 | if (config) | ||
1657 | hwif->config_data = config; | ||
1658 | idx[j] = hwif->index; | ||
1655 | } | 1659 | } |
1656 | 1660 | ||
1657 | mate = ide_find_port(); | 1661 | if (hwif == NULL && (d->host_flags & IDE_HFLAG_SINGLE)) |
1662 | return -ENOENT; | ||
1663 | |||
1664 | mate = ide_find_port_slot(d); | ||
1658 | if (mate) { | 1665 | if (mate) { |
1659 | ide_init_port_hw(mate, &hw[1]); | 1666 | ide_init_port_hw(mate, &hw[1]); |
1667 | if (config) | ||
1668 | mate->config_data = config; | ||
1660 | idx[1] = mate->index; | 1669 | idx[1] = mate->index; |
1661 | } | 1670 | } |
1662 | 1671 | ||
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index 24bd7838aec5..7bfb28edf511 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c | |||
@@ -214,7 +214,7 @@ static int __init ali14xx_probe(void) | |||
214 | return 1; | 214 | return 1; |
215 | } | 215 | } |
216 | 216 | ||
217 | return ide_legacy_device_add(&ali14xx_port_info); | 217 | return ide_legacy_device_add(&ali14xx_port_info, 0); |
218 | } | 218 | } |
219 | 219 | ||
220 | int probe_ali14xx; | 220 | int probe_ali14xx; |
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index 92d119ba92af..7b5585c1c4c0 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c | |||
@@ -125,7 +125,7 @@ static int __init dtc2278_probe(void) | |||
125 | #endif | 125 | #endif |
126 | local_irq_restore(flags); | 126 | local_irq_restore(flags); |
127 | 127 | ||
128 | return ide_legacy_device_add(&dtc2278_port_info); | 128 | return ide_legacy_device_add(&dtc2278_port_info, 0); |
129 | } | 129 | } |
130 | 130 | ||
131 | int probe_dtc2278 = 0; | 131 | int probe_dtc2278 = 0; |
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index e4e38c3cd8ac..558964fc994e 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c | |||
@@ -360,7 +360,7 @@ static int __init ht6560b_init(void) | |||
360 | goto release_region; | 360 | goto release_region; |
361 | } | 361 | } |
362 | 362 | ||
363 | return ide_legacy_device_add(&ht6560b_port_info); | 363 | return ide_legacy_device_add(&ht6560b_port_info, 0); |
364 | 364 | ||
365 | release_region: | 365 | release_region: |
366 | release_region(HT_CONFIG_PORT, 1); | 366 | release_region(HT_CONFIG_PORT, 1); |
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 65f098d15154..d8a05b57277b 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -333,10 +333,8 @@ static const struct ide_port_info qd65xx_port_info __initdata = { | |||
333 | 333 | ||
334 | static int __init qd_probe(int base) | 334 | static int __init qd_probe(int base) |
335 | { | 335 | { |
336 | ide_hwif_t *hwif; | 336 | int rc; |
337 | u8 config, unit; | 337 | u8 config, unit; |
338 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
339 | hw_regs_t hw[2]; | ||
340 | struct ide_port_info d = qd65xx_port_info; | 338 | struct ide_port_info d = qd65xx_port_info; |
341 | 339 | ||
342 | config = inb(QD_CONFIG_PORT); | 340 | config = inb(QD_CONFIG_PORT); |
@@ -349,14 +347,6 @@ static int __init qd_probe(int base) | |||
349 | if (unit) | 347 | if (unit) |
350 | d.host_flags |= IDE_HFLAG_QD_2ND_PORT; | 348 | d.host_flags |= IDE_HFLAG_QD_2ND_PORT; |
351 | 349 | ||
352 | memset(&hw, 0, sizeof(hw)); | ||
353 | |||
354 | ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); | ||
355 | hw[0].irq = 14; | ||
356 | |||
357 | ide_std_init_ports(&hw[1], 0x170, 0x376); | ||
358 | hw[1].irq = 15; | ||
359 | |||
360 | if ((config & 0xf0) == QD_CONFIG_QD6500) { | 350 | if ((config & 0xf0) == QD_CONFIG_QD6500) { |
361 | 351 | ||
362 | if (qd_testreg(base)) | 352 | if (qd_testreg(base)) |
@@ -376,19 +366,9 @@ static int __init qd_probe(int base) | |||
376 | d.port_ops = &qd6500_port_ops; | 366 | d.port_ops = &qd6500_port_ops; |
377 | d.host_flags |= IDE_HFLAG_SINGLE; | 367 | d.host_flags |= IDE_HFLAG_SINGLE; |
378 | 368 | ||
379 | hwif = ide_find_port_slot(&d); | 369 | rc = ide_legacy_device_add(&d, (base << 8) | config); |
380 | if (hwif == NULL) | ||
381 | return -ENOENT; | ||
382 | |||
383 | ide_init_port_hw(hwif, &hw[unit]); | ||
384 | 370 | ||
385 | hwif->config_data = (base << 8) | config; | 371 | return (rc == 0) ? 1 : rc; |
386 | |||
387 | idx[unit] = hwif->index; | ||
388 | |||
389 | ide_device_add(idx, &d); | ||
390 | |||
391 | return 1; | ||
392 | } | 372 | } |
393 | 373 | ||
394 | if (((config & 0xf0) == QD_CONFIG_QD6580_A) || | 374 | if (((config & 0xf0) == QD_CONFIG_QD6580_A) || |
@@ -418,40 +398,16 @@ static int __init qd_probe(int base) | |||
418 | 398 | ||
419 | d.host_flags |= IDE_HFLAG_SINGLE; | 399 | d.host_flags |= IDE_HFLAG_SINGLE; |
420 | 400 | ||
421 | hwif = ide_find_port_slot(&d); | 401 | rc = ide_legacy_device_add(&d, (base << 8) | config); |
422 | if (hwif == NULL) | ||
423 | return -ENOENT; | ||
424 | 402 | ||
425 | ide_init_port_hw(hwif, &hw[unit]); | 403 | return (rc == 0) ? 1 : rc; |
426 | |||
427 | hwif->config_data = (base << 8) | config; | ||
428 | |||
429 | idx[unit] = hwif->index; | ||
430 | |||
431 | ide_device_add(idx, &d); | ||
432 | |||
433 | return 1; | ||
434 | } else { | 404 | } else { |
435 | ide_hwif_t *mate; | ||
436 | |||
437 | /* secondary enabled */ | 405 | /* secondary enabled */ |
438 | printk(KERN_INFO "qd6580: dual IDE board\n"); | 406 | printk(KERN_INFO "qd6580: dual IDE board\n"); |
439 | 407 | ||
440 | hwif = ide_find_port(); | 408 | rc = ide_legacy_device_add(&d, (base << 8) | config); |
441 | if (hwif) { | ||
442 | ide_init_port_hw(hwif, &hw[0]); | ||
443 | idx[0] = hwif->index; | ||
444 | } | ||
445 | |||
446 | mate = ide_find_port(); | ||
447 | if (mate) { | ||
448 | ide_init_port_hw(mate, &hw[1]); | ||
449 | idx[1] = mate->index; | ||
450 | } | ||
451 | |||
452 | ide_device_add(idx, &d); | ||
453 | 409 | ||
454 | return 0; /* no other qd65xx possible */ | 410 | return rc; /* no other qd65xx possible */ |
455 | } | 411 | } |
456 | } | 412 | } |
457 | /* no qd65xx found */ | 413 | /* no qd65xx found */ |
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index b48ee345f817..95c643a2228a 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c | |||
@@ -152,7 +152,7 @@ static int __init umc8672_probe(void) | |||
152 | umc_set_speeds(current_speeds); | 152 | umc_set_speeds(current_speeds); |
153 | local_irq_restore(flags); | 153 | local_irq_restore(flags); |
154 | 154 | ||
155 | return ide_legacy_device_add(&umc8672_port_info); | 155 | return ide_legacy_device_add(&umc8672_port_info, 0); |
156 | } | 156 | } |
157 | 157 | ||
158 | int probe_umc8672; | 158 | int probe_umc8672; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 68e5a009fbd0..db9a70e25377 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -1213,7 +1213,7 @@ void ide_undecoded_slave(ide_drive_t *); | |||
1213 | 1213 | ||
1214 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); | 1214 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); |
1215 | int ide_device_add(u8 idx[4], const struct ide_port_info *); | 1215 | int ide_device_add(u8 idx[4], const struct ide_port_info *); |
1216 | int ide_legacy_device_add(const struct ide_port_info *); | 1216 | int ide_legacy_device_add(const struct ide_port_info *, unsigned long); |
1217 | void ide_port_unregister_devices(ide_hwif_t *); | 1217 | void ide_port_unregister_devices(ide_hwif_t *); |
1218 | void ide_port_scan(ide_hwif_t *); | 1218 | void ide_port_scan(ide_hwif_t *); |
1219 | 1219 | ||