Re: [XEN v3 3/3] xen/drivers: ns16550: Fix an incorrect assignment to uart->io_size

2023-01-23 Thread Stefano Stabellini
On Mon, 23 Jan 2023, Ayan Kumar Halder wrote:
> uart->io_size represents the size in bytes. Thus, when serial_port.bit_width
> is assigned to it, it should be converted to size in bytes.
> 
> Fixes: 17b516196c55 ("ns16550: add ACPI support for ARM only")
> Signed-off-by: Ayan Kumar Halder 

Reviewed-by: Stefano Stabellini 


> ---
> 
> Changes from -
> 
> v1, v2 - NA (New patch introduced in v3).
> 
>  xen/drivers/char/ns16550.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
> index 43e1f971ab..092f6b9c4b 100644
> --- a/xen/drivers/char/ns16550.c
> +++ b/xen/drivers/char/ns16550.c
> @@ -1870,7 +1870,7 @@ static int __init ns16550_acpi_uart_init(const void 
> *data)
>  uart->parity = spcr->parity;
>  uart->stop_bits = spcr->stop_bits;
>  uart->io_base = spcr->serial_port.address;
> -uart->io_size = spcr->serial_port.bit_width;
> +uart->io_size = DIV_ROUND_UP(spcr->serial_port.bit_width, BITS_PER_BYTE);
>  uart->reg_shift = spcr->serial_port.bit_offset;
>  uart->reg_width = spcr->serial_port.access_width;
>  
> -- 
> 2.17.1
> 
> 



[XEN v3 3/3] xen/drivers: ns16550: Fix an incorrect assignment to uart->io_size

2023-01-23 Thread Ayan Kumar Halder
uart->io_size represents the size in bytes. Thus, when serial_port.bit_width
is assigned to it, it should be converted to size in bytes.

Fixes: 17b516196c55 ("ns16550: add ACPI support for ARM only")
Signed-off-by: Ayan Kumar Halder 
---

Changes from -

v1, v2 - NA (New patch introduced in v3).

 xen/drivers/char/ns16550.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 43e1f971ab..092f6b9c4b 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1870,7 +1870,7 @@ static int __init ns16550_acpi_uart_init(const void *data)
 uart->parity = spcr->parity;
 uart->stop_bits = spcr->stop_bits;
 uart->io_base = spcr->serial_port.address;
-uart->io_size = spcr->serial_port.bit_width;
+uart->io_size = DIV_ROUND_UP(spcr->serial_port.bit_width, BITS_PER_BYTE);
 uart->reg_shift = spcr->serial_port.bit_offset;
 uart->reg_width = spcr->serial_port.access_width;
 
-- 
2.17.1