lkml.org 
[lkml]   [2018]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 14/15] cpufreq: Add module to register cpufreq on Krait CPUs
On 06-02-18, 09:38, Sricharan R wrote:
> diff --git a/drivers/cpufreq/qcom-cpufreq.c b/drivers/cpufreq/qcom-cpufreq.c
> new file mode 100644
> index 0000000..5b988d4
> --- /dev/null
> +++ b/drivers/cpufreq/qcom-cpufreq.c
> @@ -0,0 +1,161 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (c) 2018, The Linux Foundation. All rights reserved.
> +
> +#include <linux/cpu.h>
> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/io.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_opp.h>
> +#include <linux/slab.h>
> +#include "cpufreq-dt.h"
> +#include <linux/nvmem-consumer.h>

I don't think you need all of these anymore, isn't it ? Can you cross check
which ones are really required? For example, cpufreq-dt.h isn't required for
sure.

> +static int __init qcom_cpufreq_driver_init(void)
> +{
> + struct device *cpu_dev;
> + struct device_node *np;
> + struct nvmem_cell *pvs_nvmem;
> + int ret;
> +
> + cpu_dev = get_cpu_device(0);
> + if (!cpu_dev)
> + return -ENODEV;
> +
> + np = dev_pm_opp_of_get_opp_desc_node(cpu_dev);
> + if (!np)
> + return -ENOENT;
> +
> + if (!of_device_is_compatible(np, "operating-points-v2-krait-cpu")) {
> + of_node_put(np);
> + return -ENODEV;
> + }
> +
> + pvs_nvmem = of_nvmem_cell_get(np, NULL);
> + if (IS_ERR(pvs_nvmem)) {
> + dev_err(cpu_dev, "Could not get nvmem cell\n");
> + return PTR_ERR(pvs_nvmem);
> + }
> +
> + of_node_put(np);
> +
> + ret = qcom_cpufreq_populate_opps(pvs_nvmem);
> + if (ret)
> + return ret;
> +
> + return PTR_ERR(platform_device_register_simple("cpufreq-dt",
> + -1, NULL, 0));

Wanna do proper error handling here? For example, unset OPP name on failure here
so that resources get freed ?

> +}
> +module_init(qcom_cpufreq_driver_init);
> +
> +MODULE_DESCRIPTION("Qualcomm CPUfreq driver");
> +MODULE_LICENSE("GPL v2");
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

--
viresh

\
 
 \ /
  Last update: 2018-02-06 05:28    [W:0.127 / U:2.872 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site