Skip to contentSkip to conversation

Check the argument of kunmap on architectures without highmem

PATCH New Matthew Wilcox 1 participant 1 message May 14, 2009 MM core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Check the argument of kunmap on architectures without highmem

If you're using a non-highmem architecture, passing an argument with the wrong type to kunmap() doesn't give you a warning because the ifdef doesn't check the type.

Using a static inline function solves the problem nicely.

include/linux/highmem.h +3 -1
index 1fcb712..211ff44 100644
@@ -55,7 +55,9 @@ static inline void *kmap(struct page *page)
 	return page_address(page);
 }
 
-#define kunmap(page) do { (void) (page); } while (0)
+static inline void kunmap(struct page *page)
+{
+}
 
 static inline void *kmap_atomic(struct page *page, enum km_type idx)
 {
Signature · 4 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."