Thread (6 messages) 6 messages, 3 authors, 2013-03-29

RE: [PATCH 2/2 v2] cpufreq: Add cpufreq driver for Freescale e500mc SoCs

From: Tang Yuantian-B29983 <hidden>
Date: 2013-03-29 02:51:29
Also in: linux-pm

quoted
+static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) {
+       unsigned int cpu =3D policy->cpu;
+       struct device_node *np;
+       int i, count;
+       struct clk *clk;
+       struct cpufreq_frequency_table *table;
+       struct cpu_data *data;
+
+       np =3D of_get_cpu_node(cpu, NULL);
+       if (!np)
+               return -ENODEV;
+
+       data =3D kzalloc(sizeof(struct cpu_data), GFP_KERNEL);
=20
I told you, you missed my comment earlier.
=20
You need to write: sizeof(*data) :(
=20
This is new added statement, what you told last time is about the next kcal=
loc()...

Are there some reasons that we can't use sizeof(struct cpu_data)
instead of sizeof(*data)?
quoted
+       if (!data)
+               return -ENOMEM;
+
+       data->clk =3D of_clk_get(np, 0);
+       data->parent =3D of_parse_phandle(np, "clocks", 0);
+       if (!data->parent) {
+               pr_err("%s: could not get clock information\n",
__func__);
quoted
+               goto err_nomem2;
+       }
+
+       count =3D of_property_count_strings(data->parent,
+ "clock-names");
+
+       table =3D kcalloc(count + 1,
+                       sizeof(struct cpufreq_frequency_table),
+ GFP_KERNEL);
=20
sizeof(*table)
=20
Ditto.
quoted
+       if (!table) {
+               pr_err("%s: no memory\n", __func__);
+               goto err_nomem2;
+       }
+
+       for (i =3D cpu; i < freq_data.cpus_per_cluster + cpu; i++)
+               cpumask_set_cpu(i, policy->cpus);
=20
I can see some regression here. Suppose you have two clusters of 4 cpus
each: (0123) and (4567).. Now at boot time above code will work perfectly
fine. Now you hot unplug 0,1,2,3 and then hotplug 3 in.
=20
Here, init would be called for cpu 3 and so you will end up saving 3456
in your policy->cpus
=20
:)
Good catch.. will fix.

Regards,
Yuantian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help