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: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
054a3ef683
commit
7cfa8553fe
@ -618,18 +618,19 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = {
|
||||
|
||||
static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device *cpu_dev;
|
||||
struct clk *clk;
|
||||
int ret, i, num_domains;
|
||||
|
||||
clk = clk_get(&pdev->dev, "xo");
|
||||
clk = clk_get(dev, "xo");
|
||||
if (IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
|
||||
xo_rate = clk_get_rate(clk);
|
||||
clk_put(clk);
|
||||
|
||||
clk = clk_get(&pdev->dev, "alternate");
|
||||
clk = clk_get(dev, "alternate");
|
||||
if (IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
|
||||
@ -648,11 +649,11 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
|
||||
/* 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)
|
||||
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);
|
||||
if (!qcom_cpufreq.data)
|
||||
return -ENOMEM;
|
||||
@ -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);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -674,9 +675,9 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
|
||||
|
||||
ret = cpufreq_register_driver(&cpufreq_qcom_hw_driver);
|
||||
if (ret)
|
||||
dev_err(&pdev->dev, "CPUFreq HW driver failed to register\n");
|
||||
dev_err(dev, "CPUFreq HW driver failed to register\n");
|
||||
else
|
||||
dev_dbg(&pdev->dev, "QCOM CPUFreq HW driver initialized\n");
|
||||
dev_dbg(dev, "QCOM CPUFreq HW driver initialized\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user