On Thu, 12 Jul 2007 15:47:04 +0100 (BST), "Maciej W. Rozycki"
> > CKSEG1ADDR() returns unsigned int value on 32bit kernel. Cast it to
> This is not true. With a 32-bit kernel CKSEG1ADDR(), quite
> intentionally, returns a *signed* int.
Yes, the comment was wrong. Thanks.
> Since you have decided to fix the symptom rather than the bug I would at
> least suggest to cast the result to "long" first and only then drop the
> signedness. Otherwise it looks misleading to a casual reader.
OK, I added cast to "long", and a comment to why the cast was
Subject: [MIPS] Workaround for a sparse warning in include/asm-mips/io.h (part
Since CKSEG1ADDR() returns "signed int" (on 32bit), cast it to "long"
first to avoid misleading. Also add a comment why the cast to
"unsigned long" was introduced.
Signed-off-by: Atsushi Nemoto <email@example.com>
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 7ba9289..ad60863 100644
@@ -212,8 +212,9 @@ static inline void __iomem * __ioremap_mode(phys_t offset,
unsigned long size,
if (__IS_LOW512(phys_addr) && __IS_LOW512(last_addr) &&
flags == _CACHE_UNCACHED)
+ /* The cast to unsigned long makes sparse happy */
return (void __iomem *)
- (unsigned long)CKSEG1ADDR(phys_addr);
+ (unsigned long)(long)CKSEG1ADDR(phys_addr);
return __ioremap(offset, size, flags);