Re: [patch 2.6.26-git] /dev/hpet - fixes and cleanup

From: David Brownell
Date: Mon Jul 28 2008 - 04:27:35 EST


On Monday 28 July 2008, Clemens Ladisch wrote:
> > +             /* FIXME this may trash both the system clocksource and
> > +              * the current clock event device!  Use HPET_TN_SETVAL
> > +              * instead, like arch/x86/kernel/hpet.c does ... never
> > +              * modify the counter, ever.
> > +              */
> >               m = read_counter(&hpet->hpet_mc);
> >               write_counter(t + m + hpetp->hp_delta, &timer->hpet_compare);
>
> This comment seems to assume that the code below modifies the main
> counter, which it doesn't.

There's only one counter. How could it not modify that?

Oh ... I see. It's called write_counter() but doesn't
actually write the counter. Likewise, read_counter() is
not actually reading the counter. Gaack ...

So that's not really an issue (good!). I'll strike that
comment, except to comment that it's explicitly not modifying
any counter (just a hidden write-only accumulator) ... but
those silly function names should really be changed so they
have a less tenuous connection with reality. In fact, most
places would be better off just hard-wiring 32-bit access...


> Additionally, HPET_TN_SETVAL has the same
> value as Tn_VAL_SET_CNF_MASK (from <linux/hpet.h>), which _is_ used.

OK, I can see that too. This HPET stuff is really a lot
dirtier than I had expected ... there's no reason at all
to have two separate headers with two incompatible sets
of definitions for the same registers!!


Any comments on the rest?

- Dave

--
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/