Skip to content

Commit f17b3e4

Browse files
Mani-Sadhasivamvireshk
authored andcommitted
cpufreq: qcom-hw: Use devm_platform_ioremap_resource() to simplify code
devm_platform_ioremap_resource() is the combination of platform_get_resource() and devm_ioremap_resource(). Hence, use it to simplify the code a bit. Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Amit Kucheria <amitk@kernel.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent 75319b4 commit f17b3e4

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
244244
struct of_phandle_args args;
245245
struct device_node *cpu_np;
246246
struct device *cpu_dev;
247-
struct resource *res;
248247
void __iomem *base;
249248
int ret, index;
250249

@@ -267,13 +266,9 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
267266

268267
index = args.args[0];
269268

270-
res = platform_get_resource(pdev, IORESOURCE_MEM, index);
271-
if (!res)
272-
return -ENODEV;
273-
274-
base = devm_ioremap(dev, res->start, resource_size(res));
275-
if (!base)
276-
return -ENOMEM;
269+
base = devm_platform_ioremap_resource(pdev, index);
270+
if (IS_ERR(base))
271+
return PTR_ERR(base);
277272

278273
/* HW should be in enabled state to proceed */
279274
if (!(readl_relaxed(base + REG_ENABLE) & 0x1)) {

0 commit comments

Comments
 (0)