diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-12-17 20:31:15 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-12-18 06:28:53 -0500 |
commit | e1d0cd473be4c88f823fa55e880ca6ae05d685f6 (patch) | |
tree | 1cefeb992d8f1b1c86fecaaaa3c80733acb2241e /drivers/spi | |
parent | 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff) |
spi: mpc512x: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-mpc512x-psc.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 9602bbd8d7ea..d7a73ef85e46 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c | |||
@@ -504,7 +504,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, | |||
504 | master->cleanup = mpc512x_psc_spi_cleanup; | 504 | master->cleanup = mpc512x_psc_spi_cleanup; |
505 | master->dev.of_node = dev->of_node; | 505 | master->dev.of_node = dev->of_node; |
506 | 506 | ||
507 | tempp = ioremap(regaddr, size); | 507 | tempp = devm_ioremap(dev, regaddr, size); |
508 | if (!tempp) { | 508 | if (!tempp) { |
509 | dev_err(dev, "could not ioremap I/O port range\n"); | 509 | dev_err(dev, "could not ioremap I/O port range\n"); |
510 | ret = -EFAULT; | 510 | ret = -EFAULT; |
@@ -513,9 +513,8 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, | |||
513 | mps->psc = tempp; | 513 | mps->psc = tempp; |
514 | mps->fifo = | 514 | mps->fifo = |
515 | (struct mpc512x_psc_fifo *)(tempp + sizeof(struct mpc52xx_psc)); | 515 | (struct mpc512x_psc_fifo *)(tempp + sizeof(struct mpc52xx_psc)); |
516 | 516 | ret = devm_request_irq(dev, mps->irq, mpc512x_psc_spi_isr, IRQF_SHARED, | |
517 | ret = request_irq(mps->irq, mpc512x_psc_spi_isr, IRQF_SHARED, | 517 | "mpc512x-psc-spi", mps); |
518 | "mpc512x-psc-spi", mps); | ||
519 | if (ret) | 518 | if (ret) |
520 | goto free_master; | 519 | goto free_master; |
521 | init_completion(&mps->txisrdone); | 520 | init_completion(&mps->txisrdone); |
@@ -525,11 +524,11 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, | |||
525 | clk = devm_clk_get(dev, clk_name); | 524 | clk = devm_clk_get(dev, clk_name); |
526 | if (IS_ERR(clk)) { | 525 | if (IS_ERR(clk)) { |
527 | ret = PTR_ERR(clk); | 526 | ret = PTR_ERR(clk); |
528 | goto free_irq; | 527 | goto free_master; |
529 | } | 528 | } |
530 | ret = clk_prepare_enable(clk); | 529 | ret = clk_prepare_enable(clk); |
531 | if (ret) | 530 | if (ret) |
532 | goto free_irq; | 531 | goto free_master; |
533 | mps->clk_mclk = clk; | 532 | mps->clk_mclk = clk; |
534 | mps->mclk_rate = clk_get_rate(clk); | 533 | mps->mclk_rate = clk_get_rate(clk); |
535 | 534 | ||
@@ -545,11 +544,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, | |||
545 | 544 | ||
546 | free_clock: | 545 | free_clock: |
547 | clk_disable_unprepare(mps->clk_mclk); | 546 | clk_disable_unprepare(mps->clk_mclk); |
548 | free_irq: | ||
549 | free_irq(mps->irq, mps); | ||
550 | free_master: | 547 | free_master: |
551 | if (mps->psc) | ||
552 | iounmap(mps->psc); | ||
553 | spi_master_put(master); | 548 | spi_master_put(master); |
554 | 549 | ||
555 | return ret; | 550 | return ret; |
@@ -561,9 +556,6 @@ static int mpc512x_psc_spi_do_remove(struct device *dev) | |||
561 | struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); | 556 | struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); |
562 | 557 | ||
563 | clk_disable_unprepare(mps->clk_mclk); | 558 | clk_disable_unprepare(mps->clk_mclk); |
564 | free_irq(mps->irq, mps); | ||
565 | if (mps->psc) | ||
566 | iounmap(mps->psc); | ||
567 | 559 | ||
568 | return 0; | 560 | return 0; |
569 | } | 561 | } |