Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

CRIS: Avoid compilation warning for puts

Rename to aputs.
Also, simplify code by moving some common code out to macros.

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>

+25 -40
+25 -40
arch/cris/boot/compressed/misc.c
··· 106 106 107 107 static void flush_window(void); 108 108 static void error(char *m); 109 - static void puts(const char *); 109 + static void aputs(const char *s); 110 110 111 111 extern char *input_data; /* lives in head.S */ 112 112 ··· 137 137 138 138 REG_WR(ser, regi_ser, rw_dout, dout); 139 139 } 140 + #define SEROUT(S, N) \ 141 + do { \ 142 + serout(S, regi_ser ## N); \ 143 + s++; \ 144 + } while (0) 145 + #else 146 + #define SEROUT(S, N) do { \ 147 + while (!(*R_SERIAL ## N ## _STATUS & (1 << 5))) \ 148 + ; \ 149 + *R_SERIAL ## N ## _TR_DATA = *s++; \ 150 + } while (0) 140 151 #endif 141 152 142 - static void puts(const char *s) 153 + static void aputs(const char *s) 143 154 { 144 155 #ifndef CONFIG_ETRAX_DEBUG_PORT_NULL 145 156 while (*s) { 146 157 #ifdef CONFIG_ETRAX_DEBUG_PORT0 147 - #ifdef CONFIG_ETRAX_ARCH_V32 148 - serout(s, regi_ser0); 149 - #else 150 - while (!(*R_SERIAL0_STATUS & (1 << 5))) 151 - ; 152 - *R_SERIAL0_TR_DATA = *s++; 153 - #endif 158 + SEROUT(s, 0); 154 159 #endif 155 160 #ifdef CONFIG_ETRAX_DEBUG_PORT1 156 - #ifdef CONFIG_ETRAX_ARCH_V32 157 - serout(s, regi_ser1); 158 - #else 159 - while (!(*R_SERIAL1_STATUS & (1 << 5))) 160 - ; 161 - *R_SERIAL1_TR_DATA = *s++; 162 - #endif 161 + SEROUT(s, 1); 163 162 #endif 164 163 #ifdef CONFIG_ETRAX_DEBUG_PORT2 165 - #ifdef CONFIG_ETRAX_ARCH_V32 166 - serout(s, regi_ser2); 167 - #else 168 - while (!(*R_SERIAL2_STATUS & (1 << 5))) 169 - ; 170 - *R_SERIAL2_TR_DATA = *s++; 171 - #endif 164 + SEROUT(s, 2); 172 165 #endif 173 166 #ifdef CONFIG_ETRAX_DEBUG_PORT3 174 - #ifdef CONFIG_ETRAX_ARCH_V32 175 - serout(s, regi_ser3); 176 - #else 177 - while (!(*R_SERIAL3_STATUS & (1 << 5))) 178 - ; 179 - *R_SERIAL3_TR_DATA = *s++; 167 + SEROUT(s, 3); 180 168 #endif 181 - #endif 182 - *s++; 183 169 } 184 - /* CONFIG_ETRAX_DEBUG_PORT_NULL */ 185 - #endif 170 + #endif /* CONFIG_ETRAX_DEBUG_PORT_NULL */ 186 171 } 187 172 188 173 void *memset(void *s, int c, size_t n) ··· 218 233 219 234 static void error(char *x) 220 235 { 221 - puts("\n\n"); 222 - puts(x); 223 - puts("\n\n -- System halted\n"); 236 + aputs("\n\n"); 237 + aputs(x); 238 + aputs("\n\n -- System halted\n"); 224 239 225 240 while(1); /* Halt */ 226 241 } ··· 363 378 __asm__ volatile ("move $vr,%0" : "=rm" (revision)); 364 379 if (revision < compile_rev) { 365 380 #ifdef CONFIG_ETRAX_ARCH_V32 366 - puts("You need an ETRAX FS to run Linux 2.6/crisv32\n"); 381 + aputs("You need at least ETRAX FS to run Linux 2.6/crisv32\n"); 367 382 #else 368 - puts("You need an ETRAX 100LX to run linux 2.6\n"); 383 + aputs("You need an ETRAX 100LX to run linux 2.6/crisv10\n"); 369 384 #endif 370 385 while(1); 371 386 } 372 387 373 - puts("Uncompressing Linux...\n"); 388 + aputs("Uncompressing Linux...\n"); 374 389 gunzip(); 375 - puts("Done. Now booting the kernel\n"); 390 + aputs("Done. Now booting the kernel\n"); 376 391 }