Skip to content

Commit 5c93316

Browse files
asverdlinpaulburton
authored andcommitted
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>
1 parent 4936084 commit 5c93316

28 files changed

Lines changed: 47 additions & 32 deletions

File tree

‎arch/mips/alchemy/board-gpr.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <asm/bootinfo.h>
3535
#include <asm/idle.h>
3636
#include <asm/reboot.h>
37+
#include <asm/setup.h>
3738
#include <asm/mach-au1x00/au1000.h>
3839
#include <asm/mach-au1x00/gpio-au1000.h>
3940
#include <prom.h>
@@ -60,7 +61,7 @@ void __init prom_init(void)
6061
add_memory_region(0, memsize, BOOT_MEM_RAM);
6162
}
6263

63-
void prom_putchar(unsigned char c)
64+
void prom_putchar(char c)
6465
{
6566
alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
6667
}

‎arch/mips/alchemy/board-mtx1.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <mtd/mtd-abi.h>
3232
#include <asm/bootinfo.h>
3333
#include <asm/reboot.h>
34+
#include <asm/setup.h>
3435
#include <asm/mach-au1x00/au1000.h>
3536
#include <asm/mach-au1x00/gpio-au1000.h>
3637
#include <asm/mach-au1x00/au1xxx_eth.h>
@@ -58,7 +59,7 @@ void __init prom_init(void)
5859
add_memory_region(0, memsize, BOOT_MEM_RAM);
5960
}
6061

61-
void prom_putchar(unsigned char c)
62+
void prom_putchar(char c)
6263
{
6364
alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
6465
}

‎arch/mips/alchemy/board-xxs1500.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/pm.h>
3030
#include <asm/bootinfo.h>
3131
#include <asm/reboot.h>
32+
#include <asm/setup.h>
3233
#include <asm/mach-au1x00/au1000.h>
3334
#include <prom.h>
3435

@@ -55,7 +56,7 @@ void __init prom_init(void)
5556
add_memory_region(0, memsize, BOOT_MEM_RAM);
5657
}
5758

58-
void prom_putchar(unsigned char c)
59+
void prom_putchar(char c)
5960
{
6061
alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
6162
}

‎arch/mips/alchemy/devboards/platform.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <asm/bootinfo.h>
1515
#include <asm/idle.h>
1616
#include <asm/reboot.h>
17+
#include <asm/setup.h>
1718
#include <asm/mach-au1x00/au1000.h>
1819
#include <asm/mach-db1x00/bcsr.h>
1920

@@ -36,7 +37,7 @@ void __init prom_init(void)
3637
add_memory_region(0, memsize, BOOT_MEM_RAM);
3738
}
3839

39-
void prom_putchar(unsigned char c)
40+
void prom_putchar(char c)
4041
{
4142
if (alchemy_get_cputype() == ALCHEMY_CPU_AU1300)
4243
alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c);

‎arch/mips/ar7/prom.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/string.h>
2626
#include <linux/io.h>
2727
#include <asm/bootinfo.h>
28+
#include <asm/setup.h>
2829

2930
#include <asm/mach-ar7/ar7.h>
3031
#include <asm/mach-ar7/prom.h>
@@ -259,10 +260,9 @@ static inline void serial_out(int offset, int value)
259260
writel(value, (void *)PORT(offset));
260261
}
261262

262-
int prom_putchar(char c)
263+
void prom_putchar(char c)
263264
{
264265
while ((serial_in(UART_LSR) & UART_LSR_TEMT) == 0)
265266
;
266267
serial_out(UART_TX, c);
267-
return 1;
268268
}

‎arch/mips/ath25/early_printk.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/mm.h>
1010
#include <linux/io.h>
1111
#include <linux/serial_reg.h>
12+
#include <asm/setup.h>
1213

1314
#include "devices.h"
1415
#include "ar2315_regs.h"
@@ -25,7 +26,7 @@ static inline unsigned char prom_uart_rr(void __iomem *base, unsigned reg)
2526
return __raw_readl(base + 4 * reg);
2627
}
2728

28-
void prom_putchar(unsigned char ch)
29+
void prom_putchar(char ch)
2930
{
3031
static void __iomem *base;
3132

@@ -38,7 +39,7 @@ void prom_putchar(unsigned char ch)
3839

3940
while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0)
4041
;
41-
prom_uart_wr(base, UART_TX, ch);
42+
prom_uart_wr(base, UART_TX, (unsigned char)ch);
4243
while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0)
4344
;
4445
}

‎arch/mips/ath79/early_printk.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
#include <linux/errno.h>
1414
#include <linux/serial_reg.h>
1515
#include <asm/addrspace.h>
16+
#include <asm/setup.h>
1617

1718
#include <asm/mach-ath79/ath79.h>
1819
#include <asm/mach-ath79/ar71xx_regs.h>
1920
#include <asm/mach-ath79/ar933x_uart.h>
2021

21-
static void (*_prom_putchar) (unsigned char);
22+
static void (*_prom_putchar)(char);
2223

2324
static inline void prom_putchar_wait(void __iomem *reg, u32 mask, u32 val)
2425
{
@@ -33,27 +34,28 @@ static inline void prom_putchar_wait(void __iomem *reg, u32 mask, u32 val)
3334

3435
#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
3536

36-
static void prom_putchar_ar71xx(unsigned char ch)
37+
static void prom_putchar_ar71xx(char ch)
3738
{
3839
void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE));
3940

4041
prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
41-
__raw_writel(ch, base + UART_TX * 4);
42+
__raw_writel((unsigned char)ch, base + UART_TX * 4);
4243
prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
4344
}
4445

45-
static void prom_putchar_ar933x(unsigned char ch)
46+
static void prom_putchar_ar933x(char ch)
4647
{
4748
void __iomem *base = (void __iomem *)(KSEG1ADDR(AR933X_UART_BASE));
4849

4950
prom_putchar_wait(base + AR933X_UART_DATA_REG, AR933X_UART_DATA_TX_CSR,
5051
AR933X_UART_DATA_TX_CSR);
51-
__raw_writel(AR933X_UART_DATA_TX_CSR | ch, base + AR933X_UART_DATA_REG);
52+
__raw_writel(AR933X_UART_DATA_TX_CSR | (unsigned char)ch,
53+
base + AR933X_UART_DATA_REG);
5254
prom_putchar_wait(base + AR933X_UART_DATA_REG, AR933X_UART_DATA_TX_CSR,
5355
AR933X_UART_DATA_TX_CSR);
5456
}
5557

56-
static void prom_putchar_dummy(unsigned char ch)
58+
static void prom_putchar_dummy(char ch)
5759
{
5860
/* nothing to do */
5961
}
@@ -92,7 +94,7 @@ static void prom_putchar_init(void)
9294
}
9395
}
9496

95-
void prom_putchar(unsigned char ch)
97+
void prom_putchar(char ch)
9698
{
9799
if (!_prom_putchar)
98100
prom_putchar_init();

‎arch/mips/bcm63xx/early_printk.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <bcm63xx_io.h>
1010
#include <linux/serial_bcm63xx.h>
11+
#include <asm/setup.h>
1112

1213
static void wait_xfered(void)
1314
{

‎arch/mips/boot/compressed/uart-prom.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
2-
3-
extern void prom_putchar(unsigned char ch);
2+
#include <asm/setup.h>
43

54
void putc(char c)
65
{

‎arch/mips/cavium-octeon/setup.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <asm/mipsregs.h>
3737
#include <asm/bootinfo.h>
3838
#include <asm/sections.h>
39+
#include <asm/setup.h>
3940
#include <asm/time.h>
4041

4142
#include <asm/octeon/octeon.h>
@@ -1108,7 +1109,7 @@ void __init plat_mem_setup(void)
11081109
* Emit one character to the boot UART. Exported for use by the
11091110
* watchdog timer.
11101111
*/
1111-
int prom_putchar(char c)
1112+
void prom_putchar(char c)
11121113
{
11131114
uint64_t lsrval;
11141115

@@ -1119,7 +1120,6 @@ int prom_putchar(char c)
11191120

11201121
/* Write the byte */
11211122
cvmx_write_csr(CVMX_MIO_UARTX_THR(octeon_uart), c & 0xffull);
1122-
return 1;
11231123
}
11241124
EXPORT_SYMBOL(prom_putchar);
11251125

0 commit comments

Comments
 (0)