All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Jaswinder Singh Rajput <jaswinder@kernel.org>,
	x86 maintainers <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -tip] x86: cpu/intel.c cleanup
Date: Sat, 14 Mar 2009 14:20:04 +0100	[thread overview]
Message-ID: <20090314132004.GD17727@elte.hu> (raw)
In-Reply-To: <20090314131142.GA29582@uranus.ravnborg.org>


* Sam Ravnborg <sam@ravnborg.org> wrote:

> >  
> >  #include <asm/processor.h>
> > +#include <asm/topology.h>
> >  #include <asm/pgtable.h>
> > -#include <asm/msr.h>
> > -#include <asm/uaccess.h>
> > -#include <asm/ds.h>
> > +#ifdef CONFIG_X86_LOCAL_APIC
> > +#include <asm/mpspec.h>
> > +#include <asm/apic.h>
> > +#endif
> 
> If these header files are only relevant for 
> CONFIG_X86_LOCAL_APIC then we should move the ifdef down into 
> the header file, so users do not forget it.

apic.h can be included unconditionally - and the mpspec.h 
inclusion can be removed because it's included by apic.h.

> > +			pr_info("CPU: C0 stepping P4 Xeon detected.\n");
> > +			pr_info("CPU: Disabling hardware prefetching (Errata 037)\n");
> >  			lo |= MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE;
> > -			wrmsr (MSR_IA32_MISC_ENABLE, lo, hi);
> > +			wrmsr(MSR_IA32_MISC_ENABLE, lo, hi);
> >  		}
> >  	}
> >  
> > @@ -217,7 +241,7 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
> >  	 * integrated APIC (see 11AP erratum in "Pentium Processor
> >  	 * Specification Update").
> >  	 */
> > -	if (cpu_has_apic && (c->x86<<8 | c->x86_model<<4) == 0x520 &&
> > +	if (cpu_has_apic && (c->x86 << 8 | c->x86_model << 4) == 0x520 &&
> >  	    (c->x86_mask < 0x6 || c->x86_mask == 0xb))
> >  		set_cpu_cap(c, X86_FEATURE_11AP);
> >  
> > @@ -245,28 +269,26 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
> >  #endif
> >  
> >  	intel_smp_check(c);
> > -}
> > -#else
> > -static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
> > -{
> > -}
> >  #endif
> > +}
> 
> To me it is more obvious with the old style.
> Having ifdef's inside the block is less obvious.
> 
> But I have not checked what is the common pattern.

agreed, this one was probably cleaner with the #ifdef block 
outside.

	Ingo

  reply	other threads:[~2009-03-14 13:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-14 12:41 [PATCH -tip] x86: cpu/intel.c cleanup Jaswinder Singh Rajput
2009-03-14 13:11 ` Sam Ravnborg
2009-03-14 13:20   ` Ingo Molnar [this message]
2009-03-14 13:37     ` Jaswinder Singh Rajput
2009-03-14 14:00       ` Vegard Nossum
2009-03-14 15:31         ` Ingo Molnar
2009-03-14 16:04           ` Jaswinder Singh Rajput
2009-03-14 17:04             ` Ingo Molnar
2009-03-14 18:05               ` Jaswinder Singh Rajput
2009-03-15  5:55                 ` Ingo Molnar
2009-03-14 13:21   ` Jaswinder Singh Rajput

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090314132004.GD17727@elte.hu \
    --to=mingo@elte.hu \
    --cc=jaswinder@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.