Commit cdab83f9 authored by Yangtao Li's avatar Yangtao Li Committed by Daniel Lezcano

clocksource/drivers/timer-ti-dm: Convert to devm_platform_ioremap_resource

Use devm_platform_ioremap_resource() to simplify code, which
wraps 'platform_get_resource' and 'devm_ioremap_resource' in a
single helper.
Signed-off-by: default avatarYangtao Li <tiny.windzz@gmail.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20191221173027.30716-4-tiny.windzz@gmail.com
parent ba25322e
...@@ -780,7 +780,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev) ...@@ -780,7 +780,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
{ {
unsigned long flags; unsigned long flags;
struct omap_dm_timer *timer; struct omap_dm_timer *timer;
struct resource *mem, *irq; struct resource *irq;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct dmtimer_platform_data *pdata; const struct dmtimer_platform_data *pdata;
int ret; int ret;
...@@ -802,18 +802,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev) ...@@ -802,18 +802,12 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (unlikely(!mem)) {
dev_err(dev, "%s: no memory resource.\n", __func__);
return -ENODEV;
}
timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL); timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL);
if (!timer) if (!timer)
return -ENOMEM; return -ENOMEM;
timer->fclk = ERR_PTR(-ENODEV); timer->fclk = ERR_PTR(-ENODEV);
timer->io_base = devm_ioremap_resource(dev, mem); timer->io_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(timer->io_base)) if (IS_ERR(timer->io_base))
return PTR_ERR(timer->io_base); return PTR_ERR(timer->io_base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment