serial: liteuart: Remove a copy of UART id in private structure
Subsystems (2)
PATCH 1/1 serial: liteuart: Remove a copy of UART id in private structure
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 <[email protected]>
---
Depends on
https://lore.kernel.org/linux-serial/[email protected]/
drivers/tty/serial/liteuart.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/tty/serial/liteuart.c +3 -5
@@ -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 ; }
Signature · 1 line
2.39.0
Quoted 45 lines · Andy Shevchenko
The struct
liteuart_portkeeps tracking of UART ID which is also saved in the structuart_portas line member. Drop the former one and use the latter everywhere.Signed-off-by Andy Shevchenko <[email protected]>---
Depends on
https://lore.kernel.org/linux-serial/[email protected]/drivers/tty/serial/liteuart.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/tty/serial/liteuart.c +1
-3@@ -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) {
drivers/tty/serial/liteuart.c static int liteuart_probe(struct platform_device *pdev) · line 349
Quoted 10 lines
drivers/tty/serial/liteuart.c +2
-2struct 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 <[email protected]>
Quoted 3 lines
Signature · 1 line
2.39.0