Re: 2.6.26, PAT and AMD family 6

From: Pavel Machek
Date: Wed May 07 2008 - 19:10:23 EST


On Thu 2008-05-08 01:02:52, Thomas Gleixner wrote:
> On Thu, 8 May 2008, Pavel Machek wrote:
> > On Wed 2008-05-07 15:22:37, Yinghai Lu wrote:
> > > On Wed, May 7, 2008 at 3:14 PM, Pavel Machek <pavel@xxxxxxx> wrote:
> > > > 3) copy&paste code remained in the patch
> > >
> > > i thought to keep the stub so could add more other stuff in the switch
> > > like 64 bit
> >
> > This is _not_ good enough reason to copy&paste. Just do it like this:
> >
> > > switch (c->x86_vendor) {
> > > case X86_VENDOR_AMD:
> > > early_init_amd(c);
> > > break;
> > > case X86_VENDOR_INTEL:
> > > early_init_intel(c);
> > > break;
> > > case X86_VENDOR_CENTAUR:
> > > early_init_centaur(c);
> > > break;
> > > }
> >
> > # clear_cpu_cap(c, X86_FEATURE_PAT);
> > #
> > # switch (c->x86_vendor) {
> > # case X86_VENDOR_AMD:
> > # if (c->x86 >= 0xf && c->x86 <= 0x11)
> > # set_cpu_cap(c, X86_FEATURE_PAT);
> > # break;
> > # case X86_VENDOR_INTEL:
> > # if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))
> > # set_cpu_cap(c, X86_FEATURE_PAT);
> > # break;
> > # }
> >
> > And then, factor out code marked # into separate function, and call it
> > from all three places.
>
> And while you are at it, why don't you send a patch which makes this
> all go away instead of wasting time producing pseudo code?

Because I expect Ingo & Yinghai to do the work, and then test it, and
then add changelog, and then commit it. I expect Yinghai to learn how
to use functions in the process.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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/