From: Mark Salter <msalter@redhat.com>
To: x86@kernel.org
Cc: Dave Young <dyoung@redhat.com>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>, Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
patches@linaro.org, Mark Salter <msalter@redhat.com>
Subject: [PATCH v4 1/6] x86/mm: sparse warning fix for early_memremap
Date: Wed, 12 Feb 2014 15:56:10 -0500 [thread overview]
Message-ID: <1392238575-10000-2-git-send-email-msalter@redhat.com> (raw)
In-Reply-To: <1392238575-10000-1-git-send-email-msalter@redhat.com>
From: Dave Young <dyoung@redhat.com>
There's a lot of sparse warnings for code like below:
void *a = early_memremap(phys_addr, size);
early_memremap intend to map kernel memory with ioremap facility, the return
pointer should be a kernel ram pointer instead of iomem one.
For making the function clearer and supressing sparse warnings this patch
do below two things:
1. cast to (__force void *) for the return value of early_memremap
2. add early_memunmap function and pass (__force void __iomem *) to iounmap
>From Boris:
> Ingo told me yesterday, it makes sense too. I'd guess we can try it.
> FWIW, all callers of early_memremap use the memory they get remapped as
> normal memory so we should be safe.
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Mark Salter <msalter@redhat.com>
---
arch/x86/include/asm/io.h | 3 ++-
arch/x86/mm/ioremap.c | 10 +++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 34f69cb..1db414f 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -325,9 +325,10 @@ extern void early_ioremap_init(void);
extern void early_ioremap_reset(void);
extern void __iomem *early_ioremap(resource_size_t phys_addr,
unsigned long size);
-extern void __iomem *early_memremap(resource_size_t phys_addr,
+extern void *early_memremap(resource_size_t phys_addr,
unsigned long size);
extern void early_iounmap(void __iomem *addr, unsigned long size);
+extern void early_memunmap(void *addr, unsigned long size);
extern void fixup_early_ioremap(void);
extern bool is_early_ioremap_ptep(pte_t *ptep);
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 799580c..bbb4504 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -562,10 +562,9 @@ early_ioremap(resource_size_t phys_addr, unsigned long size)
}
/* Remap memory */
-void __init __iomem *
-early_memremap(resource_size_t phys_addr, unsigned long size)
+void __init *early_memremap(resource_size_t phys_addr, unsigned long size)
{
- return __early_ioremap(phys_addr, size, PAGE_KERNEL);
+ return (__force void *)__early_ioremap(phys_addr, size, PAGE_KERNEL);
}
void __init early_iounmap(void __iomem *addr, unsigned long size)
@@ -620,3 +619,8 @@ void __init early_iounmap(void __iomem *addr, unsigned long size)
}
prev_map[slot] = NULL;
}
+
+void __init early_memunmap(void *addr, unsigned long size)
+{
+ early_iounmap((__force void __iomem *)addr, size);
+}
--
1.8.5.3
next prev parent reply other threads:[~2014-02-12 20:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-12 20:56 [PATCH v4 0/6] generic early_ioremap support Mark Salter
2014-02-12 20:56 ` Mark Salter [this message]
2014-02-12 20:56 ` [PATCH v4 2/6] mm: create generic early_ioremap() support Mark Salter
2014-02-12 20:56 ` [PATCH v4 3/6] x86: use generic early_ioremap Mark Salter
2014-02-12 20:56 ` [PATCH v4 4/6] arm: add early_ioremap support Mark Salter
2014-02-26 5:48 ` Rob Herring
2014-02-26 9:38 ` Leif Lindholm
2014-02-26 14:59 ` Mark Salter
2014-02-26 15:56 ` Rob Herring
2014-02-12 20:56 ` [PATCH v4 5/6] arm64: initialize pgprot info earlier in boot Mark Salter
2014-02-12 20:56 ` [PATCH v4 6/6] arm64: add early_ioremap support Mark Salter
2014-02-25 14:10 ` [PATCH v4 0/6] generic " Mark Salter
2014-02-25 18:30 ` Will Deacon
2014-02-25 18:45 ` Mark Salter
2014-02-25 19:42 ` H. Peter Anvin
2014-02-25 23:04 ` Catalin Marinas
2014-02-25 23:05 ` H. Peter Anvin
2014-03-03 22:29 ` Mark Salter
2014-03-04 1:30 ` H. Peter Anvin
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=1392238575-10000-2-git-send-email-msalter@redhat.com \
--to=msalter@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=dyoung@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=patches@linaro.org \
--cc=tglx@linutronix.de \
--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