diff mbox series

serial: sh-sci: Improve type-safety calling sci_receive_chars()

Message ID 20181107133731.13058-1-geert+renesas@glider.be (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show
Series serial: sh-sci: Improve type-safety calling sci_receive_chars() | expand

Commit Message

Geert Uytterhoeven Nov. 7, 2018, 1:37 p.m. UTC
While ptr and port both point to the uart_port structure, the former is
the untyped pointer cookie passed to interrupt handlers.
Use the correctly typed port variable instead, to improve type-safety.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/tty/serial/sh-sci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ulrich Hecht Nov. 8, 2018, 3:05 a.m. UTC | #1
Thanks for your patch!

> On November 7, 2018 at 2:37 PM Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> 
> 
> While ptr and port both point to the uart_port structure, the former is
> the untyped pointer cookie passed to interrupt handlers.
> Use the correctly typed port variable instead, to improve type-safety.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/tty/serial/sh-sci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 8863689a6eebcc72..f1ee992532717a34 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1710,7 +1710,7 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr)
>  	 * of whether the I_IXOFF is set, otherwise, how is the interrupt
>  	 * to be disabled?
>  	 */
> -	sci_receive_chars(ptr);
> +	sci_receive_chars(port);
>  
>  	return IRQ_HANDLED;
>  }
> @@ -1766,7 +1766,7 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr)
>  	} else {
>  		sci_handle_fifo_overrun(port);
>  		if (!s->chan_rx)
> -			sci_receive_chars(ptr);
> +			sci_receive_chars(port);
>  	}
>  
>  	sci_clear_SCxSR(port, SCxSR_ERROR_CLEAR(port));
> -- 
> 2.17.1
>

Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>

CU
Uli
Simon Horman Nov. 8, 2018, 11:41 a.m. UTC | #2
On Wed, Nov 07, 2018 at 02:37:31PM +0100, Geert Uytterhoeven wrote:
> While ptr and port both point to the uart_port structure, the former is
> the untyped pointer cookie passed to interrupt handlers.
> Use the correctly typed port variable instead, to improve type-safety.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
diff mbox series

Patch

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 8863689a6eebcc72..f1ee992532717a34 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1710,7 +1710,7 @@  static irqreturn_t sci_rx_interrupt(int irq, void *ptr)
 	 * of whether the I_IXOFF is set, otherwise, how is the interrupt
 	 * to be disabled?
 	 */
-	sci_receive_chars(ptr);
+	sci_receive_chars(port);
 
 	return IRQ_HANDLED;
 }
@@ -1766,7 +1766,7 @@  static irqreturn_t sci_er_interrupt(int irq, void *ptr)
 	} else {
 		sci_handle_fifo_overrun(port);
 		if (!s->chan_rx)
-			sci_receive_chars(ptr);
+			sci_receive_chars(port);
 	}
 
 	sci_clear_SCxSR(port, SCxSR_ERROR_CLEAR(port));