ASoC: tegra: Use devm_ioremap_resource instead of open code
Subsystems (3)
PATCH 1/1 ASoC: tegra: Use devm_ioremap_resource instead of open code
Use devm_ioremap_resource() to simplify the code.
--- sound/soc/tegra/tegra20_das.c | 23 ++++------------------ sound/soc/tegra/tegra20_i2s.c | 23 ++++------------------ sound/soc/tegra/tegra20_spdif.c | 22 ++++----------------- sound/soc/tegra/tegra30_ahub.c | 43 +++++++---------------------------------- sound/soc/tegra/tegra30_i2s.c | 23 ++++------------------ 5 files changed, 23 insertions(+), 111 deletions(-)
sound/soc/tegra/tegra20_das.c +4 -19
@@ -133,7 +133,7 @@ static const struct regmap_config tegra20_das_regmap_config = {static int tegra20_das_probe (struct platform_device *pdev) { -struct resource *res, *region; +struct resource *res;void __iomem *regs;int ret =0 ;
@@ -149,24 +149,9 @@ static int tegra20_das_probe(struct platform_device *pdev) das->dev = &pdev->dev; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!res) { -dev_err (&pdev->dev,"No memory resource\n" ); - ret = -ENODEV ; - goto err; - } - - region =devm_request_mem_region (&pdev->dev, res->start, -resource_size (res), pdev->name); -if (!region) { -dev_err (&pdev->dev,"Memory region already claimed\n" ); - ret = -EBUSY ; - goto err; - } - - regs =devm_ioremap (&pdev->dev, res->start,resource_size (res)); -if (!regs) { -dev_err (&pdev->dev,"ioremap failed\n" ); - ret = -ENOMEM ; + regs =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (regs)) { + ret =PTR_ERR (regs); goto err; }
sound/soc/tegra/tegra20_i2s.c +4 -19
@@ -339,7 +339,7 @@ static const struct regmap_config tegra20_i2s_regmap_config = {static int tegra20_i2s_platform_probe (struct platform_device *pdev) {struct tegra20_i2s *i2s; -struct resource *mem, *memregion; +struct resource *mem;void __iomem *regs;int ret;
@@ -362,24 +362,9 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) } mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!mem) { -dev_err (&pdev->dev,"No memory resource\n" ); - ret = -ENODEV ; - goto err_clk_put; - } - - memregion =devm_request_mem_region (&pdev->dev, mem->start, -resource_size (mem),DRV_NAME ); -if (!memregion) { -dev_err (&pdev->dev,"Memory region already claimed\n" ); - ret = -EBUSY ; - goto err_clk_put; - } - - regs =devm_ioremap (&pdev->dev, mem->start,resource_size (mem)); -if (!regs) { -dev_err (&pdev->dev,"ioremap failed\n" ); - ret = -ENOMEM ; + regs =devm_ioremap_resource (&pdev->dev, mem); +if (IS_ERR (regs)) { + ret =PTR_ERR (regs); goto err_clk_put; }
sound/soc/tegra/tegra20_spdif.c +4 -18
@@ -265,7 +265,7 @@ static const struct regmap_config tegra20_spdif_regmap_config = {static int tegra20_spdif_platform_probe (struct platform_device *pdev) {struct tegra20_spdif *spdif; -struct resource *mem, *memregion, *dmareq; +struct resource *mem, *dmareq;void __iomem *regs;int ret;
@@ -285,10 +285,9 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev) } mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!mem) { -dev_err (&pdev->dev,"No memory resource\n" ); -return -ENODEV ; - } + regs =devm_ioremap_resource (&pdev->dev, mem); +if (IS_ERR (regs)) +return PTR_ERR (regs); dmareq =platform_get_resource (pdev,IORESOURCE_DMA ,0 );if (!dmareq) {
@@ -296,19 +295,6 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev)return -ENODEV ; } - memregion =devm_request_mem_region (&pdev->dev, mem->start, -resource_size (mem),DRV_NAME ); -if (!memregion) { -dev_err (&pdev->dev,"Memory region already claimed\n" ); -return -EBUSY ; - } - - regs =devm_ioremap (&pdev->dev, mem->start,resource_size (mem)); -if (!regs) { -dev_err (&pdev->dev,"ioremap failed\n" ); -return -ENOMEM ; - } - spdif->regmap =devm_regmap_init_mmio (&pdev->dev, regs, &tegra20_spdif_regmap_config);if (IS_ERR (spdif->regmap)) {
sound/soc/tegra/tegra30_ahub.c +7 -36
64 lines not on this page · raw message
sound/soc/tegra/tegra30_i2s.c +4 -19
@@ -379,7 +379,7 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev)struct tegra30_i2s *i2s;const struct of_device_id *match;u32 cif_ids[2 ]; -struct resource *mem, *memregion; +struct resource *mem;void __iomem *regs;int ret;
@@ -419,24 +419,9 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) } mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!mem) { -dev_err (&pdev->dev,"No memory resource\n" ); - ret = -ENODEV ; - goto err_clk_put; - } - - memregion =devm_request_mem_region (&pdev->dev, mem->start, -resource_size (mem),DRV_NAME ); -if (!memregion) { -dev_err (&pdev->dev,"Memory region already claimed\n" ); - ret = -EBUSY ; - goto err_clk_put; - } - - regs =devm_ioremap (&pdev->dev, mem->start,resource_size (mem)); -if (!regs) { -dev_err (&pdev->dev,"ioremap failed\n" ); - ret = -ENOMEM ; + regs =devm_ioremap_resource (&pdev->dev, mem); +if (IS_ERR (regs)) { + ret =PTR_ERR (regs); goto err_clk_put; }
Signature · 1 line
2.1.0
Mark Brown
maintainerApplied "ASoC: tegra: Use devm_ioremap_resource instead of open code" to the asoc tree
The patch
ASoC: tegra: Use devm_ioremap_resource instead of open code
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
f57ddcdfa146636dbdcd6ac0a6d22c15d47b08c8Mon Sep 17 00:00:00 2001
From: Axel Lin <[email protected]>
Date: Sun, 23 Aug 2015 23:32:14 +0800
Subject: [PATCH] ASoC: tegra: Use devm_ioremap_resource instead of open code
Use devm_ioremap_resource() to simplify the code.
--- sound/soc/tegra/tegra20_das.c | 23 ++++------------------ sound/soc/tegra/tegra20_i2s.c | 23 ++++------------------ sound/soc/tegra/tegra20_spdif.c | 22 ++++----------------- sound/soc/tegra/tegra30_ahub.c | 43 +++++++---------------------------------- sound/soc/tegra/tegra30_i2s.c | 23 ++++------------------ 5 files changed, 23 insertions(+), 111 deletions(-)
sound/soc/tegra/tegra20_das.c +4 -19
@@ -133,7 +133,7 @@ static const struct regmap_config tegra20_das_regmap_config = {static int tegra20_das_probe (struct platform_device *pdev) { -struct resource *res, *region; +struct resource *res;void __iomem *regs;int ret =0 ;
@@ -149,24 +149,9 @@ static int tegra20_das_probe(struct platform_device *pdev) das->dev = &pdev->dev; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!res) { -dev_err (&pdev->dev,"No memory resource\n" ); - ret = -ENODEV ; - goto err; - } - - region =devm_request_mem_region (&pdev->dev, res->start, -resource_size (res), pdev->name); -if (!region) { -dev_err (&pdev->dev,"Memory region already claimed\n" ); - ret = -EBUSY ; - goto err; - } - - regs =devm_ioremap (&pdev->dev, res->start,resource_size (res)); -if (!regs) { -dev_err (&pdev->dev,"ioremap failed\n" ); - ret = -ENOMEM ; + regs =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (regs)) { + ret =PTR_ERR (regs); goto err; }
sound/soc/tegra/tegra20_i2s.c +4 -19
@@ -339,7 +339,7 @@ static const struct regmap_config tegra20_i2s_regmap_config = {static int tegra20_i2s_platform_probe (struct platform_device *pdev) {struct tegra20_i2s *i2s; -struct resource *mem, *memregion; +struct resource *mem;void __iomem *regs;int ret;
@@ -362,24 +362,9 @@ static int tegra20_i2s_platform_probe(struct platform_device *pdev) } mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!mem) { -dev_err (&pdev->dev,"No memory resource\n" ); - ret = -ENODEV ; - goto err_clk_put; - } - - memregion =devm_request_mem_region (&pdev->dev, mem->start, -resource_size (mem),DRV_NAME ); -if (!memregion) { -dev_err (&pdev->dev,"Memory region already claimed\n" ); - ret = -EBUSY ; - goto err_clk_put; - } - - regs =devm_ioremap (&pdev->dev, mem->start,resource_size (mem)); -if (!regs) { -dev_err (&pdev->dev,"ioremap failed\n" ); - ret = -ENOMEM ; + regs =devm_ioremap_resource (&pdev->dev, mem); +if (IS_ERR (regs)) { + ret =PTR_ERR (regs); goto err_clk_put; }
sound/soc/tegra/tegra20_spdif.c +4 -18
@@ -265,7 +265,7 @@ static const struct regmap_config tegra20_spdif_regmap_config = {static int tegra20_spdif_platform_probe (struct platform_device *pdev) {struct tegra20_spdif *spdif; -struct resource *mem, *memregion, *dmareq; +struct resource *mem, *dmareq;void __iomem *regs;int ret;
@@ -285,10 +285,9 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev) } mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!mem) { -dev_err (&pdev->dev,"No memory resource\n" ); -return -ENODEV ; - } + regs =devm_ioremap_resource (&pdev->dev, mem); +if (IS_ERR (regs)) +return PTR_ERR (regs); dmareq =platform_get_resource (pdev,IORESOURCE_DMA ,0 );if (!dmareq) {
@@ -296,19 +295,6 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev)return -ENODEV ; } - memregion =devm_request_mem_region (&pdev->dev, mem->start, -resource_size (mem),DRV_NAME ); -if (!memregion) { -dev_err (&pdev->dev,"Memory region already claimed\n" ); -return -EBUSY ; - } - - regs =devm_ioremap (&pdev->dev, mem->start,resource_size (mem)); -if (!regs) { -dev_err (&pdev->dev,"ioremap failed\n" ); -return -ENOMEM ; - } - spdif->regmap =devm_regmap_init_mmio (&pdev->dev, regs, &tegra20_spdif_regmap_config);if (IS_ERR (spdif->regmap)) {
sound/soc/tegra/tegra30_ahub.c +7 -36
64 lines not on this page · raw message
sound/soc/tegra/tegra30_i2s.c +4 -19
@@ -379,7 +379,7 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev)struct tegra30_i2s *i2s;const struct of_device_id *match;u32 cif_ids[2 ]; -struct resource *mem, *memregion; +struct resource *mem;void __iomem *regs;int ret;
@@ -419,24 +419,9 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev) } mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!mem) { -dev_err (&pdev->dev,"No memory resource\n" ); - ret = -ENODEV ; - goto err_clk_put; - } - - memregion =devm_request_mem_region (&pdev->dev, mem->start, -resource_size (mem),DRV_NAME ); -if (!memregion) { -dev_err (&pdev->dev,"Memory region already claimed\n" ); - ret = -EBUSY ; - goto err_clk_put; - } - - regs =devm_ioremap (&pdev->dev, mem->start,resource_size (mem)); -if (!regs) { -dev_err (&pdev->dev,"ioremap failed\n" ); - ret = -ENOMEM ; + regs =devm_ioremap_resource (&pdev->dev, mem); +if (IS_ERR (regs)) { + ret =PTR_ERR (regs); goto err_clk_put; }
Signature · 1 line
2.5.0
Quoted 10 lines · Axel Lin
Use
devm_ioremap_resource()to simplify the code.Signed-off-by Axel Lin <[email protected]>--- sound/soc/tegra/tegra20_das.c | 23 ++++------------------ sound/soc/tegra/tegra20_i2s.c | 23 ++++------------------ sound/soc/tegra/tegra20_spdif.c | 22 ++++----------------- sound/soc/tegra/tegra30_ahub.c | 43 +++++++---------------------------------- sound/soc/tegra/tegra30_i2s.c | 23 ++++------------------ 5 files changed, 23 insertions(+), 111 deletions(-)
Nice negative line count!