aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/omap-dmic.c
diff options
context:
space:
mode:
authorHimangi Saraogi <himangi774@gmail.com>2014-07-11 00:14:06 -0400
committerMark Brown <broonie@linaro.org>2014-07-14 14:02:45 -0400
commit9cb0fe9b0ee178474245a0a402eb628a3fb9a64a (patch)
tree38b4f8257f6f5210c50548083ce603db0cc41663 /sound/soc/omap/omap-dmic.c
parent159baadf59416d9ddf860bac9f39e19a04b21603 (diff)
ASoC: omap-dmic: Use devm_clk_get
This patch introduces the use of managed interfaces like devm_clk_get and does away with the clk_puts in the probe and remove functions. A label is also done away with. Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/omap/omap-dmic.c')
-rw-r--r--sound/soc/omap/omap-dmic.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
index f125eb95d8c8..0f34e28a3d55 100644
--- a/sound/soc/omap/omap-dmic.c
+++ b/sound/soc/omap/omap-dmic.c
@@ -466,7 +466,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)
466 466
467 mutex_init(&dmic->mutex); 467 mutex_init(&dmic->mutex);
468 468
469 dmic->fclk = clk_get(dmic->dev, "fck"); 469 dmic->fclk = devm_clk_get(dmic->dev, "fck");
470 if (IS_ERR(dmic->fclk)) { 470 if (IS_ERR(dmic->fclk)) {
471 dev_err(dmic->dev, "cant get fck\n"); 471 dev_err(dmic->dev, "cant get fck\n");
472 return -ENODEV; 472 return -ENODEV;
@@ -475,8 +475,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)
475 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma"); 475 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
476 if (!res) { 476 if (!res) {
477 dev_err(dmic->dev, "invalid dma memory resource\n"); 477 dev_err(dmic->dev, "invalid dma memory resource\n");
478 ret = -ENODEV; 478 return -ENODEV;
479 goto err_put_clk;
480 } 479 }
481 dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG; 480 dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG;
482 481
@@ -484,34 +483,19 @@ static int asoc_dmic_probe(struct platform_device *pdev)
484 483
485 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); 484 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
486 dmic->io_base = devm_ioremap_resource(&pdev->dev, res); 485 dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
487 if (IS_ERR(dmic->io_base)) { 486 if (IS_ERR(dmic->io_base))
488 ret = PTR_ERR(dmic->io_base); 487 return PTR_ERR(dmic->io_base);
489 goto err_put_clk;
490 }
491 488
492 489
493 ret = devm_snd_soc_register_component(&pdev->dev, 490 ret = devm_snd_soc_register_component(&pdev->dev,
494 &omap_dmic_component, 491 &omap_dmic_component,
495 &omap_dmic_dai, 1); 492 &omap_dmic_dai, 1);
496 if (ret) 493 if (ret)
497 goto err_put_clk; 494 return ret;
498 495
499 ret = omap_pcm_platform_register(&pdev->dev); 496 ret = omap_pcm_platform_register(&pdev->dev);
500 if (ret) 497 if (ret)
501 goto err_put_clk; 498 return ret;
502
503 return 0;
504
505err_put_clk:
506 clk_put(dmic->fclk);
507 return ret;
508}
509
510static int asoc_dmic_remove(struct platform_device *pdev)
511{
512 struct omap_dmic *dmic = platform_get_drvdata(pdev);
513
514 clk_put(dmic->fclk);
515 499
516 return 0; 500 return 0;
517} 501}
@@ -529,7 +513,6 @@ static struct platform_driver asoc_dmic_driver = {
529 .of_match_table = omap_dmic_of_match, 513 .of_match_table = omap_dmic_of_match,
530 }, 514 },
531 .probe = asoc_dmic_probe, 515 .probe = asoc_dmic_probe,
532 .remove = asoc_dmic_remove,
533}; 516};
534 517
535module_platform_driver(asoc_dmic_driver); 518module_platform_driver(asoc_dmic_driver);