RE: [linux-pm] [PATCH] CPUidle: compile fix for non-x86

Pallipadi, Venkatesh
2008-01-31T19:18:14Z

>-----Original Message-----
>From: Kevin Hilman [mailto:khilman@mvista.com]
>Sent: Thursday, January 31, 2008 10:51 AM
>To: Pallipadi, Venkatesh
>Cc: Len Brown; ACPI Devel Maling List
>Subject: Re: [linux-pm] [PATCH] CPUidle: compile fix for non-x86
>
>"Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com> writes:
>
>>> Wrap cpu_idle_wait() in an x86 #ifdef since it's x86 only.
>>> Signed-off-by: Kevin Hilman <khilman@mvista.com>
>>>
>>> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
>>> index d2fabe7..4d0f9b0 100644
>>> --- a/drivers/cpuidle/cpuidle.c
>>> +++ b/drivers/cpuidle/cpuidle.c
>>> @@ -82,7 +82,9 @@ void cpuidle_uninstall_idle_handler(void)
>>> {
>>> if (enabled_devices && (pm_idle != pm_idle_old)) {
>>> pm_idle = pm_idle_old;
>>> +#ifdef CONFIG_X86
>>> cpu_idle_wait();
>>> +#endif
>>>
>>
>> The archs that do not have cpu_idle_wait() and has more than one CPU
>> will need something equivalent to cpu_idle_wait() to kick
>all other CPUs
>> out of idle loop.
>> The reason being we do not want another CPU to be in idle
>loop that is
>> being uninstalled here.
>>
>> Do you have more than one logical CPU on your platform?
>
>No, I'm testing on a UP ARM-based platform (TI OMAP.)
>
>Maybe #ifdef CONFIG_SMP is the right thing instead of #ifdef
>CONFIG_X86?
>

Yes. Something like below seems better.

#if !defined(CONFIG_SMP)
#define cpuidle_kick_cpus() do{}while (0)
#elif defined(CONFIG_X86)
#define cpuidle_kick_cpus() cpu_idle_wait()
#else
# error "Arch needs cpu_idle_wait() equivalent here"
#endif

Thanks,
Venki