diff options
author | Huang Shijie <b32955@freescale.com> | 2013-11-14 01:25:48 -0500 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-01-03 14:22:19 -0500 |
commit | 87a9d69892836fc9cf738fa8960a0c29cf8e3f16 (patch) | |
tree | 639281924210038ba0644b9e4f070b192354c293 /drivers/mtd/nand/gpmi-nand | |
parent | ccce417734dd4eb1703483d419f7739133ca9f91 (diff) |
mtd: gpmi: use devm_ioremap_resource
Use the devm_ioremap_resource to simplify the code.
[Note: as a side effect, this adds a missing call to request_memory().]
Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand/gpmi-nand')
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 36ef60aed216..1f99038caf5f 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | |||
@@ -486,16 +486,9 @@ static int acquire_register_block(struct gpmi_nand_data *this, | |||
486 | void __iomem *p; | 486 | void __iomem *p; |
487 | 487 | ||
488 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); | 488 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); |
489 | if (!r) { | 489 | p = devm_ioremap_resource(&pdev->dev, r); |
490 | pr_err("Can't get resource for %s\n", res_name); | 490 | if (IS_ERR(p)) |
491 | return -ENODEV; | 491 | return PTR_ERR(p); |
492 | } | ||
493 | |||
494 | p = ioremap(r->start, resource_size(r)); | ||
495 | if (!p) { | ||
496 | pr_err("Can't remap %s\n", res_name); | ||
497 | return -ENOMEM; | ||
498 | } | ||
499 | 492 | ||
500 | if (!strcmp(res_name, GPMI_NAND_GPMI_REGS_ADDR_RES_NAME)) | 493 | if (!strcmp(res_name, GPMI_NAND_GPMI_REGS_ADDR_RES_NAME)) |
501 | res->gpmi_regs = p; | 494 | res->gpmi_regs = p; |
@@ -507,17 +500,6 @@ static int acquire_register_block(struct gpmi_nand_data *this, | |||
507 | return 0; | 500 | return 0; |
508 | } | 501 | } |
509 | 502 | ||
510 | static void release_register_block(struct gpmi_nand_data *this) | ||
511 | { | ||
512 | struct resources *res = &this->resources; | ||
513 | if (res->gpmi_regs) | ||
514 | iounmap(res->gpmi_regs); | ||
515 | if (res->bch_regs) | ||
516 | iounmap(res->bch_regs); | ||
517 | res->gpmi_regs = NULL; | ||
518 | res->bch_regs = NULL; | ||
519 | } | ||
520 | |||
521 | static int acquire_bch_irq(struct gpmi_nand_data *this, irq_handler_t irq_h) | 503 | static int acquire_bch_irq(struct gpmi_nand_data *this, irq_handler_t irq_h) |
522 | { | 504 | { |
523 | struct platform_device *pdev = this->pdev; | 505 | struct platform_device *pdev = this->pdev; |
@@ -665,13 +647,11 @@ exit_clock: | |||
665 | exit_dma_channels: | 647 | exit_dma_channels: |
666 | release_bch_irq(this); | 648 | release_bch_irq(this); |
667 | exit_regs: | 649 | exit_regs: |
668 | release_register_block(this); | ||
669 | return ret; | 650 | return ret; |
670 | } | 651 | } |
671 | 652 | ||
672 | static void release_resources(struct gpmi_nand_data *this) | 653 | static void release_resources(struct gpmi_nand_data *this) |
673 | { | 654 | { |
674 | release_register_block(this); | ||
675 | release_bch_irq(this); | 655 | release_bch_irq(this); |
676 | release_dma_channels(this); | 656 | release_dma_channels(this); |
677 | } | 657 | } |