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 /drivers/ide/legacy/qd65xx.c | |
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>
Diffstat (limited to 'drivers/ide/legacy/qd65xx.c')
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 58 |
1 files changed, 7 insertions, 51 deletions
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 */ |