linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-ia64@vger.kernel.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	x86@kernel.org, Stephen Boyd <sboyd@codeaurora.org>,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	sparclinux@vger.kernel.org, Russell King <linux@arm.linux.org.uk>,
	Sam Ravnborg <sam@ravnborg.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 3/8] sparc: Remove unnecessary volatile usage
Date: Wed, 13 Aug 2014 12:28:53 +0200	[thread overview]
Message-ID: <1407925738-26170-4-git-send-email-thierry.reding@gmail.com> (raw)
In-Reply-To: <1407925738-26170-1-git-send-email-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

The volatile keyword is only necessary in accessors that immediately
perform memory accesses. Wrappers around such accessors, such as the
_memset_io() and _memcpy_{to,from}io() functions don't need them.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v4:
- new patch

 arch/sparc/include/asm/io_32.h | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index 9f532902627c..49267f2575d7 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -16,18 +16,15 @@
 
 #include <asm-generic/io.h>
 
-static inline void _memset_io(volatile void __iomem *dst,
-                              int c, __kernel_size_t n)
+static inline void _memset_io(void __iomem *dst, int c, __kernel_size_t n)
 {
-	volatile void __iomem *d = dst;
-
 	while (n--) {
-		writeb(c, d);
-		d++;
+		writeb(c, dst);
+		dst++;
 	}
 }
 
-static inline void _memcpy_fromio(void *dst, const volatile void __iomem *src,
+static inline void _memcpy_fromio(void *dst, const void __iomem *src,
                                   __kernel_size_t n)
 {
 	char *d = dst;
@@ -39,16 +36,15 @@ static inline void _memcpy_fromio(void *dst, const volatile void __iomem *src,
 	}
 }
 
-static inline void _memcpy_toio(volatile void __iomem *dst, const void *src,
+static inline void _memcpy_toio(void __iomem *dst, const void *src,
                                 __kernel_size_t n)
 {
 	const char *s = src;
-	volatile void __iomem *d = dst;
 
 	while (n--) {
 		char tmp = *s++;
-		writeb(tmp, d);
-		d++;
+		writeb(tmp, dst);
+		dst++;
 	}
 }
 
-- 
2.0.4

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@arm.linux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org,
	linux-s390@vger.kernel.org, sparclinux@vger.kernel.org,
	x86@kernel.org, linux-serial@vger.kernel.org,
	linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v4 3/8] sparc: Remove unnecessary volatile usage
Date: Wed, 13 Aug 2014 12:28:53 +0200	[thread overview]
Message-ID: <1407925738-26170-4-git-send-email-thierry.reding@gmail.com> (raw)
Message-ID: <20140813102853.I1lkA-1IGh7oxFhfK9o4Ek2C0b-UvQqlWxcEbvyxWdc@z> (raw)
In-Reply-To: <1407925738-26170-1-git-send-email-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

The volatile keyword is only necessary in accessors that immediately
perform memory accesses. Wrappers around such accessors, such as the
_memset_io() and _memcpy_{to,from}io() functions don't need them.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v4:
- new patch

 arch/sparc/include/asm/io_32.h | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index 9f532902627c..49267f2575d7 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -16,18 +16,15 @@
 
 #include <asm-generic/io.h>
 
-static inline void _memset_io(volatile void __iomem *dst,
-                              int c, __kernel_size_t n)
+static inline void _memset_io(void __iomem *dst, int c, __kernel_size_t n)
 {
-	volatile void __iomem *d = dst;
-
 	while (n--) {
-		writeb(c, d);
-		d++;
+		writeb(c, dst);
+		dst++;
 	}
 }
 
-static inline void _memcpy_fromio(void *dst, const volatile void __iomem *src,
+static inline void _memcpy_fromio(void *dst, const void __iomem *src,
                                   __kernel_size_t n)
 {
 	char *d = dst;
@@ -39,16 +36,15 @@ static inline void _memcpy_fromio(void *dst, const volatile void __iomem *src,
 	}
 }
 
-static inline void _memcpy_toio(volatile void __iomem *dst, const void *src,
+static inline void _memcpy_toio(void __iomem *dst, const void *src,
                                 __kernel_size_t n)
 {
 	const char *s = src;
-	volatile void __iomem *d = dst;
 
 	while (n--) {
 		char tmp = *s++;
-		writeb(tmp, d);
-		d++;
+		writeb(tmp, dst);
+		dst++;
 	}
 }
 
-- 
2.0.4


  parent reply	other threads:[~2014-08-13 10:28 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 10:28 [PATCH v4 0/8] asm-generic/io.h overhaul Thierry Reding
2014-08-13 10:28 ` [PATCH v4 1/8] ARC: Remove redundant PCI_IOBASE declaration Thierry Reding
2014-08-13 10:28   ` Thierry Reding
2014-08-13 10:28 ` [PATCH v4 2/8] serial: sunzilog: Remove unnecessary volatile keyword Thierry Reding
2014-08-13 10:28   ` Thierry Reding
2014-08-13 10:28 ` Thierry Reding [this message]
2014-08-13 10:28   ` [PATCH v4 3/8] sparc: Remove unnecessary volatile usage Thierry Reding
2014-08-13 10:28 ` [PATCH v4 4/8] [IA64] Change xlate_dev_{kmem,mem}_ptr() prototypes Thierry Reding
2014-08-13 10:28   ` Thierry Reding
2014-08-13 10:28 ` [PATCH v4 5/8] /dev/mem: Use more consistent data types Thierry Reding
2014-08-13 10:28   ` Thierry Reding
2014-08-13 10:28 ` [PATCH v4 6/8] asm-generic/io.h: Implement generic {read,write}s*() Thierry Reding
2014-08-13 10:28   ` Thierry Reding
2014-09-29  8:54   ` Geert Uytterhoeven
2014-09-29  8:54     ` Geert Uytterhoeven
2014-09-29  8:59     ` Thierry Reding
2014-09-29  8:59       ` Thierry Reding
2014-09-30 10:22       ` Max Filippov
2014-09-30 10:22         ` Max Filippov
2014-09-30 10:26         ` Max Filippov
2014-09-30 10:26           ` Max Filippov
2014-09-30 10:39           ` [PATCH v4 6/8] asm-generic/io.h: Implement generic {read, write}s*() Arnd Bergmann
2014-09-30 10:39             ` [PATCH v4 6/8] asm-generic/io.h: Implement generic {read,write}s*() Arnd Bergmann
2014-09-30 10:51             ` Thierry Reding
2014-09-30 10:51               ` Thierry Reding
2014-08-13 10:28 ` [PATCH v4 7/8] ARM: Use include/asm-generic/io.h Thierry Reding
2014-08-13 10:28   ` Thierry Reding
2014-08-13 10:28 ` [PATCH v4 8/8] arm64: " Thierry Reding
2014-08-13 10:28   ` Thierry Reding
2014-08-25 11:26 ` [PATCH v4 0/8] asm-generic/io.h overhaul Thierry Reding
2014-09-24  6:04   ` Thierry Reding
2014-09-24  6:04     ` Thierry Reding
2014-09-25 14:56     ` Arnd Bergmann
2014-09-25 14:56       ` Arnd Bergmann
2014-08-25 11:53 ` Richard Weinberger
2014-08-25 12:27   ` Thierry Reding
2014-08-25 12:27     ` Thierry Reding
2014-08-25 12:52     ` Richard Weinberger
2014-08-25 12:52       ` Richard Weinberger
2014-08-25 13:37       ` Thierry Reding
2014-08-25 13:37         ` Thierry Reding

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=1407925738-26170-4-git-send-email-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=sam@ravnborg.org \
    --cc=sboyd@codeaurora.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=x86@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;
as well as URLs for NNTP newsgroup(s).