[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1409041032200.3333@nanos>
Date: Thu, 4 Sep 2014 10:35:26 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: "Li.Xiubo@...escale.com" <Li.Xiubo@...escale.com>
cc: "daniel.lezcano@...aro.org" <daniel.lezcano@...aro.org>,
"Dongsheng.Wang@...escale.com" <Dongsheng.Wang@...escale.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/5] Clocksource: Flextimer: Use internal clocksource
read API.
On Thu, 4 Sep 2014, Li.Xiubo@...escale.com wrote:
> > Subject: Re: [PATCH 2/5] Clocksource: Flextimer: Use internal clocksource read
> > API.
> >
> > On Tue, 26 Aug 2014, Xiubo Li wrote:
> >
> > > Since the Flextimer device will be implemented in BE mode on
> > > LS1 SoC, and in LE mode on Vybrid, LS2 SoCs, so here we need
> > > the endianness judgment before doing the mmio.
> >
> > Brilliant. So for every clocksource read you take a conditional.
> >
> > > @@ -238,7 +243,7 @@ static int __init ftm_clocksource_init(unsigned long
> > freq)
> > > sched_clock_register(ftm_read_sched_clock, 16, freq / (1 << priv->ps));
> > > err = clocksource_mmio_init(priv->clksrc_base + FTM_CNT, "fsl-ftm",
> > > freq / (1 << priv->ps), 300, 16,
> > > - clocksource_mmio_readl_up);
> > > + ftm_clocksource_read_up);
> >
> > What's wrong with having endianess aware clocksource_mmio functions
> > and make the decision at init time?
> >
>
> Since the FTM will be in BE mode on LS1 platform, but will be in LE mode
> On LS2 platform.
>
> And ftm_clocksource_read_up() will adapt to this different.
You are missing the point. Why do you want a conditional in a hot
path? You know at init time whether the thing is BE or LE, so you can
have separate functions for BE/LE or whatever and register that with
clocksource_mmio_init(). i.e.
if (be)
clocksource_mmio_init(....., cs_read_be);
else if (le)
clocksource_mmio_init(....., cs_read_le);
else if (magic)
clocksource_mmio_init(....., cs_read_magic);
Hmm?
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists