All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource: Add BE/LE APIs support for clocksource counter reading.
@ 2014-09-10  9:20 Xiubo Li
  2014-09-10 20:33 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Xiubo Li @ 2014-09-10  9:20 UTC (permalink / raw)
  To: tglx, daniel.lezcano; +Cc: linux-kernel, Xiubo Li

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 drivers/clocksource/mmio.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
index 1593ade..ddc5214 100644
--- a/drivers/clocksource/mmio.c
+++ b/drivers/clocksource/mmio.c
@@ -20,21 +20,65 @@ static inline struct clocksource_mmio *to_mmio_clksrc(struct clocksource *c)
 	return container_of(c, struct clocksource_mmio, clksrc);
 }
 
+cycle_t clocksource_mmio_readl_up_be(struct clocksource *c)
+{
+	return (cycle_t)be32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg));
+}
+
+cycle_t clocksource_mmio_readl_up_le(struct clocksource *c)
+{
+	return (cycle_t)le32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg));
+}
+
 cycle_t clocksource_mmio_readl_up(struct clocksource *c)
 {
 	return (cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg);
 }
 
+cycle_t clocksource_mmio_readl_down_be(struct clocksource *c)
+{
+	return ~(cycle_t)be32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg))
+		& c->mask;
+}
+
+cycle_t clocksource_mmio_readl_down_le(struct clocksource *c)
+{
+	return ~(cycle_t)le32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg))
+		& c->mask;
+}
+
 cycle_t clocksource_mmio_readl_down(struct clocksource *c)
 {
 	return ~(cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
 }
 
+cycle_t clocksource_mmio_readw_up_be(struct clocksource *c)
+{
+	return (cycle_t)be16_to_cpu(readw_relaxed(to_mmio_clksrc(c)->reg));
+}
+
+cycle_t clocksource_mmio_readw_up_le(struct clocksource *c)
+{
+	return (cycle_t)le16_to_cpu(readw_relaxed(to_mmio_clksrc(c)->reg));
+}
+
 cycle_t clocksource_mmio_readw_up(struct clocksource *c)
 {
 	return (cycle_t)readw_relaxed(to_mmio_clksrc(c)->reg);
 }
 
+cycle_t clocksource_mmio_readw_down_be(struct clocksource *c)
+{
+	return ~(cycle_t)be16_to_cpu(readw_relaxed(to_mmio_clksrc(c)->reg))
+		& c->mask;
+}
+
+cycle_t clocksource_mmio_readw_down_le(struct clocksource *c)
+{
+	return ~(cycle_t)le16_to_cpu(readw_relaxed(to_mmio_clksrc(c)->reg))
+		& c->mask;
+}
+
 cycle_t clocksource_mmio_readw_down(struct clocksource *c)
 {
 	return ~(cycle_t)readw_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
-- 
2.1.0.27.g96db324


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] clocksource: Add BE/LE APIs support for clocksource counter reading.
  2014-09-10  9:20 [PATCH] clocksource: Add BE/LE APIs support for clocksource counter reading Xiubo Li
@ 2014-09-10 20:33 ` Thomas Gleixner
  2014-09-11  2:32   ` Li.Xiubo
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2014-09-10 20:33 UTC (permalink / raw)
  To: Xiubo Li; +Cc: daniel.lezcano, linux-kernel

On Wed, 10 Sep 2014, Xiubo Li wrote:

So you add BE/LE APIs according to the subject line, but you fail
again to tell WHY. If that would be the only issue ....
 
> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> ---
>  drivers/clocksource/mmio.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
> index 1593ade..ddc5214 100644
> --- a/drivers/clocksource/mmio.c
> +++ b/drivers/clocksource/mmio.c

So you think that adding this to mmio.c is the solution to the
problem?

Ever heard about function prototypes, header files and such? 

> @@ -20,21 +20,65 @@ static inline struct clocksource_mmio *to_mmio_clksrc(struct clocksource *c)
>  	return container_of(c, struct clocksource_mmio, clksrc);
>  }
>  
> +cycle_t clocksource_mmio_readl_up_be(struct clocksource *c)
> +{
> +	return (cycle_t)be32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg));
> +}
> +
> +cycle_t clocksource_mmio_readl_up_le(struct clocksource *c)
> +{
> +	return (cycle_t)le32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg));
> +}
> +
>  cycle_t clocksource_mmio_readl_up(struct clocksource *c)
>  {
>  	return (cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg);
>  }

So now we have three global functions which provide access to the mmio
clocksource. And one of them is always redundant for a given compile
time endianess. You can't be serious about this...

But ... wait, I've seen enough qualitee code from Fleascale in the
past 10 years, so you actually might be serious about it.

JFYI: You are trying to submit code to the public maintained codebase
of the Linux kernel, not to some random sh^H^Hgit repository inside of
Fleascale which accepts any random amount of crap. Can you see the
difference?

I can see it rather clearly.

Thanks,

	tglx




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] clocksource: Add BE/LE APIs support for clocksource counter reading.
  2014-09-10 20:33 ` Thomas Gleixner
@ 2014-09-11  2:32   ` Li.Xiubo
  0 siblings, 0 replies; 3+ messages in thread
From: Li.Xiubo @ 2014-09-11  2:32 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: daniel.lezcano, linux-kernel

> Cc: daniel.lezcano@linaro.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] clocksource: Add BE/LE APIs support for clocksource
> counter reading.
> 
> On Wed, 10 Sep 2014, Xiubo Li wrote:
> 
> So you add BE/LE APIs according to the subject line, but you fail
> again to tell WHY. If that would be the only issue ....
> 
> > Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> > ---
> >  drivers/clocksource/mmio.c | 44
> ++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 44 insertions(+)
> >
> > diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
> > index 1593ade..ddc5214 100644
> > --- a/drivers/clocksource/mmio.c
> > +++ b/drivers/clocksource/mmio.c
> 
> So you think that adding this to mmio.c is the solution to the
> problem?
> 

It's just one solution of this, and will be a little faster than the old one
When reading the counter value.


> Ever heard about function prototypes, header files and such?
> 

Yes, this will be fixed later if this is acceptable.

> > @@ -20,21 +20,65 @@ static inline struct clocksource_mmio
> *to_mmio_clksrc(struct clocksource *c)
> >  	return container_of(c, struct clocksource_mmio, clksrc);
> >  }
> >
> > +cycle_t clocksource_mmio_readl_up_be(struct clocksource *c)
> > +{
> > +	return (cycle_t)be32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg));
> > +}
> > +
> > +cycle_t clocksource_mmio_readl_up_le(struct clocksource *c)
> > +{
> > +	return (cycle_t)le32_to_cpu(readl_relaxed(to_mmio_clksrc(c)->reg));
> > +}
> > +
> >  cycle_t clocksource_mmio_readl_up(struct clocksource *c)
> >  {
> >  	return (cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg);
> >  }
> 
> So now we have three global functions which provide access to the mmio
> clocksource. And one of them is always redundant for a given compile
> time endianess. You can't be serious about this...
> 
 
Yes, any good suggestion about this ?

I found whatever the method it is about the endianness will always be many
Different voices from different people and found it hard to taste all of them. 

So firstly I just using the driver's local APIs.

Thanks,

BRs
Xiubo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-11  2:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-10  9:20 [PATCH] clocksource: Add BE/LE APIs support for clocksource counter reading Xiubo Li
2014-09-10 20:33 ` Thomas Gleixner
2014-09-11  2:32   ` Li.Xiubo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.