tty: hvc: Fix the RISC-V SBI driver for a refactoring
PATCH v2 1/1 tty: hvc: Fix the RISC-V SBI driver for a refactoring
From: Palmer Dabbelt <[email protected]>
I missed the int->size_t refactoring in f32fcbedbe92 ("tty: hvc: convert to u8 and size_t"), which causes the newly used ops in 88ead68e764c ("tty: Add SBI debug console support to HVC SBI driver") to fail to build due to a
linux/drivers/tty/hvc/hvc_riscv_sbi.c:59:15: error: incompatible function pointer types initializing 'ssize_t (*)(uint32_t, const u8 *, size_t)' (aka 'long (*)(unsigned int, const unsigned char *, unsigned long)') with an expression of type 'int (uint32_t, const char *, int)' (aka 'int (unsigned int, const char *, int)') [-Wincompatible-function-pointer-types]
.put_chars = hvc_sbi_dbcn_tty_put,
---
Changes since v1 <[email protected]>:
* Fix the return and arguments correctly.
* Also fix the hvc_sbi_dbcn_tty_{get,put}().
--- drivers/tty/hvc/hvc_riscv_sbi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/hvc/hvc_riscv_sbi.c +4 -4
@@ -15,7 +15,7 @@#include "hvc_console.h" -static int hvc_sbi_tty_put (uint32_t vtermno,const char *buf,int count) +static ssize_t hvc_sbi_tty_put (uint32_t vtermno,const u8 *buf,size_t count) {int i;
@@ -25,7 +25,7 @@ static int hvc_sbi_tty_put(uint32_t vtermno, const char *buf, int count)return i; } -static int hvc_sbi_tty_get (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_sbi_tty_get (uint32_t vtermno,u8 *buf,size_t count) {int i, c;
@@ -44,12 +44,12 @@ static const struct hv_ops hvc_sbi_v01_ops = { .put_chars = hvc_sbi_tty_put, }; -static int hvc_sbi_dbcn_tty_put (uint32_t vtermno,const char *buf,int count) +static ssize_t hvc_sbi_dbcn_tty_put (uint32_t vtermno,const u8 *buf,size_t count) {return sbi_debug_console_write (buf, count); } -static int hvc_sbi_dbcn_tty_get (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_sbi_dbcn_tty_get (uint32_t vtermno,u8 *buf,size_t count) {return sbi_debug_console_read (buf, count); }
Signature · 1 line
2.43.0
Quoted 37 lines · Palmer Dabbelt
From: Palmer Dabbelt <[email protected]>
I missed the
int->size_trefactoring inf32fcbedbe92("tty: hvc: convert to u8 andsize_t"), which causes the newly used ops in88ead68e764c("tty: Add SBI debug console support to HVC SBI driver") to fail to build due to a
linux/drivers/tty/hvc/hvc_riscv_sbi.c:59:15: error: incompatible function pointer types initializing 'ssize_t(*)(uint32_t, const u8 *,size_t)' (aka 'long (*)(unsigned int, const unsigned char *, unsigned long)') with an expression of type 'int (uint32_t, const char *, int)' (aka 'int (unsigned int, const char *, int)') [-Wincompatible-function-pointer-types]
.put_chars =hvc_sbi_dbcn_tty_put,Fixes f32fcbedbe92 ("tty: hvc: convert to u8 and size_t")Fixes 88ead68e764c ("tty: Add SBI debug console support to HVC SBI driver")Signed-off-by Palmer Dabbelt <[email protected]>---
Changes since v1 <[email protected]>:
* Fix the return and arguments correctly.
* Also fix the hvc_sbi_dbcn_tty_{get,put}().--- drivers/tty/hvc/hvc_riscv_sbi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/tty/hvc/hvc_riscv_sbi.c +1
-1@@ -15,7 +15,7 @@#include "hvc_console.h" -static int hvc_sbi_tty_put (uint32_t vtermno,const char *buf,int count) +static ssize_t hvc_sbi_tty_put (uint32_t vtermno,const u8 *buf,size_t count) {int i;
drivers/tty/hvc/hvc_riscv_sbi.c static int hvc_sbi_tty_put(uint32_t vtermno, const char *buf, int count) · line 28
Quoted 5 lines
drivers/tty/hvc/hvc_riscv_sbi.c +1
-1@@ -25,7 +25,7 @@ static int hvc_sbi_tty_put(uint32_t vtermno, const char *buf, int count)return i; } -static int hvc_sbi_tty_get (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_sbi_tty_get (uint32_t vtermno,u8 *buf,size_t count)
The hvc_sbi_tty_put() and hvc_sbi_tty_get() functions are already updated in Linus's tree. We only need to fix hvc_sbi_dbcn_tty_put() and hvc_sbi_dbcn_tty_get()
Please rebase this fix upon Linux-6.8-rc1 whenever that is available.
Quoted 19 lines
drivers/tty/hvc/hvc_riscv_sbi.c +2
-3{int i, c;@@ -44,12 +44,12 @@ static const struct hv_ops hvc_sbi_v01_ops = { .put_chars = hvc_sbi_tty_put, }; -static int hvc_sbi_dbcn_tty_put (uint32_t vtermno,const char *buf,int count) +static ssize_t hvc_sbi_dbcn_tty_put (uint32_t vtermno,const u8 *buf,size_t count) {return sbi_debug_console_write (buf, count); } -static int hvc_sbi_dbcn_tty_get (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_sbi_dbcn_tty_get (uint32_t vtermno,u8 *buf,size_t count) {return sbi_debug_console_read (buf, count); } --
Quoted 3 lines
2.43.0
Thanks,
Anup
Quoted 41 lines · On Fri, 19 Jan 2024 19:59:11 PST (-0800), [email protected] wrote:
Quoted 40 lines · Palmer Dabbelt
From: Palmer Dabbelt <[email protected]>
I missed the
int->size_trefactoring inf32fcbedbe92("tty: hvc: convert to u8 andsize_t"), which causes the newly used ops in88ead68e764c("tty: Add SBI debug console support to HVC SBI driver") to fail to build due to a
linux/drivers/tty/hvc/hvc_riscv_sbi.c:59:15: error: incompatible function pointer types initializing 'ssize_t(*)(uint32_t, const u8 *,size_t)' (aka 'long (*)(unsigned int, const unsigned char *, unsigned long)') with an expression of type 'int (uint32_t, const char *, int)' (aka 'int (unsigned int, const char *, int)') [-Wincompatible-function-pointer-types]
.put_chars =hvc_sbi_dbcn_tty_put,Fixes f32fcbedbe92 ("tty: hvc: convert to u8 and size_t")Fixes 88ead68e764c ("tty: Add SBI debug console support to HVC SBI driver")Signed-off-by Palmer Dabbelt <[email protected]>---
Changes since v1 <[email protected]>:
* Fix the return and arguments correctly.
* Also fix the hvc_sbi_dbcn_tty_{get,put}().--- drivers/tty/hvc/hvc_riscv_sbi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/tty/hvc/hvc_riscv_sbi.c +1
-1@@ -15,7 +15,7 @@#include "hvc_console.h" -static int hvc_sbi_tty_put (uint32_t vtermno,const char *buf,int count) +static ssize_t hvc_sbi_tty_put (uint32_t vtermno,const u8 *buf,size_t count) {int i;@@ -25,7 +25,7 @@ static int hvc_sbi_tty_put(uint32_t vtermno, const char *buf, int count)return i; }
Quoted 8 lines
drivers/tty/hvc/hvc_riscv_sbi.c static int hvc_sbi_tty_put(uint32_t vtermno, const char *buf, int count) · line 28
Quoted 2 lines
drivers/tty/hvc/hvc_riscv_sbi.c +1
-1-static int hvc_sbi_tty_get (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_sbi_tty_get (uint32_t vtermno,u8 *buf,size_t count)The
hvc_sbi_tty_put()andhvc_sbi_tty_get()functions are already updated in Linus's tree. We only need to fixhvc_sbi_dbcn_tty_put()andhvc_sbi_dbcn_tty_get()Please rebase this fix upon Linux-6.8-rc1 whenever that is available.
Ya, it's kind of clunky: we added functions at the same time as the refactoring, so there's no good clean tree to apply a patch to. Right now I've actually got this bundled up into a merge, that's usually the worst option but it's about as good as I could come up with -- Linus still hasn't merged my part 2, so I'm going to send a part 3 once I get through the tests on my end.
So we'll see, likely tomorrow, and then I'll deal with the fallout after rc1...
Quoted 28 lines
Quoted 20 lines
drivers/tty/hvc/hvc_riscv_sbi.c +2
-3{int i, c;@@ -44,12 +44,12 @@ static const struct hv_ops hvc_sbi_v01_ops = { .put_chars = hvc_sbi_tty_put, }; -static int hvc_sbi_dbcn_tty_put (uint32_t vtermno,const char *buf,int count) +static ssize_t hvc_sbi_dbcn_tty_put (uint32_t vtermno,const u8 *buf,size_t count) {return sbi_debug_console_write (buf, count); } -static int hvc_sbi_dbcn_tty_get (uint32_t vtermno,char *buf,int count) +static ssize_t hvc_sbi_dbcn_tty_get (uint32_t vtermno,u8 *buf,size_t count) {return sbi_debug_console_read (buf, count); } --Quoted 3 lines
2.43.0
Reviewed-by Anup Patel <[email protected]>Thanks,
Anup