Browse Source

s390/mm: fix compile for PAGE_DEFAULT_KEY != 0

The usual problem for code that is ifdef'ed out is that it doesn't
compile after a while. That's also the case for the storage key
initialisation code, if it would be used (set PAGE_DEFAULT_KEY to
something not zero):

./arch/s390/include/asm/page.h: In function 'storage_key_init_range':
./arch/s390/include/asm/page.h:36:2: error: implicit declaration of function '__storage_key_init_range'

Since the code itself has been useful for debugging purposes several
times, remove the ifdefs and make sure the code gets compiler
coverage. The cost for this is eight bytes.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Heiko Carstens 9 years ago
parent
commit
de3fa841e4
2 changed files with 6 additions and 5 deletions
  1. 4 3
      arch/s390/include/asm/page.h
  2. 2 2
      arch/s390/mm/pageattr.c

+ 4 - 3
arch/s390/include/asm/page.h

@@ -30,11 +30,12 @@
 #include <asm/setup.h>
 #include <asm/setup.h>
 #ifndef __ASSEMBLY__
 #ifndef __ASSEMBLY__
 
 
+void __storage_key_init_range(unsigned long start, unsigned long end);
+
 static inline void storage_key_init_range(unsigned long start, unsigned long end)
 static inline void storage_key_init_range(unsigned long start, unsigned long end)
 {
 {
-#if PAGE_DEFAULT_KEY
-	__storage_key_init_range(start, end);
-#endif
+	if (PAGE_DEFAULT_KEY)
+		__storage_key_init_range(start, end);
 }
 }
 
 
 #define clear_page(page)	memset((page), 0, PAGE_SIZE)
 #define clear_page(page)	memset((page), 0, PAGE_SIZE)

+ 2 - 2
arch/s390/mm/pageattr.c

@@ -10,7 +10,6 @@
 #include <asm/pgtable.h>
 #include <asm/pgtable.h>
 #include <asm/page.h>
 #include <asm/page.h>
 
 
-#if PAGE_DEFAULT_KEY
 static inline unsigned long sske_frame(unsigned long addr, unsigned char skey)
 static inline unsigned long sske_frame(unsigned long addr, unsigned char skey)
 {
 {
 	asm volatile(".insn rrf,0xb22b0000,%[skey],%[addr],9,0"
 	asm volatile(".insn rrf,0xb22b0000,%[skey],%[addr],9,0"
@@ -22,6 +21,8 @@ void __storage_key_init_range(unsigned long start, unsigned long end)
 {
 {
 	unsigned long boundary, size;
 	unsigned long boundary, size;
 
 
+	if (!PAGE_DEFAULT_KEY)
+		return;
 	while (start < end) {
 	while (start < end) {
 		if (MACHINE_HAS_EDAT1) {
 		if (MACHINE_HAS_EDAT1) {
 			/* set storage keys for a 1MB frame */
 			/* set storage keys for a 1MB frame */
@@ -38,7 +39,6 @@ void __storage_key_init_range(unsigned long start, unsigned long end)
 		start += PAGE_SIZE;
 		start += PAGE_SIZE;
 	}
 	}
 }
 }
-#endif
 
 
 #ifdef CONFIG_PROC_FS
 #ifdef CONFIG_PROC_FS
 atomic_long_t direct_pages_count[PG_DIRECT_MAP_MAX];
 atomic_long_t direct_pages_count[PG_DIRECT_MAP_MAX];