forked from Mirrors/opensbi
lib: fix pointer of type 'void *' used in arithmetic
Using "void *" in arithmetic causes errors with strict compiler settings: "error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]" Avoid these by calculating on "char *" where 1-byte data size is assumed. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae> Reviewed-by: Dong Du <Dd_nirvana@sjtu.edu.cn> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
fb688d9e9d
commit
5d025eb235
@@ -29,7 +29,7 @@
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
static volatile void *uart_base;
|
||||
static volatile char *uart_base;
|
||||
|
||||
static u32 get_reg(u32 num)
|
||||
{
|
||||
@@ -67,7 +67,7 @@ int gaisler_uart_init(unsigned long base, u32 in_freq, u32 baudrate)
|
||||
{
|
||||
u32 ctrl;
|
||||
|
||||
uart_base = (volatile void *)base;
|
||||
uart_base = (volatile char *)base;
|
||||
|
||||
/* Configure baudrate */
|
||||
if (in_freq)
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#define UART_TX_FULL 0x2
|
||||
#define UART_RX_FULL 0x8
|
||||
|
||||
static volatile void *uart_base;
|
||||
static volatile char *uart_base;
|
||||
|
||||
static void shakti_uart_putc(char ch)
|
||||
{
|
||||
@@ -46,7 +46,7 @@ static struct sbi_console_device shakti_console = {
|
||||
|
||||
int shakti_uart_init(unsigned long base, u32 in_freq, u32 baudrate)
|
||||
{
|
||||
uart_base = (volatile void *)base;
|
||||
uart_base = (volatile char *)base;
|
||||
u16 baud = (u16)(in_freq/(16 * baudrate));
|
||||
writew(baud, uart_base + REG_BAUD);
|
||||
|
||||
|
@@ -29,7 +29,7 @@
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
static volatile void *uart_base;
|
||||
static volatile char *uart_base;
|
||||
static u32 uart_in_freq;
|
||||
static u32 uart_baudrate;
|
||||
|
||||
@@ -90,7 +90,7 @@ static struct sbi_console_device sifive_console = {
|
||||
|
||||
int sifive_uart_init(unsigned long base, u32 in_freq, u32 baudrate)
|
||||
{
|
||||
uart_base = (volatile void *)base;
|
||||
uart_base = (volatile char *)base;
|
||||
uart_in_freq = in_freq;
|
||||
uart_baudrate = baudrate;
|
||||
|
||||
|
@@ -39,7 +39,7 @@
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
static volatile void *uart8250_base;
|
||||
static volatile char *uart8250_base;
|
||||
static u32 uart8250_in_freq;
|
||||
static u32 uart8250_baudrate;
|
||||
static u32 uart8250_reg_width;
|
||||
@@ -95,7 +95,7 @@ int uart8250_init(unsigned long base, u32 in_freq, u32 baudrate, u32 reg_shift,
|
||||
{
|
||||
u16 bdiv;
|
||||
|
||||
uart8250_base = (volatile void *)base;
|
||||
uart8250_base = (volatile char *)base;
|
||||
uart8250_reg_shift = reg_shift;
|
||||
uart8250_reg_width = reg_width;
|
||||
uart8250_in_freq = in_freq;
|
||||
|
Reference in New Issue
Block a user