diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2013-11-07 19:32:38 -0500 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-01-03 14:22:08 -0500 |
commit | 554cbc509f4ef95b0f06d04d94f0b0c2019dee26 (patch) | |
tree | e4fc20ef992d062b41c17feb6ae66bf91da3182a | |
parent | 89b59e6cc15db8cea20a0c0aac18548bccfcb5f9 (diff) |
mtd: gpmi: Use devm_clk_get()
Using devm_clk_get() can make the code smaller and cleaner.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 9c5911616a07..739f131e572c 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | |||
@@ -582,21 +582,6 @@ acquire_err: | |||
582 | return -EINVAL; | 582 | return -EINVAL; |
583 | } | 583 | } |
584 | 584 | ||
585 | static void gpmi_put_clks(struct gpmi_nand_data *this) | ||
586 | { | ||
587 | struct resources *r = &this->resources; | ||
588 | struct clk *clk; | ||
589 | int i; | ||
590 | |||
591 | for (i = 0; i < GPMI_CLK_MAX; i++) { | ||
592 | clk = r->clock[i]; | ||
593 | if (clk) { | ||
594 | clk_put(clk); | ||
595 | r->clock[i] = NULL; | ||
596 | } | ||
597 | } | ||
598 | } | ||
599 | |||
600 | static char *extra_clks_for_mx6q[GPMI_CLK_MAX] = { | 585 | static char *extra_clks_for_mx6q[GPMI_CLK_MAX] = { |
601 | "gpmi_apb", "gpmi_bch", "gpmi_bch_apb", "per1_bch", | 586 | "gpmi_apb", "gpmi_bch", "gpmi_bch_apb", "per1_bch", |
602 | }; | 587 | }; |
@@ -609,7 +594,7 @@ static int gpmi_get_clks(struct gpmi_nand_data *this) | |||
609 | int err, i; | 594 | int err, i; |
610 | 595 | ||
611 | /* The main clock is stored in the first. */ | 596 | /* The main clock is stored in the first. */ |
612 | r->clock[0] = clk_get(this->dev, "gpmi_io"); | 597 | r->clock[0] = devm_clk_get(this->dev, "gpmi_io"); |
613 | if (IS_ERR(r->clock[0])) { | 598 | if (IS_ERR(r->clock[0])) { |
614 | err = PTR_ERR(r->clock[0]); | 599 | err = PTR_ERR(r->clock[0]); |
615 | goto err_clock; | 600 | goto err_clock; |
@@ -625,7 +610,7 @@ static int gpmi_get_clks(struct gpmi_nand_data *this) | |||
625 | if (extra_clks[i - 1] == NULL) | 610 | if (extra_clks[i - 1] == NULL) |
626 | break; | 611 | break; |
627 | 612 | ||
628 | clk = clk_get(this->dev, extra_clks[i - 1]); | 613 | clk = devm_clk_get(this->dev, extra_clks[i - 1]); |
629 | if (IS_ERR(clk)) { | 614 | if (IS_ERR(clk)) { |
630 | err = PTR_ERR(clk); | 615 | err = PTR_ERR(clk); |
631 | goto err_clock; | 616 | goto err_clock; |
@@ -647,7 +632,6 @@ static int gpmi_get_clks(struct gpmi_nand_data *this) | |||
647 | 632 | ||
648 | err_clock: | 633 | err_clock: |
649 | dev_dbg(this->dev, "failed in finding the clocks.\n"); | 634 | dev_dbg(this->dev, "failed in finding the clocks.\n"); |
650 | gpmi_put_clks(this); | ||
651 | return err; | 635 | return err; |
652 | } | 636 | } |
653 | 637 | ||
@@ -687,7 +671,6 @@ exit_regs: | |||
687 | 671 | ||
688 | static void release_resources(struct gpmi_nand_data *this) | 672 | static void release_resources(struct gpmi_nand_data *this) |
689 | { | 673 | { |
690 | gpmi_put_clks(this); | ||
691 | release_register_block(this); | 674 | release_register_block(this); |
692 | release_bch_irq(this); | 675 | release_bch_irq(this); |
693 | release_dma_channels(this); | 676 | release_dma_channels(this); |