Re: [RFC][patch 02/12] remove clocksource inline functions

From: Martin Schwidefsky
Date: Wed Jul 29 2009 - 12:38:08 EST


On Wed, 29 Jul 2009 08:52:50 -0700
Daniel Walker <dwalker@xxxxxxxxxx> wrote:

> On Wed, 2009-07-29 at 17:32 +0200, Martin Schwidefsky wrote:
> > Hmm, you have an object of type struct clocksource and you do
> > cs->read(cs). If that is not clear enough then I don't know what is.
>
> It's not as clear as it could be .. In the case above you have to look
> in at least two places to know what's going on.. First to see the
> cs->read() , and second to see if "cs" is actually a clocksource or
> something else.. "cs" could be declared anyplace with any name.

Well you have something like that in the code:

struct clocksource *clock;

clock = timekeeper.clock;
cycle_now = clock->read(clock);

If I read the function top to bottom I immediately see that clock is a
clocksource and that the code does a read on it. That is not the case
if I need to lookup the clocksource_read wrapper.

> If you see clocksource_read(cs) , you might need to once check what
> clocksource_read() is actually doing, but only once.. After that when
> you see that function you know that variable is a clocksource, and it's
> "read()" is getting called. So you only need to review one line in the
> simplest case.

After you learned (once) that timekeeper.clock is a clock source you
have no trouble to understand the 6 occurrences of clock->read(clock)
there are in the code.

Anyway this seems to be a matter of personal preference, in the end I
don't care too much about the inline functions.

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.

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