Re: [PATCH] x86 (Linux Tiny): configure out support for someprocessors

From: Ingo Molnar
Date: Fri Feb 08 2008 - 18:12:11 EST



looks good to me, but the patch needs a serious #ifdef removal pass:

* Michael Opdenacker <michael-lists@xxxxxxxxxxxxxxxxxx> wrote:

> switch (c->x86_vendor) {
> +#ifdef CONFIG_CPU_SUP_AMD
> case X86_VENDOR_AMD:
> early_init_amd(c);
> break;
> +#endif
> +#ifdef CONFIG_CPU_SUP_INTEL
> case X86_VENDOR_INTEL:
> early_init_intel(c);
> break;
> +#endif

would be nice to hide these #ifdefs into include files. (define
early_init_intel()/etc. as an empty inline in an include file)

> +#ifdef CONFIG_CPU_SUP_INTEL
> intel_cpu_init();
> +#endif
> +#ifdef CONFIG_CPU_SUP_CYRIX
> cyrix_init_cpu();
> +#endif
> +#ifdef CONFIG_CPU_SUP_NSC
> nsc_init_cpu();
> +#endif
> +#ifdef CONFIG_CPU_SUP_AMD
> amd_init_cpu();
> +#endif
> +#ifdef CONFIG_CPU_SUP_CENTAUR
> centaur_init_cpu();
> +#endif
> +#ifdef CONFIG_CPU_SUP_TRANSMETA
> transmeta_init_cpu();
> +#endif
> +#ifdef CONFIG_CPU_SUP_NEXGEN
> nexgen_init_cpu();
> +#endif
> +#ifdef CONFIG_CPU_SUP_UMC
> umc_init_cpu();
> +#endif

ditto - hide this into cpu.h.

> static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
> {
> +#ifdef CONFIG_CPU_SUP_AMD
> if (force_mwait)
> return 1;
> +#endif

same - use cpu.h to define force_mwait to 0 if !CPU_SUP_AMD.

> +#ifdef CONFIG_CPU_SUP_INTEL
> static inline int page_kills_ppro(unsigned long pagenr)
> {
> if (pagenr >= 0x70000 && pagenr <= 0x7003F)
> return 1;
> return 0;
> }
> +#endif

put the #ifdef _inside_ the inline, thus:

> - if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn))) {
> + if (page_is_ram(pfn)
> +#ifdef CONFIG_CPU_SUP_INTEL
> + && !(bad_ppro && page_kills_ppro(pfn))
> +#endif

you can avoid this #ifdef. [handle bad_ppro too]

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/