Skip to content

Commit 76fdf67

Browse files
committed
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>
1 parent ac93f62 commit 76fdf67

1 file changed

Lines changed: 25 additions & 40 deletions

File tree

  • arch/cris/boot/compressed

‎arch/cris/boot/compressed/misc.c‎

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static unsigned outcnt = 0; /* bytes in output buffer */
106106

107107
static void flush_window(void);
108108
static void error(char *m);
109-
static void puts(const char *);
109+
static void aputs(const char *s);
110110

111111
extern char *input_data; /* lives in head.S */
112112

@@ -137,52 +137,37 @@ static inline void serout(const char *s, reg_scope_instances regi_ser)
137137

138138
REG_WR(ser, regi_ser, rw_dout, dout);
139139
}
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)
140151
#endif
141152

142-
static void puts(const char *s)
153+
static void aputs(const char *s)
143154
{
144155
#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
145156
while (*s) {
146157
#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);
154159
#endif
155160
#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);
163162
#endif
164163
#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);
172165
#endif
173166
#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);
180168
#endif
181-
#endif
182-
*s++;
183169
}
184-
/* CONFIG_ETRAX_DEBUG_PORT_NULL */
185-
#endif
170+
#endif /* CONFIG_ETRAX_DEBUG_PORT_NULL */
186171
}
187172

188173
void *memset(void *s, int c, size_t n)
@@ -233,9 +218,9 @@ static void flush_window(void)
233218

234219
static void error(char *x)
235220
{
236-
puts("\n\n");
237-
puts(x);
238-
puts("\n\n -- System halted\n");
221+
aputs("\n\n");
222+
aputs(x);
223+
aputs("\n\n -- System halted\n");
239224

240225
while(1); /* Halt */
241226
}
@@ -378,14 +363,14 @@ void decompress_kernel(void)
378363
__asm__ volatile ("move $vr,%0" : "=rm" (revision));
379364
if (revision < compile_rev) {
380365
#ifdef CONFIG_ETRAX_ARCH_V32
381-
puts("You need an ETRAX FS to run Linux 2.6/crisv32\n");
366+
aputs("You need at least ETRAX FS to run Linux 2.6/crisv32\n");
382367
#else
383-
puts("You need an ETRAX 100LX to run linux 2.6\n");
368+
aputs("You need an ETRAX 100LX to run linux 2.6/crisv10\n");
384369
#endif
385370
while(1);
386371
}
387372

388-
puts("Uncompressing Linux...\n");
373+
aputs("Uncompressing Linux...\n");
389374
gunzip();
390-
puts("Done. Now booting the kernel\n");
375+
aputs("Done. Now booting the kernel\n");
391376
}

0 commit comments

Comments
 (0)