[PATCH 05/18] cpuidle: make a single register function for all

Daniel Lezcano daniel.lezcano at linaro.org
Wed Apr 10 14:02:31 EDT 2013


On 04/10/2013 07:04 PM, Andrew Lunn wrote:
>> +int cpuidle_register(struct cpuidle_driver *drv,
>> +		     const struct cpumask *const coupled_cpus)
>> +{
>> +	int ret, cpu;
>> +	struct cpuidle_device *device;
>> +
>> +	ret = cpuidle_register_driver(drv);
>> +	if (ret) {
>> +		printk(KERN_ERR "failed to register cpuidle driver\n");
>> +		return ret;
>> +	}
>> +
>> +	for_each_possible_cpu(cpu) {
>> +		device = &per_cpu(cpuidle_dev, cpu);
>> +		device->cpu = cpu;
>> +#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
>> +		device->coupled_cpus = *coupled_cpus;
>> +#endif
> 
> At least the kirkwood and the calxeda driver set 
> 
>    device->state_count
> 
> which you don't appear to do. cpuidle_add_state_sysfs() and
> cpuidle_remove_state_sysfs() use this. Is it now being set somewhere
> else?

Yes, in cpuidle_enable_device called from cpuidle_register_device:


int cpuidle_enable_device(struct cpuidle_device *dev)
{
	...

        if (!dev->state_count)
                dev->state_count = drv->state_count;

	...
}

-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog




More information about the linux-arm-kernel mailing list