On Mon, Jun 28, 2021 at 12:56:41PM +0530, Viresh Kumar wrote: > On 27-06-21, 16:17, Hector Yuan wrote: > > On Mon, 2021-06-14 at 16:10 +0530, Viresh Kumar wrote: > > > On 30-05-21, 00:52, Hector Yuan wrote: > > > > +static int mtk_get_related_cpus(int index, struct cpufreq_mtk *c) > > > > +{ > > > > + struct device_node *cpu_np; > > > > + struct of_phandle_args args; > > > > + int cpu, ret; > > > > + > > > > + for_each_possible_cpu(cpu) { > > > > + cpu_np = of_cpu_device_node_get(cpu); > > > > + if (!cpu_np) > > > > + continue; > > > > + > > > > + ret = of_parse_phandle_with_args(cpu_np, "performance-domains", > > > > + "#performance-domain-cells", 0, > > > > + &args); > > > > + of_node_put(cpu_np); > > > > + if (ret < 0) > > > > + continue; > > > > + > > > > + if (index == args.args[0]) { > > > > + cpumask_set_cpu(cpu, &c->related_cpus); > > > > + mtk_freq_domain_map[cpu] = c; > > > > + } > > > > + } > > > > + > > > > + return 0; > > > > +} > > > > > > I really hope this can be moved to a common place as more than one > > > drier should be required to parse this thing. > > > > > > > Yes, this can be a common part for all performance domain users. But may > > I know whats your suggestion? Put this API in another file or? Thanks > > Rob, Sudeep: You guys have a suggestion on where can we keep a routine for this > ? Probably in driver/cpufreq or some related headers if it needs to access related_cpus and is more cpufreq related in that way ? Orthogonal to that, I prefer to make the generic function take list_name and cells_name as generic. I see we can reuse that qcom-cpufreq-hw.c with "qcom,freq-domain" and "#freq-domain-cells". -- Regards, Sudeep