linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tty/serial: atmel: remove unneeded atmel_get_lines_status function
@ 2019-08-23 13:41 Richard Genoud
  2019-08-23 14:32 ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Genoud @ 2019-08-23 13:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Geert Uytterhoeven, Uwe Kleine-König, linux-serial,
	Nicolas Ferre, Alexandre Belloni, Ludovic Desroches,
	linux-kernel, Richard Genoud

Since commit ce59e48fdbad ("serial: mctrl_gpio: implement interrupt
handling"), the GPIOs interrupts are handled by mctrl_gpio_irq_handle().
So, atmel_get_lines_status() can be completely killed and replaced by :
atmel_uart_readl(port, ATMEL_US_CSR);

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 drivers/tty/serial/atmel_serial.c | 48 ++-----------------------------
 1 file changed, 2 insertions(+), 46 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 9a54c9e6d36e..a8dc8af83f39 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -294,50 +294,6 @@ static void atmel_tasklet_schedule(struct atmel_uart_port *atmel_port,
 		tasklet_schedule(t);
 }
 
-static unsigned int atmel_get_lines_status(struct uart_port *port)
-{
-	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
-	unsigned int status, ret = 0;
-
-	status = atmel_uart_readl(port, ATMEL_US_CSR);
-
-	mctrl_gpio_get(atmel_port->gpios, &ret);
-
-	if (!IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(atmel_port->gpios,
-						UART_GPIO_CTS))) {
-		if (ret & TIOCM_CTS)
-			status &= ~ATMEL_US_CTS;
-		else
-			status |= ATMEL_US_CTS;
-	}
-
-	if (!IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(atmel_port->gpios,
-						UART_GPIO_DSR))) {
-		if (ret & TIOCM_DSR)
-			status &= ~ATMEL_US_DSR;
-		else
-			status |= ATMEL_US_DSR;
-	}
-
-	if (!IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(atmel_port->gpios,
-						UART_GPIO_RI))) {
-		if (ret & TIOCM_RI)
-			status &= ~ATMEL_US_RI;
-		else
-			status |= ATMEL_US_RI;
-	}
-
-	if (!IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(atmel_port->gpios,
-						UART_GPIO_DCD))) {
-		if (ret & TIOCM_CD)
-			status &= ~ATMEL_US_DCD;
-		else
-			status |= ATMEL_US_DCD;
-	}
-
-	return status;
-}
-
 /* Enable or disable the rs485 support */
 static int atmel_config_rs485(struct uart_port *port,
 			      struct serial_rs485 *rs485conf)
@@ -1453,7 +1409,7 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id)
 	spin_lock(&atmel_port->lock_suspended);
 
 	do {
-		status = atmel_get_lines_status(port);
+		status = atmel_uart_readl(port, ATMEL_US_CSR);
 		mask = atmel_uart_readl(port, ATMEL_US_IMR);
 		pending = status & mask;
 		if (!pending)
@@ -2002,7 +1958,7 @@ static int atmel_startup(struct uart_port *port)
 	}
 
 	/* Save current CSR for comparison in atmel_tasklet_func() */
-	atmel_port->irq_status_prev = atmel_get_lines_status(port);
+	atmel_port->irq_status_prev = atmel_uart_readl(port, ATMEL_US_CSR);
 
 	/*
 	 * Finally, enable the serial port
-- 
2.19.2


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

* Re: [PATCH] tty/serial: atmel: remove unneeded atmel_get_lines_status function
  2019-08-23 13:41 [PATCH] tty/serial: atmel: remove unneeded atmel_get_lines_status function Richard Genoud
@ 2019-08-23 14:32 ` Uwe Kleine-König
  2019-08-25  8:45   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2019-08-23 14:32 UTC (permalink / raw)
  To: Richard Genoud
  Cc: Greg Kroah-Hartman, Geert Uytterhoeven, linux-serial,
	Nicolas Ferre, Alexandre Belloni, Ludovic Desroches,
	linux-kernel

On Fri, Aug 23, 2019 at 03:41:09PM +0200, Richard Genoud wrote:
> Since commit ce59e48fdbad ("serial: mctrl_gpio: implement interrupt
> handling"), the GPIOs interrupts are handled by mctrl_gpio_irq_handle().

Well no, since ce59e48fdbad the mctrl_gpio helper can do all that
interrupt stuff. You want to reference
18dfef9c7f87b75bbb0fb66a634f7c13a45b9f8d here.

> So, atmel_get_lines_status() can be completely killed and replaced by :
> atmel_uart_readl(port, ATMEL_US_CSR);
> 
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>

Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH] tty/serial: atmel: remove unneeded atmel_get_lines_status function
  2019-08-23 14:32 ` Uwe Kleine-König
@ 2019-08-25  8:45   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-08-25  8:45 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Richard Genoud, Geert Uytterhoeven, linux-serial, Nicolas Ferre,
	Alexandre Belloni, Ludovic Desroches, linux-kernel

On Fri, Aug 23, 2019 at 04:32:41PM +0200, Uwe Kleine-König wrote:
> On Fri, Aug 23, 2019 at 03:41:09PM +0200, Richard Genoud wrote:
> > Since commit ce59e48fdbad ("serial: mctrl_gpio: implement interrupt
> > handling"), the GPIOs interrupts are handled by mctrl_gpio_irq_handle().
> 
> Well no, since ce59e48fdbad the mctrl_gpio helper can do all that
> interrupt stuff. You want to reference
> 18dfef9c7f87b75bbb0fb66a634f7c13a45b9f8d here.

Richard, can you resend with this changed?

thanks

greg k-h

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

end of thread, other threads:[~2019-08-25  8:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-23 13:41 [PATCH] tty/serial: atmel: remove unneeded atmel_get_lines_status function Richard Genoud
2019-08-23 14:32 ` Uwe Kleine-König
2019-08-25  8:45   ` Greg Kroah-Hartman

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).