[PATCH 2/4] cpuidle: define the enter function in the driver structure
Rafael J. Wysocki
rjw at sisk.pl
Thu Jul 5 20:38:44 UTC 2012
On Thursday, July 05, 2012, Daniel Lezcano wrote:
> We have the state index passed as parameter to the 'enter' function.
> Most of the drivers assign their 'enter' functions several times in
> the cpuidle_state structure, as we have the index, we can delegate
> to the driver to handle their own callback array.
>
> That will have the benefit of removing multiple lines of code in the
> different drivers.
Hmm. I suppose the cpuidle subsystem was designed the way it was for a reason.
Among other things, this was to avoid recurrence in callbacks - please see
acpi_idle_enter_bm() for example.
Now, if .enter() is moved to the driver structure, it will have to be an
all-purpose complicated routine calling itself recursively at least in
some cases. I'm not quite convinced that would be an improvement.
On the other hand, I don't see anything wrong with setting several callback
pointers to the same routine.
Thanks,
Rafael
More information about the linaro-dev
mailing list