Messages in this thread | | | Date | Wed, 30 Apr 2014 13:39:28 -0400 (EDT) | From | Nicolas Pitre <> | Subject | Re: [PATCH 1/3] sched: idle: Encapsulate the code to compile it out |
| |
On Thu, 24 Apr 2014, Daniel Lezcano wrote:
> Encapsulate the large portion of cpuidle_idle_call inside another > function so when CONFIG_CPU_IDLE=n, the code will be compiled out. > Also that is benefitial for the clarity of the code as it removes > a nested indentation level.
I agree with the nesting level concern.
However I dislike the proliferation of #ifdef's in the main code. Those added in this patch are unnecessary. We want as much compilation coverage as possible.
With cpuidle_enabled() already hardcoded to return -ENODEV when CONFIG_CPU_IDLE=n, the compiler should already be smart enough to optimize away all the redundant code in that case. You may look at the assembly output from the compiler if you're not sure.
And if you're still not trusting the compiler then the second best option is to use IS_ENABLED(CONFIG_CPU_IDLE) inside some if statement.
Nicolas
| |