lkml.org 
[lkml]   [2019]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 06/17] clk: tegra: convert to devm_platform_ioremap_resource
Date
Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
drivers/clk/tegra/clk-dfll.c | 34 ++++------------------------------
1 file changed, 4 insertions(+), 30 deletions(-)

diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c
index c051d92c2bbf..070a2957e119 100644
--- a/drivers/clk/tegra/clk-dfll.c
+++ b/drivers/clk/tegra/clk-dfll.c
@@ -1935,7 +1935,6 @@ static int dfll_fetch_common_params(struct tegra_dfll *td)
int tegra_dfll_register(struct platform_device *pdev,
struct tegra_dfll_soc_data *soc)
{
- struct resource *mem;
struct tegra_dfll *td;
int ret;

@@ -1985,51 +1984,26 @@ int tegra_dfll_register(struct platform_device *pdev,
return ret;
}

- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem) {
- dev_err(td->dev, "no control register resource\n");
- return -ENODEV;
- }
-
- td->base = devm_ioremap(td->dev, mem->start, resource_size(mem));
+ td->base = devm_platform_ioremap_resource(pdev, 0);
if (!td->base) {
dev_err(td->dev, "couldn't ioremap DFLL control registers\n");
return -ENODEV;
}

- mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!mem) {
- dev_err(td->dev, "no i2c_base resource\n");
- return -ENODEV;
- }
-
- td->i2c_base = devm_ioremap(td->dev, mem->start, resource_size(mem));
+ td->i2c_base = devm_platform_ioremap_resource(pdev, 1);
if (!td->i2c_base) {
dev_err(td->dev, "couldn't ioremap i2c_base resource\n");
return -ENODEV;
}

- mem = platform_get_resource(pdev, IORESOURCE_MEM, 2);
- if (!mem) {
- dev_err(td->dev, "no i2c_controller_base resource\n");
- return -ENODEV;
- }
-
- td->i2c_controller_base = devm_ioremap(td->dev, mem->start,
- resource_size(mem));
+ td->i2c_controller_base = devm_platform_ioremap_resource(pdev, 2);
if (!td->i2c_controller_base) {
dev_err(td->dev,
"couldn't ioremap i2c_controller_base resource\n");
return -ENODEV;
}

- mem = platform_get_resource(pdev, IORESOURCE_MEM, 3);
- if (!mem) {
- dev_err(td->dev, "no lut_base resource\n");
- return -ENODEV;
- }
-
- td->lut_base = devm_ioremap(td->dev, mem->start, resource_size(mem));
+ td->lut_base = devm_platform_ioremap_resource(pdev, 3);
if (!td->lut_base) {
dev_err(td->dev,
"couldn't ioremap lut_base resource\n");
--
2.17.1
\
 
 \ /
  Last update: 2019-12-09 20:59    [W:0.089 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site