diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:57 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:57 -0400 |
commit | 48c3c1072651922ed153bcf0a33ea82cf20df390 (patch) | |
tree | 92ad23e3869e70731eca99394c08a3bf06b8753e /drivers/ide/arm/icside.c | |
parent | 374e042c3e767ac2e5a40b78529220e0b3de793c (diff) |
ide: add struct ide_host (take 3)
* Add struct ide_host which keeps pointers to host's ports.
* Add ide_host_alloc[_all]() and ide_host_remove() helpers.
* Pass 'struct ide_host *host' instead of 'u8 *idx' to
ide_device_add[_all]() and rename it to ide_host_register[_all]().
* Convert host drivers and core code to use struct ide_host.
* Remove no longer needed ide_find_port().
* Make ide_find_port_slot() static.
* Unexport ide_unregister().
v2:
* Add missing 'struct ide_host *host' to macide.c.
v3:
* Fix build problem in pmac.c (s/ide_alloc_host/ide_host_alloc/)
(Noticed by Stephen Rothwell).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/arm/icside.c')
-rw-r--r-- | drivers/ide/arm/icside.c | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 0283d162f7f7..6fa58425466a 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -72,7 +72,7 @@ struct icside_state { | |||
72 | void __iomem *ioc_base; | 72 | void __iomem *ioc_base; |
73 | unsigned int sel; | 73 | unsigned int sel; |
74 | unsigned int type; | 74 | unsigned int type; |
75 | ide_hwif_t *hwif[2]; | 75 | struct ide_host *host; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | #define ICS_TYPE_A3IN 0 | 78 | #define ICS_TYPE_A3IN 0 |
@@ -442,10 +442,9 @@ static void icside_setup_ports(hw_regs_t *hw, void __iomem *base, | |||
442 | static int __init | 442 | static int __init |
443 | icside_register_v5(struct icside_state *state, struct expansion_card *ec) | 443 | icside_register_v5(struct icside_state *state, struct expansion_card *ec) |
444 | { | 444 | { |
445 | ide_hwif_t *hwif; | ||
446 | void __iomem *base; | 445 | void __iomem *base; |
446 | struct ide_host *host; | ||
447 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 447 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
448 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
449 | 448 | ||
450 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); | 449 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); |
451 | if (!base) | 450 | if (!base) |
@@ -465,17 +464,15 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
465 | 464 | ||
466 | icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); | 465 | icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); |
467 | 466 | ||
468 | hwif = ide_find_port(); | 467 | host = ide_host_alloc(NULL, hws); |
469 | if (!hwif) | 468 | if (host == NULL) |
470 | return -ENODEV; | 469 | return -ENODEV; |
471 | 470 | ||
472 | state->hwif[0] = hwif; | 471 | state->host = host; |
473 | 472 | ||
474 | ecard_set_drvdata(ec, state); | 473 | ecard_set_drvdata(ec, state); |
475 | 474 | ||
476 | idx[0] = hwif->index; | 475 | ide_host_register(host, NULL, hws); |
477 | |||
478 | ide_device_add(idx, NULL, hws); | ||
479 | 476 | ||
480 | return 0; | 477 | return 0; |
481 | } | 478 | } |
@@ -492,12 +489,11 @@ static const struct ide_port_info icside_v6_port_info __initdata = { | |||
492 | static int __init | 489 | static int __init |
493 | icside_register_v6(struct icside_state *state, struct expansion_card *ec) | 490 | icside_register_v6(struct icside_state *state, struct expansion_card *ec) |
494 | { | 491 | { |
495 | ide_hwif_t *hwif, *mate; | ||
496 | void __iomem *ioc_base, *easi_base; | 492 | void __iomem *ioc_base, *easi_base; |
493 | struct ide_host *host; | ||
497 | unsigned int sel = 0; | 494 | unsigned int sel = 0; |
498 | int ret; | 495 | int ret; |
499 | hw_regs_t hw[2], *hws[] = { &hw[0], NULL, NULL, NULL }; | 496 | hw_regs_t hw[2], *hws[] = { &hw[0], NULL, NULL, NULL }; |
500 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
501 | struct ide_port_info d = icside_v6_port_info; | 497 | struct ide_port_info d = icside_v6_port_info; |
502 | 498 | ||
503 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); | 499 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
@@ -537,25 +533,11 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
537 | icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec); | 533 | icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec); |
538 | icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec); | 534 | icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec); |
539 | 535 | ||
540 | /* | 536 | host = ide_host_alloc(&d, hws); |
541 | * Find and register the interfaces. | 537 | if (host == NULL) |
542 | */ | ||
543 | hwif = ide_find_port(); | ||
544 | if (hwif == NULL) | ||
545 | return -ENODEV; | 538 | return -ENODEV; |
546 | 539 | ||
547 | hwif->chipset = ide_acorn; | 540 | state->host = host; |
548 | |||
549 | idx[0] = hwif->index; | ||
550 | |||
551 | mate = ide_find_port(); | ||
552 | if (mate) { | ||
553 | hws[1] = &hw[1]; | ||
554 | idx[1] = mate->index; | ||
555 | } | ||
556 | |||
557 | state->hwif[0] = hwif; | ||
558 | state->hwif[1] = mate; | ||
559 | 541 | ||
560 | ecard_set_drvdata(ec, state); | 542 | ecard_set_drvdata(ec, state); |
561 | 543 | ||
@@ -565,7 +547,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
565 | d.dma_ops = NULL; | 547 | d.dma_ops = NULL; |
566 | } | 548 | } |
567 | 549 | ||
568 | ide_device_add(idx, &d, hws); | 550 | ide_host_register(host, &d, hws); |
569 | 551 | ||
570 | return 0; | 552 | return 0; |
571 | 553 | ||