[v2] tty: serial: samsung_tty: remove dead code

Message ID 20231019100901.4026680-1-andre.draszik@linaro.org
State New
Headers
Series [v2] tty: serial: samsung_tty: remove dead code |

Commit Message

André Draszik Oct. 19, 2023, 10:09 a.m. UTC
  When support for various old platforms was removed in commit
1ea35b355722 ("ARM: s3c: remove s3c24xx specific hacks"),
s3c24xx_serial_ops also became unused here because nothing sets port
type TYPE_S3C24XX anymore.

Remove s3c24xx_serial_ops and all the code that's unreachable now.

Fixes: 1ea35b355722 ("ARM: s3c: remove s3c24xx specific hacks")
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---
v2: update commit message
---
 drivers/tty/serial/samsung_tty.c | 105 -------------------------------
 1 file changed, 105 deletions(-)
  

Comments

Sam Protsenko Oct. 19, 2023, 2:30 p.m. UTC | #1
On Thu, Oct 19, 2023 at 5:09 AM André Draszik <andre.draszik@linaro.org> wrote:
>
> When support for various old platforms was removed in commit
> 1ea35b355722 ("ARM: s3c: remove s3c24xx specific hacks"),
> s3c24xx_serial_ops also became unused here because nothing sets port
> type TYPE_S3C24XX anymore.
>
> Remove s3c24xx_serial_ops and all the code that's unreachable now.
>
> Fixes: 1ea35b355722 ("ARM: s3c: remove s3c24xx specific hacks")
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> ---

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

> v2: update commit message
> ---
>  drivers/tty/serial/samsung_tty.c | 105 -------------------------------
>  1 file changed, 105 deletions(-)
>
> diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
> index 07fb8a9dac63..6b8d4b4402e9 100644
> --- a/drivers/tty/serial/samsung_tty.c
> +++ b/drivers/tty/serial/samsung_tty.c
> @@ -64,7 +64,6 @@
>  #define RXSTAT_DUMMY_READ (0x10000000)
>
>  enum s3c24xx_port_type {
> -       TYPE_S3C24XX,
>         TYPE_S3C6400,
>         TYPE_APPLE_S5L,
>  };
> @@ -128,8 +127,6 @@ struct s3c24xx_uart_dma {
>  };
>
>  struct s3c24xx_uart_port {
> -       unsigned char                   rx_claimed;
> -       unsigned char                   tx_claimed;
>         unsigned char                   rx_enabled;
>         unsigned char                   tx_enabled;
>         unsigned int                    pm_level;
> @@ -1166,29 +1163,6 @@ static void s3c24xx_serial_release_dma(struct s3c24xx_uart_port *p)
>         }
>  }
>
> -static void s3c24xx_serial_shutdown(struct uart_port *port)
> -{
> -       struct s3c24xx_uart_port *ourport = to_ourport(port);
> -
> -       if (ourport->tx_claimed) {
> -               free_irq(ourport->tx_irq, ourport);
> -               ourport->tx_enabled = 0;
> -               ourport->tx_claimed = 0;
> -               ourport->tx_mode = 0;
> -       }
> -
> -       if (ourport->rx_claimed) {
> -               free_irq(ourport->rx_irq, ourport);
> -               ourport->rx_claimed = 0;
> -               ourport->rx_enabled = 0;
> -       }
> -
> -       if (ourport->dma)
> -               s3c24xx_serial_release_dma(ourport);
> -
> -       ourport->tx_in_progress = 0;
> -}
> -
>  static void s3c64xx_serial_shutdown(struct uart_port *port)
>  {
>         struct s3c24xx_uart_port *ourport = to_ourport(port);
> @@ -1234,48 +1208,6 @@ static void apple_s5l_serial_shutdown(struct uart_port *port)
>         ourport->tx_in_progress = 0;
>  }
>
> -static int s3c24xx_serial_startup(struct uart_port *port)
> -{
> -       struct s3c24xx_uart_port *ourport = to_ourport(port);
> -       int ret;
> -
> -       ourport->rx_enabled = 1;
> -
> -       ret = request_irq(ourport->rx_irq, s3c24xx_serial_rx_irq, 0,
> -                         s3c24xx_serial_portname(port), ourport);
> -
> -       if (ret != 0) {
> -               dev_err(port->dev, "cannot get irq %d\n", ourport->rx_irq);
> -               return ret;
> -       }
> -
> -       ourport->rx_claimed = 1;
> -
> -       dev_dbg(port->dev, "requesting tx irq...\n");
> -
> -       ourport->tx_enabled = 1;
> -
> -       ret = request_irq(ourport->tx_irq, s3c24xx_serial_tx_irq, 0,
> -                         s3c24xx_serial_portname(port), ourport);
> -
> -       if (ret) {
> -               dev_err(port->dev, "cannot get irq %d\n", ourport->tx_irq);
> -               goto err;
> -       }
> -
> -       ourport->tx_claimed = 1;
> -
> -       /* the port reset code should have done the correct
> -        * register setup for the port controls
> -        */
> -
> -       return ret;
> -
> -err:
> -       s3c24xx_serial_shutdown(port);
> -       return ret;
> -}
> -
>  static int s3c64xx_serial_startup(struct uart_port *port)
>  {
>         struct s3c24xx_uart_port *ourport = to_ourport(port);
> @@ -1692,8 +1624,6 @@ static const char *s3c24xx_serial_type(struct uart_port *port)
>         const struct s3c24xx_uart_port *ourport = to_ourport(port);
>
>         switch (ourport->info->type) {
> -       case TYPE_S3C24XX:
> -               return "S3C24XX";
>         case TYPE_S3C6400:
>                 return "S3C6400/10";
>         case TYPE_APPLE_S5L:
> @@ -1753,27 +1683,6 @@ static void s3c24xx_serial_put_poll_char(struct uart_port *port,
>                          unsigned char c);
>  #endif
>
> -static const struct uart_ops s3c24xx_serial_ops = {
> -       .pm             = s3c24xx_serial_pm,
> -       .tx_empty       = s3c24xx_serial_tx_empty,
> -       .get_mctrl      = s3c24xx_serial_get_mctrl,
> -       .set_mctrl      = s3c24xx_serial_set_mctrl,
> -       .stop_tx        = s3c24xx_serial_stop_tx,
> -       .start_tx       = s3c24xx_serial_start_tx,
> -       .stop_rx        = s3c24xx_serial_stop_rx,
> -       .break_ctl      = s3c24xx_serial_break_ctl,
> -       .startup        = s3c24xx_serial_startup,
> -       .shutdown       = s3c24xx_serial_shutdown,
> -       .set_termios    = s3c24xx_serial_set_termios,
> -       .type           = s3c24xx_serial_type,
> -       .config_port    = s3c24xx_serial_config_port,
> -       .verify_port    = s3c24xx_serial_verify_port,
> -#if defined(CONFIG_SERIAL_SAMSUNG_CONSOLE) && defined(CONFIG_CONSOLE_POLL)
> -       .poll_get_char = s3c24xx_serial_get_poll_char,
> -       .poll_put_char = s3c24xx_serial_put_poll_char,
> -#endif
> -};
> -
>  static const struct uart_ops s3c64xx_serial_ops = {
>         .pm             = s3c24xx_serial_pm,
>         .tx_empty       = s3c24xx_serial_tx_empty,
> @@ -1836,7 +1745,6 @@ static void s3c24xx_serial_init_port_default(int index) {
>         port->iotype = UPIO_MEM;
>         port->uartclk = 0;
>         port->fifosize = 16;
> -       port->ops = &s3c24xx_serial_ops;
>         port->flags = UPF_BOOT_AUTOCONF;
>         port->line = index;
>  }
> @@ -1954,16 +1862,6 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
>                 ourport->tx_irq = ret + 1;
>         }
>
> -       switch (ourport->info->type) {
> -       case TYPE_S3C24XX:
> -               ret = platform_get_irq(platdev, 1);
> -               if (ret > 0)
> -                       ourport->tx_irq = ret;
> -               break;
> -       default:
> -               break;
> -       }
> -
>         /*
>          * DMA is currently supported only on DT platforms, if DMA properties
>          * are specified.
> @@ -2083,9 +1981,6 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
>                         &ourport->drv_data->def_cfg;
>
>         switch (ourport->info->type) {
> -       case TYPE_S3C24XX:
> -               ourport->port.ops = &s3c24xx_serial_ops;
> -               break;
>         case TYPE_S3C6400:
>                 ourport->port.ops = &s3c64xx_serial_ops;
>                 break;
> --
> 2.40.1
>
  
Andi Shyti Oct. 24, 2023, 9:55 p.m. UTC | #2
Hi Andre,

On Thu, Oct 19, 2023 at 11:09:01AM +0100, André Draszik wrote:
> When support for various old platforms was removed in commit
> 1ea35b355722 ("ARM: s3c: remove s3c24xx specific hacks"),
> s3c24xx_serial_ops also became unused here because nothing sets port
> type TYPE_S3C24XX anymore.
> 
> Remove s3c24xx_serial_ops and all the code that's unreachable now.
> 
> Fixes: 1ea35b355722 ("ARM: s3c: remove s3c24xx specific hacks")

is this really a fix? Or is it a cleanup?

Andi

> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
  
André Draszik Oct. 25, 2023, 11:22 a.m. UTC | #3
Hi Andi,

On Tue, 2023-10-24 at 23:55 +0200, Andi Shyti wrote:
> Hi Andre,
> 
> On Thu, Oct 19, 2023 at 11:09:01AM +0100, André Draszik wrote:
> > When support for various old platforms was removed in commit
> > 1ea35b355722 ("ARM: s3c: remove s3c24xx specific hacks"),
> > s3c24xx_serial_ops also became unused here because nothing sets
> > port
> > type TYPE_S3C24XX anymore.
> > 
> > Remove s3c24xx_serial_ops and all the code that's unreachable now.
> > 
> > Fixes: 1ea35b355722 ("ARM: s3c: remove s3c24xx specific hacks")
> 
> is this really a fix? Or is it a cleanup?

I guess from my position it's fixing the issue of dead code, introduced
in the commit referenced. Which is of course also a cleanup :-)

Not sure...

Cheers,
Andre
  

Patch

diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 07fb8a9dac63..6b8d4b4402e9 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -64,7 +64,6 @@ 
 #define RXSTAT_DUMMY_READ (0x10000000)
 
 enum s3c24xx_port_type {
-	TYPE_S3C24XX,
 	TYPE_S3C6400,
 	TYPE_APPLE_S5L,
 };
@@ -128,8 +127,6 @@  struct s3c24xx_uart_dma {
 };
 
 struct s3c24xx_uart_port {
-	unsigned char			rx_claimed;
-	unsigned char			tx_claimed;
 	unsigned char			rx_enabled;
 	unsigned char			tx_enabled;
 	unsigned int			pm_level;
@@ -1166,29 +1163,6 @@  static void s3c24xx_serial_release_dma(struct s3c24xx_uart_port *p)
 	}
 }
 
-static void s3c24xx_serial_shutdown(struct uart_port *port)
-{
-	struct s3c24xx_uart_port *ourport = to_ourport(port);
-
-	if (ourport->tx_claimed) {
-		free_irq(ourport->tx_irq, ourport);
-		ourport->tx_enabled = 0;
-		ourport->tx_claimed = 0;
-		ourport->tx_mode = 0;
-	}
-
-	if (ourport->rx_claimed) {
-		free_irq(ourport->rx_irq, ourport);
-		ourport->rx_claimed = 0;
-		ourport->rx_enabled = 0;
-	}
-
-	if (ourport->dma)
-		s3c24xx_serial_release_dma(ourport);
-
-	ourport->tx_in_progress = 0;
-}
-
 static void s3c64xx_serial_shutdown(struct uart_port *port)
 {
 	struct s3c24xx_uart_port *ourport = to_ourport(port);
@@ -1234,48 +1208,6 @@  static void apple_s5l_serial_shutdown(struct uart_port *port)
 	ourport->tx_in_progress = 0;
 }
 
-static int s3c24xx_serial_startup(struct uart_port *port)
-{
-	struct s3c24xx_uart_port *ourport = to_ourport(port);
-	int ret;
-
-	ourport->rx_enabled = 1;
-
-	ret = request_irq(ourport->rx_irq, s3c24xx_serial_rx_irq, 0,
-			  s3c24xx_serial_portname(port), ourport);
-
-	if (ret != 0) {
-		dev_err(port->dev, "cannot get irq %d\n", ourport->rx_irq);
-		return ret;
-	}
-
-	ourport->rx_claimed = 1;
-
-	dev_dbg(port->dev, "requesting tx irq...\n");
-
-	ourport->tx_enabled = 1;
-
-	ret = request_irq(ourport->tx_irq, s3c24xx_serial_tx_irq, 0,
-			  s3c24xx_serial_portname(port), ourport);
-
-	if (ret) {
-		dev_err(port->dev, "cannot get irq %d\n", ourport->tx_irq);
-		goto err;
-	}
-
-	ourport->tx_claimed = 1;
-
-	/* the port reset code should have done the correct
-	 * register setup for the port controls
-	 */
-
-	return ret;
-
-err:
-	s3c24xx_serial_shutdown(port);
-	return ret;
-}
-
 static int s3c64xx_serial_startup(struct uart_port *port)
 {
 	struct s3c24xx_uart_port *ourport = to_ourport(port);
@@ -1692,8 +1624,6 @@  static const char *s3c24xx_serial_type(struct uart_port *port)
 	const struct s3c24xx_uart_port *ourport = to_ourport(port);
 
 	switch (ourport->info->type) {
-	case TYPE_S3C24XX:
-		return "S3C24XX";
 	case TYPE_S3C6400:
 		return "S3C6400/10";
 	case TYPE_APPLE_S5L:
@@ -1753,27 +1683,6 @@  static void s3c24xx_serial_put_poll_char(struct uart_port *port,
 			 unsigned char c);
 #endif
 
-static const struct uart_ops s3c24xx_serial_ops = {
-	.pm		= s3c24xx_serial_pm,
-	.tx_empty	= s3c24xx_serial_tx_empty,
-	.get_mctrl	= s3c24xx_serial_get_mctrl,
-	.set_mctrl	= s3c24xx_serial_set_mctrl,
-	.stop_tx	= s3c24xx_serial_stop_tx,
-	.start_tx	= s3c24xx_serial_start_tx,
-	.stop_rx	= s3c24xx_serial_stop_rx,
-	.break_ctl	= s3c24xx_serial_break_ctl,
-	.startup	= s3c24xx_serial_startup,
-	.shutdown	= s3c24xx_serial_shutdown,
-	.set_termios	= s3c24xx_serial_set_termios,
-	.type		= s3c24xx_serial_type,
-	.config_port	= s3c24xx_serial_config_port,
-	.verify_port	= s3c24xx_serial_verify_port,
-#if defined(CONFIG_SERIAL_SAMSUNG_CONSOLE) && defined(CONFIG_CONSOLE_POLL)
-	.poll_get_char = s3c24xx_serial_get_poll_char,
-	.poll_put_char = s3c24xx_serial_put_poll_char,
-#endif
-};
-
 static const struct uart_ops s3c64xx_serial_ops = {
 	.pm		= s3c24xx_serial_pm,
 	.tx_empty	= s3c24xx_serial_tx_empty,
@@ -1836,7 +1745,6 @@  static void s3c24xx_serial_init_port_default(int index) {
 	port->iotype = UPIO_MEM;
 	port->uartclk = 0;
 	port->fifosize = 16;
-	port->ops = &s3c24xx_serial_ops;
 	port->flags = UPF_BOOT_AUTOCONF;
 	port->line = index;
 }
@@ -1954,16 +1862,6 @@  static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
 		ourport->tx_irq = ret + 1;
 	}
 
-	switch (ourport->info->type) {
-	case TYPE_S3C24XX:
-		ret = platform_get_irq(platdev, 1);
-		if (ret > 0)
-			ourport->tx_irq = ret;
-		break;
-	default:
-		break;
-	}
-
 	/*
 	 * DMA is currently supported only on DT platforms, if DMA properties
 	 * are specified.
@@ -2083,9 +1981,6 @@  static int s3c24xx_serial_probe(struct platform_device *pdev)
 			&ourport->drv_data->def_cfg;
 
 	switch (ourport->info->type) {
-	case TYPE_S3C24XX:
-		ourport->port.ops = &s3c24xx_serial_ops;
-		break;
 	case TYPE_S3C6400:
 		ourport->port.ops = &s3c64xx_serial_ops;
 		break;