diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-03-01 04:21:18 -0500 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-03-01 04:21:18 -0500 |
| commit | 185a23b6e7733c51ad8cc8ac7f2687e568e4b38d (patch) | |
| tree | af34275b1cb5ccc83a53eca032e073c7eac4ce88 | |
| parent | 17162a117cd0733ad1db728fa804e62ded9a87d6 (diff) | |
| parent | 0334906c06967142c8805fbe88acf787f65d3d26 (diff) | |
Merge branch 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm into pm-cpufreq
Pull cpufreq driver fixes for v5.1 from Viresh Kumar:
"This pull request contains minor fixes for ap806 and kryo cpufreq
drivers (Julia Lawall and Viresh Kumar)."
* 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm:
cpufreq: kryo: Release OPP tables on module removal
cpufreq: ap806: add missing of_node_put after of_device_is_available
| -rw-r--r-- | drivers/cpufreq/armada-8k-cpufreq.c | 4 | ||||
| -rw-r--r-- | drivers/cpufreq/qcom-cpufreq-kryo.c | 20 |
2 files changed, 21 insertions, 3 deletions
diff --git a/drivers/cpufreq/armada-8k-cpufreq.c b/drivers/cpufreq/armada-8k-cpufreq.c index 8a5ddb93fc58..b3f4bd647e9b 100644 --- a/drivers/cpufreq/armada-8k-cpufreq.c +++ b/drivers/cpufreq/armada-8k-cpufreq.c | |||
| @@ -128,8 +128,10 @@ static int __init armada_8k_cpufreq_init(void) | |||
| 128 | struct cpumask cpus; | 128 | struct cpumask cpus; |
| 129 | 129 | ||
| 130 | node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock"); | 130 | node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock"); |
| 131 | if (!node || !of_device_is_available(node)) | 131 | if (!node || !of_device_is_available(node)) { |
| 132 | of_node_put(node); | ||
| 132 | return -ENODEV; | 133 | return -ENODEV; |
| 134 | } | ||
| 133 | 135 | ||
| 134 | nb_cpus = num_possible_cpus(); | 136 | nb_cpus = num_possible_cpus(); |
| 135 | freq_tables = kcalloc(nb_cpus, sizeof(*freq_tables), GFP_KERNEL); | 137 | freq_tables = kcalloc(nb_cpus, sizeof(*freq_tables), GFP_KERNEL); |
diff --git a/drivers/cpufreq/qcom-cpufreq-kryo.c b/drivers/cpufreq/qcom-cpufreq-kryo.c index 1c8583cc06a2..dd64dcf89c74 100644 --- a/drivers/cpufreq/qcom-cpufreq-kryo.c +++ b/drivers/cpufreq/qcom-cpufreq-kryo.c | |||
| @@ -75,7 +75,7 @@ static enum _msm8996_version qcom_cpufreq_kryo_get_msm_id(void) | |||
| 75 | 75 | ||
| 76 | static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) | 76 | static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) |
| 77 | { | 77 | { |
| 78 | struct opp_table *opp_tables[NR_CPUS] = {0}; | 78 | struct opp_table **opp_tables; |
| 79 | enum _msm8996_version msm8996_version; | 79 | enum _msm8996_version msm8996_version; |
| 80 | struct nvmem_cell *speedbin_nvmem; | 80 | struct nvmem_cell *speedbin_nvmem; |
| 81 | struct device_node *np; | 81 | struct device_node *np; |
| @@ -133,6 +133,10 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) | |||
| 133 | } | 133 | } |
| 134 | kfree(speedbin); | 134 | kfree(speedbin); |
| 135 | 135 | ||
| 136 | opp_tables = kcalloc(num_possible_cpus(), sizeof(*opp_tables), GFP_KERNEL); | ||
| 137 | if (!opp_tables) | ||
| 138 | return -ENOMEM; | ||
| 139 | |||
| 136 | for_each_possible_cpu(cpu) { | 140 | for_each_possible_cpu(cpu) { |
| 137 | cpu_dev = get_cpu_device(cpu); | 141 | cpu_dev = get_cpu_device(cpu); |
| 138 | if (NULL == cpu_dev) { | 142 | if (NULL == cpu_dev) { |
| @@ -151,8 +155,10 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) | |||
| 151 | 155 | ||
| 152 | cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1, | 156 | cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1, |
| 153 | NULL, 0); | 157 | NULL, 0); |
| 154 | if (!IS_ERR(cpufreq_dt_pdev)) | 158 | if (!IS_ERR(cpufreq_dt_pdev)) { |
| 159 | platform_set_drvdata(pdev, opp_tables); | ||
| 155 | return 0; | 160 | return 0; |
| 161 | } | ||
| 156 | 162 | ||
| 157 | ret = PTR_ERR(cpufreq_dt_pdev); | 163 | ret = PTR_ERR(cpufreq_dt_pdev); |
| 158 | dev_err(cpu_dev, "Failed to register platform device\n"); | 164 | dev_err(cpu_dev, "Failed to register platform device\n"); |
| @@ -163,13 +169,23 @@ free_opp: | |||
| 163 | break; | 169 | break; |
| 164 | dev_pm_opp_put_supported_hw(opp_tables[cpu]); | 170 | dev_pm_opp_put_supported_hw(opp_tables[cpu]); |
| 165 | } | 171 | } |
| 172 | kfree(opp_tables); | ||
| 166 | 173 | ||
| 167 | return ret; | 174 | return ret; |
| 168 | } | 175 | } |
| 169 | 176 | ||
| 170 | static int qcom_cpufreq_kryo_remove(struct platform_device *pdev) | 177 | static int qcom_cpufreq_kryo_remove(struct platform_device *pdev) |
| 171 | { | 178 | { |
| 179 | struct opp_table **opp_tables = platform_get_drvdata(pdev); | ||
| 180 | unsigned int cpu; | ||
| 181 | |||
| 172 | platform_device_unregister(cpufreq_dt_pdev); | 182 | platform_device_unregister(cpufreq_dt_pdev); |
| 183 | |||
| 184 | for_each_possible_cpu(cpu) | ||
| 185 | dev_pm_opp_put_supported_hw(opp_tables[cpu]); | ||
| 186 | |||
| 187 | kfree(opp_tables); | ||
| 188 | |||
| 173 | return 0; | 189 | return 0; |
| 174 | } | 190 | } |
| 175 | 191 | ||
