linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] serial: liteuart: Remove a copy of UART id in private structure
@ 2023-01-23 19:26 Andy Shevchenko
  2023-01-23 20:06 ` Gabriel L. Somlo
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2023-01-23 19:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Gabriel Somlo, Jiri Slaby, linux-serial,
	linux-kernel
  Cc: Karol Gugala, Mateusz Holenko, Joel Stanley, Andy Shevchenko

The struct liteuart_port keeps tracking of UART ID which is also
saved in the struct uart_port as line member. Drop the former one
and use the latter everywhere.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---

Depends on
https://lore.kernel.org/linux-serial/20230123191741.79751-1-andriy.shevchenko@linux.intel.com/

 drivers/tty/serial/liteuart.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
index 562892395570..80de3a42b67b 100644
--- a/drivers/tty/serial/liteuart.c
+++ b/drivers/tty/serial/liteuart.c
@@ -46,7 +46,6 @@
 struct liteuart_port {
 	struct uart_port port;
 	struct timer_list timer;
-	u32 id;
 	u8 irq_reg;
 };
 
@@ -314,7 +313,6 @@ static int liteuart_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	uart->id = dev_id;
 	/* values not from device tree */
 	port->dev = &pdev->dev;
 	port->iotype = UPIO_MEM;
@@ -334,7 +332,7 @@ static int liteuart_probe(struct platform_device *pdev)
 	return 0;
 
 err_erase_id:
-	xa_erase(&liteuart_array, uart->id);
+	xa_erase(&liteuart_array, dev_id);
 
 	return ret;
 }
@@ -342,10 +340,10 @@ static int liteuart_probe(struct platform_device *pdev)
 static int liteuart_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
-	struct liteuart_port *uart = to_liteuart_port(port);
+	unsigned int line = port->line;
 
 	uart_remove_one_port(&liteuart_driver, port);
-	xa_erase(&liteuart_array, uart->id);
+	xa_erase(&liteuart_array, line);
 
 	return 0;
 }
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] serial: liteuart: Remove a copy of UART id in private structure
  2023-01-23 19:26 [PATCH v1 1/1] serial: liteuart: Remove a copy of UART id in private structure Andy Shevchenko
@ 2023-01-23 20:06 ` Gabriel L. Somlo
  0 siblings, 0 replies; 2+ messages in thread
From: Gabriel L. Somlo @ 2023-01-23 20:06 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel,
	Karol Gugala, Mateusz Holenko, Joel Stanley

On Mon, Jan 23, 2023 at 09:26:04PM +0200, Andy Shevchenko wrote:
> The struct liteuart_port keeps tracking of UART ID which is also
> saved in the struct uart_port as line member. Drop the former one
> and use the latter everywhere.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> 
> Depends on
> https://lore.kernel.org/linux-serial/20230123191741.79751-1-andriy.shevchenko@linux.intel.com/
> 
>  drivers/tty/serial/liteuart.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
> index 562892395570..80de3a42b67b 100644
> --- a/drivers/tty/serial/liteuart.c
> +++ b/drivers/tty/serial/liteuart.c
> @@ -46,7 +46,6 @@
>  struct liteuart_port {
>  	struct uart_port port;
>  	struct timer_list timer;
> -	u32 id;
>  	u8 irq_reg;
>  };
>  
> @@ -314,7 +313,6 @@ static int liteuart_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> -	uart->id = dev_id;
>  	/* values not from device tree */
>  	port->dev = &pdev->dev;
>  	port->iotype = UPIO_MEM;
> @@ -334,7 +332,7 @@ static int liteuart_probe(struct platform_device *pdev)
>  	return 0;
>  
>  err_erase_id:
> -	xa_erase(&liteuart_array, uart->id);
> +	xa_erase(&liteuart_array, dev_id);
>  
>  	return ret;
>  }
> @@ -342,10 +340,10 @@ static int liteuart_probe(struct platform_device *pdev)
>  static int liteuart_remove(struct platform_device *pdev)
>  {
>  	struct uart_port *port = platform_get_drvdata(pdev);
> -	struct liteuart_port *uart = to_liteuart_port(port);
> +	unsigned int line = port->line;
>  
>  	uart_remove_one_port(&liteuart_driver, port);
> -	xa_erase(&liteuart_array, uart->id);
> +	xa_erase(&liteuart_array, line);
>  
>  	return 0;
>  }

Nice, thanks!

Reviewed-by: Gabriel Somlo <gsomlo@gmail.com>

> -- 
> 2.39.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-23 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 19:26 [PATCH v1 1/1] serial: liteuart: Remove a copy of UART id in private structure Andy Shevchenko
2023-01-23 20:06 ` Gabriel L. Somlo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).