[PATCH 3/3] pmfs: Remove ioremap-related sparse warnings

Matthew Wilcox matthew.r.wilcox at intel.com
Thu Nov 7 17:03:12 EST 2013


ioremap returns an __iomem pointer which should not normally be directly
dereferenced.  The pmfs filesystem wants a pointer that can be directly
dereferenced; the use of ioremap to obtain that pointer is a temporary
implementation artefact which will eventually go away.  Disable the sparse
warnings by inserting the __force casts at the minimum number of places.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox at intel.com>
---
 fs/pmfs/super.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/pmfs/super.c b/fs/pmfs/super.c
index 4bf6874..37c944b 100644
--- a/fs/pmfs/super.c
+++ b/fs/pmfs/super.c
@@ -92,7 +92,7 @@ static inline int pmfs_has_huge_ioremap(struct super_block *sb)
 
 void *pmfs_ioremap(struct super_block *sb, phys_addr_t phys_addr, ssize_t size)
 {
-	void *retval;
+	void __iomem *retval;
 	int protect, hugeioremap;
 
 	if (sb) {
@@ -109,7 +109,8 @@ void *pmfs_ioremap(struct super_block *sb, phys_addr_t phys_addr, ssize_t size)
 	 * restriction depends on STRICT_DEVMEM option. If this option is
 	 * disabled or not available we mark the region only as busy.
 	 */
-	retval = request_mem_region_exclusive(phys_addr, size, "pmfs");
+	retval = (void __iomem *)
+			request_mem_region_exclusive(phys_addr, size, "pmfs");
 	if (!retval)
 		goto fail;
 
@@ -126,12 +127,12 @@ void *pmfs_ioremap(struct super_block *sb, phys_addr_t phys_addr, ssize_t size)
 	}
 
 fail:
-	return retval;
+	return (void __force *)retval;
 }
 
 static inline int pmfs_iounmap(void *virt_addr, ssize_t size, int protected)
 {
-	iounmap(virt_addr);
+	iounmap((void __iomem __force *)virt_addr);
 	return 0;
 }
 
-- 
1.8.4.rc3




More information about the Linux-pmfs mailing list