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

mips: unify prom_putchar() declarations

prom_putchar() is used centrally in early printk infrastructure therefore
at least MIPS should agree on the function return type.

[paul.burton@mips.com:
- Include linux/types.h in asm/setup.h to gain the bool typedef before
we start include asm/setup.h elsewhere.
- Include asm/setup.h in all files that use or define prom_putchar().
- Also standardise on signed rather than unsigned char argument.]

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/19842/
Cc: linux-mips@linux-mips.org
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: Jonas Gorski <jonas.gorski@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>

authored by

Alexander Sverdlin and committed by
Paul Burton
5c93316c 4936084c

+47 -32
+2 -1
arch/mips/alchemy/board-gpr.c
··· 34 34 #include <asm/bootinfo.h> 35 35 #include <asm/idle.h> 36 36 #include <asm/reboot.h> 37 + #include <asm/setup.h> 37 38 #include <asm/mach-au1x00/au1000.h> 38 39 #include <asm/mach-au1x00/gpio-au1000.h> 39 40 #include <prom.h> ··· 61 60 add_memory_region(0, memsize, BOOT_MEM_RAM); 62 61 } 63 62 64 - void prom_putchar(unsigned char c) 63 + void prom_putchar(char c) 65 64 { 66 65 alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); 67 66 }
+2 -1
arch/mips/alchemy/board-mtx1.c
··· 31 31 #include <mtd/mtd-abi.h> 32 32 #include <asm/bootinfo.h> 33 33 #include <asm/reboot.h> 34 + #include <asm/setup.h> 34 35 #include <asm/mach-au1x00/au1000.h> 35 36 #include <asm/mach-au1x00/gpio-au1000.h> 36 37 #include <asm/mach-au1x00/au1xxx_eth.h> ··· 59 58 add_memory_region(0, memsize, BOOT_MEM_RAM); 60 59 } 61 60 62 - void prom_putchar(unsigned char c) 61 + void prom_putchar(char c) 63 62 { 64 63 alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); 65 64 }
+2 -1
arch/mips/alchemy/board-xxs1500.c
··· 29 29 #include <linux/pm.h> 30 30 #include <asm/bootinfo.h> 31 31 #include <asm/reboot.h> 32 + #include <asm/setup.h> 32 33 #include <asm/mach-au1x00/au1000.h> 33 34 #include <prom.h> 34 35 ··· 56 55 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 56 } 58 57 59 - void prom_putchar(unsigned char c) 58 + void prom_putchar(char c) 60 59 { 61 60 alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); 62 61 }
+2 -1
arch/mips/alchemy/devboards/platform.c
··· 14 14 #include <asm/bootinfo.h> 15 15 #include <asm/idle.h> 16 16 #include <asm/reboot.h> 17 + #include <asm/setup.h> 17 18 #include <asm/mach-au1x00/au1000.h> 18 19 #include <asm/mach-db1x00/bcsr.h> 19 20 ··· 37 36 add_memory_region(0, memsize, BOOT_MEM_RAM); 38 37 } 39 38 40 - void prom_putchar(unsigned char c) 39 + void prom_putchar(char c) 41 40 { 42 41 if (alchemy_get_cputype() == ALCHEMY_CPU_AU1300) 43 42 alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c);
+2 -2
arch/mips/ar7/prom.c
··· 25 25 #include <linux/string.h> 26 26 #include <linux/io.h> 27 27 #include <asm/bootinfo.h> 28 + #include <asm/setup.h> 28 29 29 30 #include <asm/mach-ar7/ar7.h> 30 31 #include <asm/mach-ar7/prom.h> ··· 260 259 writel(value, (void *)PORT(offset)); 261 260 } 262 261 263 - int prom_putchar(char c) 262 + void prom_putchar(char c) 264 263 { 265 264 while ((serial_in(UART_LSR) & UART_LSR_TEMT) == 0) 266 265 ; 267 266 serial_out(UART_TX, c); 268 - return 1; 269 267 }
+3 -2
arch/mips/ath25/early_printk.c
··· 9 9 #include <linux/mm.h> 10 10 #include <linux/io.h> 11 11 #include <linux/serial_reg.h> 12 + #include <asm/setup.h> 12 13 13 14 #include "devices.h" 14 15 #include "ar2315_regs.h" ··· 26 25 return __raw_readl(base + 4 * reg); 27 26 } 28 27 29 - void prom_putchar(unsigned char ch) 28 + void prom_putchar(char ch) 30 29 { 31 30 static void __iomem *base; 32 31 ··· 39 38 40 39 while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0) 41 40 ; 42 - prom_uart_wr(base, UART_TX, ch); 41 + prom_uart_wr(base, UART_TX, (unsigned char)ch); 43 42 while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0) 44 43 ; 45 44 }
+9 -7
arch/mips/ath79/early_printk.c
··· 13 13 #include <linux/errno.h> 14 14 #include <linux/serial_reg.h> 15 15 #include <asm/addrspace.h> 16 + #include <asm/setup.h> 16 17 17 18 #include <asm/mach-ath79/ath79.h> 18 19 #include <asm/mach-ath79/ar71xx_regs.h> 19 20 #include <asm/mach-ath79/ar933x_uart.h> 20 21 21 - static void (*_prom_putchar) (unsigned char); 22 + static void (*_prom_putchar)(char); 22 23 23 24 static inline void prom_putchar_wait(void __iomem *reg, u32 mask, u32 val) 24 25 { ··· 34 33 35 34 #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) 36 35 37 - static void prom_putchar_ar71xx(unsigned char ch) 36 + static void prom_putchar_ar71xx(char ch) 38 37 { 39 38 void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE)); 40 39 41 40 prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY); 42 - __raw_writel(ch, base + UART_TX * 4); 41 + __raw_writel((unsigned char)ch, base + UART_TX * 4); 43 42 prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY); 44 43 } 45 44 46 - static void prom_putchar_ar933x(unsigned char ch) 45 + static void prom_putchar_ar933x(char ch) 47 46 { 48 47 void __iomem *base = (void __iomem *)(KSEG1ADDR(AR933X_UART_BASE)); 49 48 50 49 prom_putchar_wait(base + AR933X_UART_DATA_REG, AR933X_UART_DATA_TX_CSR, 51 50 AR933X_UART_DATA_TX_CSR); 52 - __raw_writel(AR933X_UART_DATA_TX_CSR | ch, base + AR933X_UART_DATA_REG); 51 + __raw_writel(AR933X_UART_DATA_TX_CSR | (unsigned char)ch, 52 + base + AR933X_UART_DATA_REG); 53 53 prom_putchar_wait(base + AR933X_UART_DATA_REG, AR933X_UART_DATA_TX_CSR, 54 54 AR933X_UART_DATA_TX_CSR); 55 55 } 56 56 57 - static void prom_putchar_dummy(unsigned char ch) 57 + static void prom_putchar_dummy(char ch) 58 58 { 59 59 /* nothing to do */ 60 60 } ··· 94 92 } 95 93 } 96 94 97 - void prom_putchar(unsigned char ch) 95 + void prom_putchar(char ch) 98 96 { 99 97 if (!_prom_putchar) 100 98 prom_putchar_init();
+1
arch/mips/bcm63xx/early_printk.c
··· 8 8 9 9 #include <bcm63xx_io.h> 10 10 #include <linux/serial_bcm63xx.h> 11 + #include <asm/setup.h> 11 12 12 13 static void wait_xfered(void) 13 14 {
+1 -2
arch/mips/boot/compressed/uart-prom.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - 3 - extern void prom_putchar(unsigned char ch); 2 + #include <asm/setup.h> 4 3 5 4 void putc(char c) 6 5 {
+2 -2
arch/mips/cavium-octeon/setup.c
··· 36 36 #include <asm/mipsregs.h> 37 37 #include <asm/bootinfo.h> 38 38 #include <asm/sections.h> 39 + #include <asm/setup.h> 39 40 #include <asm/time.h> 40 41 41 42 #include <asm/octeon/octeon.h> ··· 1109 1108 * Emit one character to the boot UART. Exported for use by the 1110 1109 * watchdog timer. 1111 1110 */ 1112 - int prom_putchar(char c) 1111 + void prom_putchar(char c) 1113 1112 { 1114 1113 uint64_t lsrval; 1115 1114 ··· 1120 1119 1121 1120 /* Write the byte */ 1122 1121 cvmx_write_csr(CVMX_MIO_UARTX_THR(octeon_uart), c & 0xffull); 1123 - return 1; 1124 1122 } 1125 1123 EXPORT_SYMBOL(prom_putchar); 1126 1124
+1
arch/mips/fw/arc/arc_con.c
··· 12 12 #include <linux/init.h> 13 13 #include <linux/console.h> 14 14 #include <linux/fs.h> 15 + #include <asm/setup.h> 15 16 #include <asm/sgialib.h> 16 17 17 18 static void prom_console_write(struct console *co, const char *s,
+1
arch/mips/fw/arc/promlib.c
··· 9 9 #include <linux/kernel.h> 10 10 #include <asm/sgialib.h> 11 11 #include <asm/bcache.h> 12 + #include <asm/setup.h> 12 13 13 14 /* 14 15 * IP22 boardcache is not compatible with board caches. Thus we disable it
+1
arch/mips/fw/sni/sniprom.c
··· 19 19 #include <asm/mipsprom.h> 20 20 #include <asm/mipsregs.h> 21 21 #include <asm/bootinfo.h> 22 + #include <asm/setup.h> 22 23 23 24 /* special SNI prom calls */ 24 25 /*
+2
arch/mips/include/asm/setup.h
··· 2 2 #ifndef _MIPS_SETUP_H 3 3 #define _MIPS_SETUP_H 4 4 5 + #include <linux/types.h> 5 6 #include <uapi/asm/setup.h> 6 7 8 + extern void prom_putchar(char); 7 9 extern void setup_early_printk(void); 8 10 9 11 #ifdef CONFIG_EARLY_PRINTK_8250
-1
arch/mips/include/asm/sgialib.h
··· 31 31 #define PROM_FLAG_DONT_FREE_TEMP 4 32 32 33 33 /* Simple char-by-char console I/O. */ 34 - extern void prom_putchar(char c); 35 34 extern char prom_getchar(void); 36 35 37 36 /* Get next memory descriptor after CURR, returns first descriptor
-1
arch/mips/include/asm/txx9/generic.h
··· 49 49 void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr); 50 50 void txx9_sio_init(unsigned long baseaddr, int irq, 51 51 unsigned int line, unsigned int sclk, int nocts); 52 - void prom_putchar(char c); 53 52 #ifdef CONFIG_EARLY_PRINTK 54 53 extern void (*txx9_prom_putchar)(char c); 55 54 void txx9_sio_putchar_init(unsigned long baseaddr);
-2
arch/mips/kernel/early_printk.c
··· 14 14 15 15 #include <asm/setup.h> 16 16 17 - extern void prom_putchar(char); 18 - 19 17 static void early_console_write(struct console *con, const char *s, unsigned n) 20 18 { 21 19 while (n-- && *s) {
+1
arch/mips/kernel/early_printk_8250.c
··· 20 20 #include <linux/io.h> 21 21 #include <linux/serial_core.h> 22 22 #include <linux/serial_reg.h> 23 + #include <asm/setup.h> 23 24 24 25 static void __iomem *serial8250_base; 25 26 static unsigned int serial8250_reg_shift;
+1
arch/mips/lantiq/early_printk.c
··· 8 8 9 9 #include <linux/cpu.h> 10 10 #include <lantiq_soc.h> 11 + #include <asm/setup.h> 11 12 12 13 #define ASC_BUF 1024 13 14 #define LTQ_ASC_FSTAT ((u32 *)(LTQ_EARLY_ASC + 0x0048))
+1
arch/mips/lasat/prom.c
··· 13 13 #include <asm/bootinfo.h> 14 14 #include <asm/lasat/lasat.h> 15 15 #include <asm/cpu.h> 16 + #include <asm/setup.h> 16 17 17 18 #include "at93c.h" 18 19 #include <asm/lasat/eeprom.h>
+1
arch/mips/loongson64/common/early_printk.c
··· 10 10 * option) any later version. 11 11 */ 12 12 #include <linux/serial_reg.h> 13 + #include <asm/setup.h> 13 14 14 15 #include <loongson.h> 15 16
+1
arch/mips/netlogic/common/earlycons.c
··· 36 36 #include <linux/serial_reg.h> 37 37 38 38 #include <asm/mipsregs.h> 39 + #include <asm/setup.h> 39 40 #include <asm/netlogic/haldefs.h> 40 41 #include <asm/netlogic/common.h> 41 42
+2 -3
arch/mips/paravirt/serial.c
··· 9 9 #include <linux/kernel.h> 10 10 #include <linux/virtio_console.h> 11 11 #include <linux/kvm_para.h> 12 + #include <asm/setup.h> 12 13 13 14 /* 14 15 * Emit one character to the boot console. 15 16 */ 16 - int prom_putchar(char c) 17 + void prom_putchar(char c) 17 18 { 18 19 kvm_hypercall3(KVM_HC_MIPS_CONSOLE_OUTPUT, 0 /* port 0 */, 19 20 (unsigned long)&c, 1 /* len == 1 */); 20 - 21 - return 1; 22 21 } 23 22 24 23 #ifdef CONFIG_VIRTIO_CONSOLE
+2 -3
arch/mips/pic32/pic32mzda/early_console.c
··· 13 13 */ 14 14 #include <asm/mach-pic32/pic32.h> 15 15 #include <asm/fw/fw.h> 16 + #include <asm/setup.h> 16 17 17 18 #include "pic32mzda.h" 18 19 #include "early_pin.h" ··· 158 157 setup_early_console(port, baud); 159 158 } 160 159 161 - int prom_putchar(char c) 160 + void prom_putchar(char c) 162 161 { 163 162 if (console_port >= 0) { 164 163 while (__raw_readl( ··· 167 166 168 167 __raw_writel(c, uart_base + U_TXR(console_port)); 169 168 } 170 - 171 - return 1; 172 169 }
+4 -3
arch/mips/ralink/early_printk.c
··· 10 10 #include <linux/serial_reg.h> 11 11 12 12 #include <asm/addrspace.h> 13 + #include <asm/setup.h> 13 14 14 15 #ifdef CONFIG_SOC_RT288X 15 16 #define EARLY_UART_BASE 0x300c00 ··· 69 68 } 70 69 } 71 70 72 - void prom_putchar(unsigned char ch) 71 + void prom_putchar(char ch) 73 72 { 74 73 if (!init_complete) { 75 74 find_uart_base(); ··· 77 76 } 78 77 79 78 if (IS_ENABLED(CONFIG_SOC_MT7621) || soc_is_mt7628()) { 80 - uart_w32(ch, UART_TX); 79 + uart_w32((unsigned char)ch, UART_TX); 81 80 while ((uart_r32(UART_REG_LSR) & UART_LSR_THRE) == 0) 82 81 ; 83 82 } else { 84 83 while ((uart_r32(UART_REG_LSR_RT2880) & UART_LSR_THRE) == 0) 85 84 ; 86 - uart_w32(ch, UART_REG_TX); 85 + uart_w32((unsigned char)ch, UART_REG_TX); 87 86 while ((uart_r32(UART_REG_LSR_RT2880) & UART_LSR_THRE) == 0) 88 87 ; 89 88 }
+1
arch/mips/sgi-ip27/ip27-console.c
··· 7 7 */ 8 8 9 9 #include <asm/page.h> 10 + #include <asm/setup.h> 10 11 #include <asm/sn/addrs.h> 11 12 #include <asm/sn/sn0/hub.h> 12 13 #include <asm/sn/klconfig.h>
+1
arch/mips/sibyte/common/cfe.c
··· 27 27 28 28 #include <asm/bootinfo.h> 29 29 #include <asm/reboot.h> 30 + #include <asm/setup.h> 30 31 #include <asm/sibyte/board.h> 31 32 #include <asm/smp-ops.h> 32 33
+1
arch/mips/txx9/generic/setup.c
··· 32 32 #include <asm/reboot.h> 33 33 #include <asm/r4kcache.h> 34 34 #include <asm/sections.h> 35 + #include <asm/setup.h> 35 36 #include <asm/txx9/generic.h> 36 37 #include <asm/txx9/pci.h> 37 38 #include <asm/txx9tmr.h>