linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: Palmer Dabbelt <palmer@sifive.com>
Cc: Albert Ou <albert@sifive.com>,
	patches@groups.riscv.org, linux-kernel@vger.kernel.org,
	Olof Johansson <olof@lixom.net>
Subject: [PATCH 03/10] RISC-V: io.h: type fixes for warnings
Date: Wed, 29 Nov 2017 17:55:14 -0800	[thread overview]
Message-ID: <20171130015521.1289-4-olof@lixom.net> (raw)
In-Reply-To: <20171130015521.1289-1-olof@lixom.net>

include <linux/types.h> for __iomem definition. Also, add volatile to
iounmap() like other architectures have it to avoid "discarding
volatile" warnings from some drivers.

Finally, explicitly promote the base address for INB/OUTB functions to
avoid some old legacy drivers complaining about int-to-ptr promotions.
The drivers are unlikely to work but they're included in allmodconfig
so the warnings are noisy.

Fixes, among other warnings, these with allmodconfig:

../arch/riscv/include/asm/io.h:24:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
 extern void __iomem *ioremap(phys_addr_t offset, unsigned long size);

sound/pci/echoaudio/echoaudio.c: In function 'snd_echo_free':
sound/pci/echoaudio/echoaudio.c:1879:10: warning: passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]

Signed-off-by: Olof Johansson <olof@lixom.net>
---
 arch/riscv/include/asm/io.h | 16 +++++++++-------
 arch/riscv/mm/ioremap.c     |  2 +-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h
index c1f32cf..2a5c7c3 100644
--- a/arch/riscv/include/asm/io.h
+++ b/arch/riscv/include/asm/io.h
@@ -19,6 +19,8 @@
 #ifndef _ASM_RISCV_IO_H
 #define _ASM_RISCV_IO_H
 
+#include <linux/types.h>
+
 #ifdef CONFIG_MMU
 
 extern void __iomem *ioremap(phys_addr_t offset, unsigned long size);
@@ -32,7 +34,7 @@ extern void __iomem *ioremap(phys_addr_t offset, unsigned long size);
 #define ioremap_wc(addr, size) ioremap((addr), (size))
 #define ioremap_wt(addr, size) ioremap((addr), (size))
 
-extern void iounmap(void __iomem *addr);
+extern void iounmap(volatile void __iomem *addr);
 
 #endif /* CONFIG_MMU */
 
@@ -266,9 +268,9 @@ __io_reads_ins(reads, u32, l, __io_br(), __io_ar())
 __io_reads_ins(ins,  u8, b, __io_pbr(), __io_par())
 __io_reads_ins(ins, u16, w, __io_pbr(), __io_par())
 __io_reads_ins(ins, u32, l, __io_pbr(), __io_par())
-#define insb(addr, buffer, count) __insb((void __iomem *)addr, buffer, count)
-#define insw(addr, buffer, count) __insw((void __iomem *)addr, buffer, count)
-#define insl(addr, buffer, count) __insl((void __iomem *)addr, buffer, count)
+#define insb(addr, buffer, count) __insb((void __iomem *)(long)addr, buffer, count)
+#define insw(addr, buffer, count) __insw((void __iomem *)(long)addr, buffer, count)
+#define insl(addr, buffer, count) __insl((void __iomem *)(long)addr, buffer, count)
 
 __io_writes_outs(writes,  u8, b, __io_bw(), __io_aw())
 __io_writes_outs(writes, u16, w, __io_bw(), __io_aw())
@@ -280,9 +282,9 @@ __io_writes_outs(writes, u32, l, __io_bw(), __io_aw())
 __io_writes_outs(outs,  u8, b, __io_pbw(), __io_paw())
 __io_writes_outs(outs, u16, w, __io_pbw(), __io_paw())
 __io_writes_outs(outs, u32, l, __io_pbw(), __io_paw())
-#define outsb(addr, buffer, count) __outsb((void __iomem *)addr, buffer, count)
-#define outsw(addr, buffer, count) __outsw((void __iomem *)addr, buffer, count)
-#define outsl(addr, buffer, count) __outsl((void __iomem *)addr, buffer, count)
+#define outsb(addr, buffer, count) __outsb((void __iomem *)(long)addr, buffer, count)
+#define outsw(addr, buffer, count) __outsw((void __iomem *)(long)addr, buffer, count)
+#define outsl(addr, buffer, count) __outsl((void __iomem *)(long)addr, buffer, count)
 
 #ifdef CONFIG_64BIT
 __io_reads_ins(reads, u64, q, __io_br(), __io_ar())
diff --git a/arch/riscv/mm/ioremap.c b/arch/riscv/mm/ioremap.c
index e99194a4..70ef272 100644
--- a/arch/riscv/mm/ioremap.c
+++ b/arch/riscv/mm/ioremap.c
@@ -85,7 +85,7 @@ EXPORT_SYMBOL(ioremap);
  *
  * Caller must ensure there is only one unmapping for the same pointer.
  */
-void iounmap(void __iomem *addr)
+void iounmap(volatile void __iomem *addr)
 {
 	vunmap((void *)((unsigned long)addr & PAGE_MASK));
 }
-- 
2.8.6

  parent reply	other threads:[~2017-11-30  1:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30  1:55 [PATCH 00/10] RISC-V: Fixes for clean allmodconfig build Olof Johansson
2017-11-30  1:55 ` [PATCH 01/10] RISC-V: use generic serial.h Olof Johansson
2017-11-30  1:55 ` [PATCH 02/10] RISC-V: use RISCV_{INT,SHORT} instead of {INT,SHORT} for asm macros Olof Johansson
2017-11-30  1:55 ` Olof Johansson [this message]
2017-11-30  1:55 ` [PATCH 04/10] RISC-V: move empty_zero_page definition to C and export it Olof Johansson
2017-11-30  1:55 ` [PATCH 05/10] RISC-V: Export some expected symbols for modules Olof Johansson
2017-11-30  1:55 ` [PATCH 06/10] RISC-V: Provide stub of setup_profiling_timer() Olof Johansson
2017-11-30 18:26   ` [patches] " Palmer Dabbelt
2017-11-30  1:55 ` [PATCH 07/10] RISC-V: Use define for get_cycles like other architectures Olof Johansson
2017-11-30  1:55 ` [PATCH 08/10] RISC-V: Set __ARCH_WANT_RENAMEAT to pick up generic version Olof Johansson
2017-11-30 18:30   ` Christoph Hellwig
2017-11-30 18:38     ` [patches] " Palmer Dabbelt
2017-11-30 20:21       ` Olof Johansson
2017-12-01 18:27       ` Christoph Hellwig
2017-11-30  1:55 ` [PATCH 09/10] RISC-V: Add missing include Olof Johansson
2017-11-30  1:55 ` [PATCH 10/10] input: joystick: riscv has get_cycles Olof Johansson
2017-11-30  6:48   ` Dmitry Torokhov
2017-11-30 18:26 ` [patches] [PATCH 00/10] RISC-V: Fixes for clean allmodconfig build Palmer Dabbelt

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=20171130015521.1289-4-olof@lixom.net \
    --to=olof@lixom.net \
    --cc=albert@sifive.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=palmer@sifive.com \
    --cc=patches@groups.riscv.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).