public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Gerald Schaefer <geraldsc@de.ibm.com>,
	Sebastian Ott <sebott@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] asm-generic/io.h: convert readX defines to functions
Date: Mon, 7 Jan 2013 16:34:59 +0100	[thread overview]
Message-ID: <20130107153459.GA6898@osiris> (raw)

>From 75cde984766e7a76d194a11e513a039b5d0a6204 Mon Sep 17 00:00:00 2001
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Date: Mon, 7 Jan 2013 14:17:23 +0100
Subject: [PATCH] asm-generic/io.h: convert readX defines to functions

E.g. readl is defined like this

 #define readl(addr) __le32_to_cpu(__raw_readl(addr))

If there is a readl() call that doesn't check the return value
this will cause a compile warning on big endian machines due to
the __le32_to_cpu macro magic.

E.g. code like this:

	readl(addr);

will generate the following compile warning:

warning: value computed is not used [-Wunused-value]

Convert the defines to functions so we get rid of these warnings.
With this patch we get rid of dozens of compile warnings on s390.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 include/asm-generic/io.h | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 9e0ebe0..2d30764 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -54,8 +54,18 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
 #endif
 
 #define readb __raw_readb
-#define readw(addr) __le16_to_cpu(__raw_readw(addr))
-#define readl(addr) __le32_to_cpu(__raw_readl(addr))
+
+#define readw readw
+static inline u16 readw(const volatile void __iomem *addr)
+{
+	return __le16_to_cpu(__raw_readw(addr));
+}
+
+#define readl readl
+static inline u32 __raw_readl(const volatile void __iomem *addr)
+{
+	return __le32_to_cpu(__raw_readl(addr));
+}
 
 #ifndef __raw_writeb
 static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
@@ -90,7 +100,11 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
 }
 #endif
 
-#define readq(addr) __le64_to_cpu(__raw_readq(addr))
+#define readq readq
+static inline u64 readq(const volatile void __iomem *addr)
+{
+	return __le64_to_cpu(__raw_readq(addr));
+}
 
 #ifndef __raw_writeq
 static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
-- 
1.7.12.4


             reply	other threads:[~2013-01-07 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07 15:34 Heiko Carstens [this message]
2013-01-07 15:42 ` [PATCH] asm-generic/io.h: convert readX defines to functions Arnd Bergmann
2013-01-07 16:09   ` Heiko Carstens

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=20130107153459.GA6898@osiris \
    --to=heiko.carstens@de.ibm.com \
    --cc=arnd@arndb.de \
    --cc=geraldsc@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sebott@linux.vnet.ibm.com \
    /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