diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2007-05-10 13:40:51 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-05-11 12:19:02 -0400 |
commit | 10bdaaa0fad620145cf10e2b573266b2d80b44de (patch) | |
tree | 8d3200f5041ab0fdc72e9245ef780310b27a18d8 /drivers/ide/arm/icside.c | |
parent | c7b87f3d5037a35b5c7bb916ffc826be3fcb208d (diff) |
[ARM] ecard: add ecardm_iomap() / ecardm_iounmap()
Add devres ecardm_iomap() and ecardm_iounmap() for Acorn expansion
cards. Convert all expansion card drivers to use them.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/ide/arm/icside.c')
-rw-r--r-- | drivers/ide/arm/icside.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 69c949ea93e3..66f826252aee 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -565,8 +565,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
565 | ide_hwif_t *hwif; | 565 | ide_hwif_t *hwif; |
566 | void __iomem *base; | 566 | void __iomem *base; |
567 | 567 | ||
568 | base = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), | 568 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); |
569 | ecard_resource_len(ec, ECARD_RES_MEMC)); | ||
570 | if (!base) | 569 | if (!base) |
571 | return -ENOMEM; | 570 | return -ENOMEM; |
572 | 571 | ||
@@ -583,10 +582,8 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
583 | icside_irqdisable_arcin_v5(ec, 0); | 582 | icside_irqdisable_arcin_v5(ec, 0); |
584 | 583 | ||
585 | hwif = icside_setup(base, &icside_cardinfo_v5, ec); | 584 | hwif = icside_setup(base, &icside_cardinfo_v5, ec); |
586 | if (!hwif) { | 585 | if (!hwif) |
587 | iounmap(base); | ||
588 | return -ENODEV; | 586 | return -ENODEV; |
589 | } | ||
590 | 587 | ||
591 | state->hwif[0] = hwif; | 588 | state->hwif[0] = hwif; |
592 | 589 | ||
@@ -605,8 +602,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
605 | unsigned int sel = 0; | 602 | unsigned int sel = 0; |
606 | int ret; | 603 | int ret; |
607 | 604 | ||
608 | ioc_base = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), | 605 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
609 | ecard_resource_len(ec, ECARD_RES_IOCFAST)); | ||
610 | if (!ioc_base) { | 606 | if (!ioc_base) { |
611 | ret = -ENOMEM; | 607 | ret = -ENOMEM; |
612 | goto out; | 608 | goto out; |
@@ -615,11 +611,10 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
615 | easi_base = ioc_base; | 611 | easi_base = ioc_base; |
616 | 612 | ||
617 | if (ecard_resource_flags(ec, ECARD_RES_EASI)) { | 613 | if (ecard_resource_flags(ec, ECARD_RES_EASI)) { |
618 | easi_base = ioremap(ecard_resource_start(ec, ECARD_RES_EASI), | 614 | easi_base = ecardm_iomap(ec, ECARD_RES_EASI, 0, 0); |
619 | ecard_resource_len(ec, ECARD_RES_EASI)); | ||
620 | if (!easi_base) { | 615 | if (!easi_base) { |
621 | ret = -ENOMEM; | 616 | ret = -ENOMEM; |
622 | goto unmap_slot; | 617 | goto out; |
623 | } | 618 | } |
624 | 619 | ||
625 | /* | 620 | /* |
@@ -648,7 +643,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
648 | 643 | ||
649 | if (!hwif || !mate) { | 644 | if (!hwif || !mate) { |
650 | ret = -ENODEV; | 645 | ret = -ENODEV; |
651 | goto unmap_port; | 646 | goto out; |
652 | } | 647 | } |
653 | 648 | ||
654 | state->hwif[0] = hwif; | 649 | state->hwif[0] = hwif; |
@@ -685,11 +680,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
685 | 680 | ||
686 | return 0; | 681 | return 0; |
687 | 682 | ||
688 | unmap_port: | ||
689 | if (easi_base != ioc_base) | ||
690 | iounmap(easi_base); | ||
691 | unmap_slot: | ||
692 | iounmap(ioc_base); | ||
693 | out: | 683 | out: |
694 | return ret; | 684 | return ret; |
695 | } | 685 | } |
@@ -715,8 +705,7 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
715 | state->type = ICS_TYPE_NOTYPE; | 705 | state->type = ICS_TYPE_NOTYPE; |
716 | state->dev = &ec->dev; | 706 | state->dev = &ec->dev; |
717 | 707 | ||
718 | idmem = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), | 708 | idmem = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
719 | ecard_resource_len(ec, ECARD_RES_IOCFAST)); | ||
720 | if (idmem) { | 709 | if (idmem) { |
721 | unsigned int type; | 710 | unsigned int type; |
722 | 711 | ||
@@ -724,7 +713,7 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
724 | type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1; | 713 | type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1; |
725 | type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2; | 714 | type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2; |
726 | type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3; | 715 | type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3; |
727 | iounmap(idmem); | 716 | ecardm_iounmap(ec, idmem); |
728 | 717 | ||
729 | state->type = type; | 718 | state->type = type; |
730 | } | 719 | } |
@@ -793,11 +782,6 @@ static void __devexit icside_remove(struct expansion_card *ec) | |||
793 | 782 | ||
794 | ecard_set_drvdata(ec, NULL); | 783 | ecard_set_drvdata(ec, NULL); |
795 | 784 | ||
796 | if (state->ioc_base) | ||
797 | iounmap(state->ioc_base); | ||
798 | if (state->ioc_base != state->irq_port) | ||
799 | iounmap(state->irq_port); | ||
800 | |||
801 | kfree(state); | 785 | kfree(state); |
802 | ecard_release_resources(ec); | 786 | ecard_release_resources(ec); |
803 | } | 787 | } |