Re: [PATCH v2] hwmon (coretemp): Fix build breakage if SMP is undefined

Guenter Roeck
2010-09-27T14:41:28Z

On Mon, Sep 27, 2010 at 08:59:46AM -0400, Ingo Molnar wrote:
>
> * Guenter Roeck <guenter.roeck@ericsson.com> wrote:
>
> > +#ifdef CONFIG_SMP
> > +#endif
> > +#ifdef CONFIG_SMP
> > +#endif
>
> Hm, this tickles my uglo-meter. Is there no cleaner way, preferably one
> that doesnt involve preprocessor directives?
>
After looking through the code I thought about a much cleaner fix for
handling the SMP defines in coretemp.c and pkgtemp.c. Essentially
it will move all SMP dependencies into a single #ifdef, and also
optimize the loop in question with cpumask_first() / cpumask_next().
Maybe I can get rid of some of the SMP dependencies entirely. However,
the driver also uses phys_proc_id and cpu_core_id from cpuinfo_x86,
and those are only available if SMP is defined.

That would be way too invasive for .36, though. I'll stick with the
current patch and submit a cleanup for .37. That also fits well with
the other pending cleanups for the two drivers.

Thanks,
Guenter