Commit 7cfa8553 authored by Manivannan Sadhasivam's avatar Manivannan Sadhasivam Committed by Viresh Kumar

cpufreq: qcom-hw: Use cached dev pointer in probe()

There are multiple instances of dev pointer used in the probe() function.
Instead of referencing pdev->dev all the time, let's use a cached dev
pointer to simplify the code.
Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 054a3ef6
...@@ -618,18 +618,19 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = { ...@@ -618,18 +618,19 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = {
static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev;
struct device *cpu_dev; struct device *cpu_dev;
struct clk *clk; struct clk *clk;
int ret, i, num_domains; int ret, i, num_domains;
clk = clk_get(&pdev->dev, "xo"); clk = clk_get(dev, "xo");
if (IS_ERR(clk)) if (IS_ERR(clk))
return PTR_ERR(clk); return PTR_ERR(clk);
xo_rate = clk_get_rate(clk); xo_rate = clk_get_rate(clk);
clk_put(clk); clk_put(clk);
clk = clk_get(&pdev->dev, "alternate"); clk = clk_get(dev, "alternate");
if (IS_ERR(clk)) if (IS_ERR(clk))
return PTR_ERR(clk); return PTR_ERR(clk);
...@@ -648,11 +649,11 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) ...@@ -648,11 +649,11 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
return ret; return ret;
/* Allocate qcom_cpufreq_data based on the available frequency domains in DT */ /* Allocate qcom_cpufreq_data based on the available frequency domains in DT */
num_domains = of_property_count_elems_of_size(pdev->dev.of_node, "reg", sizeof(u32) * 4); num_domains = of_property_count_elems_of_size(dev->of_node, "reg", sizeof(u32) * 4);
if (num_domains <= 0) if (num_domains <= 0)
return num_domains; return num_domains;
qcom_cpufreq.data = devm_kzalloc(&pdev->dev, sizeof(struct qcom_cpufreq_data) * num_domains, qcom_cpufreq.data = devm_kzalloc(dev, sizeof(struct qcom_cpufreq_data) * num_domains,
GFP_KERNEL); GFP_KERNEL);
if (!qcom_cpufreq.data) if (!qcom_cpufreq.data)
return -ENOMEM; return -ENOMEM;
...@@ -664,7 +665,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) ...@@ -664,7 +665,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
base = devm_platform_get_and_ioremap_resource(pdev, i, &res); base = devm_platform_get_and_ioremap_resource(pdev, i, &res);
if (IS_ERR(base)) { if (IS_ERR(base)) {
dev_err(&pdev->dev, "Failed to map resource %pR\n", res); dev_err(dev, "Failed to map resource %pR\n", res);
return PTR_ERR(base); return PTR_ERR(base);
} }
...@@ -674,9 +675,9 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) ...@@ -674,9 +675,9 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
ret = cpufreq_register_driver(&cpufreq_qcom_hw_driver); ret = cpufreq_register_driver(&cpufreq_qcom_hw_driver);
if (ret) if (ret)
dev_err(&pdev->dev, "CPUFreq HW driver failed to register\n"); dev_err(dev, "CPUFreq HW driver failed to register\n");
else else
dev_dbg(&pdev->dev, "QCOM CPUFreq HW driver initialized\n"); dev_dbg(dev, "QCOM CPUFreq HW driver initialized\n");
return ret; return ret;
} }
......
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