[PATCH v3] cpufreq: scmi: Skip SCMI devices that aren't used by the CPUs

Dan Carpenter dan.carpenter at linaro.org
Wed May 7 06:18:34 PDT 2025


On Wed, May 07, 2025 at 12:59:45PM +0100, Cristian Marussi wrote:
> > +static bool scmi_dev_used_by_cpus(struct device *scmi_dev)
> > +{
> > +	struct device_node *scmi_np = dev_of_node(scmi_dev);
> > +	struct device_node *np;
> > +	struct device *cpu_dev;
> > +	int cpu, idx;
> > +
> > +	if (!scmi_np)
> > +		return false;
> > +
> > +	for_each_possible_cpu(cpu) {
> > +		cpu_dev = get_cpu_device(cpu);
> > +		if (!cpu_dev)
> > +			continue;
> > +
> > +		np = dev_of_node(cpu_dev);
> > +
> > +		if (of_parse_phandle(np, "clocks", 0) == scmi_np)
> 
> Shouldn't this, on Success, be released by an of_node_put() (or, BETTER,
> by some OF-related cleanup.h magic...)
> 

The cleanup.h magic is __free(of_node_put) but dev_of_node() doesn't
take a reference so I don't think it's required.

regards,
dan carpenter

> > +			return true;
> > +
> > +		idx = of_property_match_string(np, "power-domain-names", "perf");
> > +
> > +		if (of_parse_phandle(np, "power-domains", idx) == scmi_np)
> 
> Same.
> 
> > +			return true;
> > +	}
> > +
> > +	return false;
> > +}




More information about the linux-arm-kernel mailing list