linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource: clint: Avoid remove __iomem in get_cycles_hi()
@ 2020-12-22  5:32 Palmer Dabbelt
  2020-12-22  9:34 ` David Laight
  2020-12-23  8:23 ` Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Palmer Dabbelt @ 2020-12-22  5:32 UTC (permalink / raw)
  To: linux-riscv
  Cc: daniel.lezcano, tglx, linux-kernel, kernel-team, Palmer Dabbelt,
	kernel test robot

From: Palmer Dabbelt <palmerdabbelt@google.com>

This cast loses the __iomem qualifier from clint_timer_val, which
triggers an sparse warning.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
---
 drivers/clocksource/timer-clint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-clint.c b/drivers/clocksource/timer-clint.c
index 6cfe2ab73eb0..83a8b38d46f6 100644
--- a/drivers/clocksource/timer-clint.c
+++ b/drivers/clocksource/timer-clint.c
@@ -63,7 +63,7 @@ static struct riscv_ipi_ops clint_ipi_ops = {
 #define clint_get_cycles()	readq_relaxed(clint_timer_val)
 #else
 #define clint_get_cycles()	readl_relaxed(clint_timer_val)
-#define clint_get_cycles_hi()	readl_relaxed(((u32 *)clint_timer_val) + 1)
+#define clint_get_cycles_hi()	readl_relaxed(((u32 __iomem *)clint_timer_val) + 1)
 #endif
 
 #ifdef CONFIG_64BIT
-- 
2.29.2.729.g45daf8777d-goog


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

* RE: [PATCH] clocksource: clint: Avoid remove __iomem in get_cycles_hi()
  2020-12-22  5:32 [PATCH] clocksource: clint: Avoid remove __iomem in get_cycles_hi() Palmer Dabbelt
@ 2020-12-22  9:34 ` David Laight
  2020-12-23  8:23 ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: David Laight @ 2020-12-22  9:34 UTC (permalink / raw)
  To: 'Palmer Dabbelt', linux-riscv
  Cc: daniel.lezcano, tglx, linux-kernel, kernel-team, Palmer Dabbelt,
	kernel test robot

From: Palmer Dabbelt
> Sent: 22 December 2020 05:33
> 
> From: Palmer Dabbelt <palmerdabbelt@google.com>
> 
> This cast loses the __iomem qualifier from clint_timer_val, which
> triggers an sparse warning.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
> ---
>  drivers/clocksource/timer-clint.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clocksource/timer-clint.c b/drivers/clocksource/timer-clint.c
> index 6cfe2ab73eb0..83a8b38d46f6 100644
> --- a/drivers/clocksource/timer-clint.c
> +++ b/drivers/clocksource/timer-clint.c
> @@ -63,7 +63,7 @@ static struct riscv_ipi_ops clint_ipi_ops = {
>  #define clint_get_cycles()	readq_relaxed(clint_timer_val)
>  #else
>  #define clint_get_cycles()	readl_relaxed(clint_timer_val)
> -#define clint_get_cycles_hi()	readl_relaxed(((u32 *)clint_timer_val) + 1)
> +#define clint_get_cycles_hi()	readl_relaxed(((u32 __iomem *)clint_timer_val) + 1)
>  #endif

The correct fix is (probably) to define clint_timer_val as u32 on 32bit systems.

Oh - and get rid of those #defines, they are only used in the
functions just below them.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


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

* Re: [PATCH] clocksource: clint: Avoid remove __iomem in get_cycles_hi()
  2020-12-22  5:32 [PATCH] clocksource: clint: Avoid remove __iomem in get_cycles_hi() Palmer Dabbelt
  2020-12-22  9:34 ` David Laight
@ 2020-12-23  8:23 ` Christoph Hellwig
  2020-12-24  2:59   ` Palmer Dabbelt
  1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2020-12-23  8:23 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: linux-riscv, daniel.lezcano, kernel test robot, Palmer Dabbelt,
	linux-kernel, tglx, kernel-team

On Mon, Dec 21, 2020 at 09:32:30PM -0800, Palmer Dabbelt wrote:
> From: Palmer Dabbelt <palmerdabbelt@google.com>
> 
> This cast loses the __iomem qualifier from clint_timer_val, which
> triggers an sparse warning.

I'm not a native speaker, but the subject line sounds strange to me.
Shouldn't this be:

	"don't cast away the __iommu annotation"

or something similar?

Also this adds an overly long line.  Otherwise it looks fine.

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

* Re: [PATCH] clocksource: clint: Avoid remove __iomem in get_cycles_hi()
  2020-12-23  8:23 ` Christoph Hellwig
@ 2020-12-24  2:59   ` Palmer Dabbelt
  2020-12-24  6:39     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Palmer Dabbelt @ 2020-12-24  2:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-riscv, daniel.lezcano, lkp, linux-kernel, tglx, kernel-team

On Wed, 23 Dec 2020 00:23:30 PST (-0800), Christoph Hellwig wrote:
> On Mon, Dec 21, 2020 at 09:32:30PM -0800, Palmer Dabbelt wrote:
>> From: Palmer Dabbelt <palmerdabbelt@google.com>
>>
>> This cast loses the __iomem qualifier from clint_timer_val, which
>> triggers an sparse warning.
>
> I'm not a native speaker, but the subject line sounds strange to me.
> Shouldn't this be:
>
> 	"don't cast away the __iommu annotation"
>
> or something similar?

The title is also nonsense, I was probably trying to do two things at once when
I wrote this.  I'll send another one.

> Also this adds an overly long line.  Otherwise it looks fine.

Aren't we OK with lines longer than 80 characters now?  Or was that some other
project?  checkpatch doesn't complain, which I guess is why I didn't notice, so
hopefully that means I'm not crazy (though I guess the commit message and title
don't provide the best argument there... ;)).

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

* Re: [PATCH] clocksource: clint: Avoid remove __iomem in get_cycles_hi()
  2020-12-24  2:59   ` Palmer Dabbelt
@ 2020-12-24  6:39     ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-12-24  6:39 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: Christoph Hellwig, linux-riscv, daniel.lezcano, lkp,
	linux-kernel, tglx, kernel-team

On Wed, Dec 23, 2020 at 06:59:34PM -0800, Palmer Dabbelt wrote:
> Aren't we OK with lines longer than 80 characters now?  Or was that some other
> project?  checkpatch doesn't complain, which I guess is why I didn't notice, so
> hopefully that means I'm not crazy (though I guess the commit message and title
> don't provide the best argument there... ;)).

They are allowed as an exception, not the norm.  Take a look at the
coding style document.  And checkpath has for a while not been doing the
right thing unfortunately.

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

end of thread, other threads:[~2020-12-24  6:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22  5:32 [PATCH] clocksource: clint: Avoid remove __iomem in get_cycles_hi() Palmer Dabbelt
2020-12-22  9:34 ` David Laight
2020-12-23  8:23 ` Christoph Hellwig
2020-12-24  2:59   ` Palmer Dabbelt
2020-12-24  6:39     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).