mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Li.Xiubo@freescale.com" <Li.Xiubo@freescale.com>
Cc: "daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
	"Dongsheng.Wang@freescale.com" <Dongsheng.Wang@freescale.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 2/5] Clocksource: Flextimer: Use internal clocksource read API.
Date: Thu, 4 Sep 2014 10:45:51 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1409041044350.3333@nanos> (raw)
In-Reply-To: <69c4ca3ee1324a3894a6d5dc0bde38ed@BY2PR0301MB0613.namprd03.prod.outlook.com>

On Thu, 4 Sep 2014, Li.Xiubo@freescale.com wrote:
> > >
> > > 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);
> > 
> 
> There already has the following access interfaces:
> 
> static inline u32 ftm_readl(void __iomem *addr)
> {
>         if (priv->big_endian)
>                 return ioread32be(addr);
>         else
>                 return ioread32(addr);
> }
> 
> static inline void ftm_writel(u32 val, void __iomem *addr)
> {
>         if (priv->big_endian)
>                 iowrite32be(val, addr);
>         else
>                 iowrite32(val, addr);
> }
> 
> So I added the following code:
> 
> static cycle_t ftm_clocksource_read_up(struct clocksource *c)
> {
>         return ftm_readl(priv->clksrc_base + FTM_CNT) & 0xffff;
> }
> 
> clocksource_mmio_init(.....,ftm_clocksource_read_up);
> 
> Is this okay ?

No. Sit down, read and try to understand what I wrote, look at your
existing code and figure out WHY it is fundamentally different to what
I told you.

Thanks,

	tglx

  reply	other threads:[~2014-09-04  8:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26  5:45 [PATCH 0/5] Clocksource: Flextimer: Merged to LS1 Xiubo Li
2014-08-26  5:45 ` [PATCH 1/5] Clocksource: Flextimer: Set cpumask to cpu_possible_mask Xiubo Li
2014-08-26  5:45 ` [PATCH 2/5] Clocksource: Flextimer: Use internal clocksource read API Xiubo Li
2014-09-03 10:38   ` Thomas Gleixner
2014-09-04  1:49     ` Li.Xiubo
2014-09-04  8:35       ` Thomas Gleixner
2014-09-04  8:43         ` Li.Xiubo
2014-09-04  8:45           ` Thomas Gleixner [this message]
2014-09-04  8:53             ` Li.Xiubo
2014-09-05  5:59             ` Li.Xiubo
2014-08-26  5:45 ` [PATCH 3/5] Clocksource: Flextimer: Remove the useless code Xiubo Li
2014-08-26  5:45 ` [PATCH 4/5] Clocksource: Flextimer: Fix counter clock prescaler calculation Xiubo Li
2014-09-03 10:57   ` Thomas Gleixner
2014-09-04  2:18     ` Li.Xiubo
2014-09-03 10:59   ` Thomas Gleixner
2014-09-04  2:03     ` Li.Xiubo
2014-08-26  5:45 ` [PATCH 5/5] Clocksource: Flextimer: Use Macro for clock source selection Xiubo Li
2014-09-03 12:01   ` Thomas Gleixner
2014-09-04  2:06     ` Li.Xiubo
2014-09-04  8:36       ` Thomas Gleixner
2014-09-03  3:50 ` [PATCH 0/5] Clocksource: Flextimer: Merged to LS1 Li.Xiubo

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=alpine.DEB.2.10.1409041044350.3333@nanos \
    --to=tglx@linutronix.de \
    --cc=Dongsheng.Wang@freescale.com \
    --cc=Li.Xiubo@freescale.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®