diff options
author | Axel Lin <axel.lin@ingics.com> | 2015-08-23 18:32:14 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-08-26 20:58:46 +0300 |
commit | f57ddcdfa146636dbdcd6ac0a6d22c15d47b08c8 (patch) | |
tree | 6b7fdc995092258bcf553a55758a37a691061b45 /sound/soc/tegra/tegra30_ahub.c | |
parent | 5e9a3fcfa2ca10e3ff76938fe9a12515ffa41003 (diff) | |
download | linux-f57ddcdfa146636dbdcd6ac0a6d22c15d47b08c8.tar.xz |
ASoC: tegra: Use devm_ioremap_resource instead of open code
Use devm_ioremap_resource() to simplify the code.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/tegra/tegra30_ahub.c')
-rw-r--r-- | sound/soc/tegra/tegra30_ahub.c | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 989b1e8c6184..fef3b9a21a66 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -521,7 +521,7 @@ static int tegra30_ahub_probe(struct platform_device *pdev) const struct tegra30_ahub_soc_data *soc_data; struct reset_control *rst; int i; - struct resource *res0, *res1, *region; + struct resource *res0, *res1; void __iomem *regs_apbif, *regs_ahub; int ret = 0; @@ -584,26 +584,12 @@ static int tegra30_ahub_probe(struct platform_device *pdev) } res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res0) { - dev_err(&pdev->dev, "No apbif memory resource\n"); - return -ENODEV; - } + regs_apbif = devm_ioremap_resource(&pdev->dev, res0); + if (IS_ERR(regs_apbif)) + return PTR_ERR(regs_apbif); - region = devm_request_mem_region(&pdev->dev, res0->start, - resource_size(res0), DRV_NAME); - if (!region) { - dev_err(&pdev->dev, "request region apbif failed\n"); - return -EBUSY; - } ahub->apbif_addr = res0->start; - regs_apbif = devm_ioremap(&pdev->dev, res0->start, - resource_size(res0)); - if (!regs_apbif) { - dev_err(&pdev->dev, "ioremap apbif failed\n"); - return -ENOMEM; - } - ahub->regmap_apbif = devm_regmap_init_mmio(&pdev->dev, regs_apbif, &tegra30_ahub_apbif_regmap_config); if (IS_ERR(ahub->regmap_apbif)) { @@ -614,24 +600,9 @@ static int tegra30_ahub_probe(struct platform_device *pdev) regcache_cache_only(ahub->regmap_apbif, true); res1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (!res1) { - dev_err(&pdev->dev, "No ahub memory resource\n"); - return -ENODEV; - } - - region = devm_request_mem_region(&pdev->dev, res1->start, - resource_size(res1), DRV_NAME); - if (!region) { - dev_err(&pdev->dev, "request region ahub failed\n"); - return -EBUSY; - } - - regs_ahub = devm_ioremap(&pdev->dev, res1->start, - resource_size(res1)); - if (!regs_ahub) { - dev_err(&pdev->dev, "ioremap ahub failed\n"); - return -ENOMEM; - } + regs_ahub = devm_ioremap_resource(&pdev->dev, res1); + if (IS_ERR(regs_ahub)) + return PTR_ERR(regs_ahub); ahub->regmap_ahub = devm_regmap_init_mmio(&pdev->dev, regs_ahub, &tegra30_ahub_ahub_regmap_config); |