]> www.infradead.org Git - nvme.git/commitdiff
serial: max3100: Replace custom polling timeout with standard one
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 2 Apr 2024 19:50:33 +0000 (22:50 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Apr 2024 13:51:36 +0000 (15:51 +0200)
Serial core provides a standard timeout for polling modem state.
Use it instead of a custom approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240402195306.269276-7-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/max3100.c

index ad6b692c7360066bd0cc39063ce918a219b9ad1d..285675c3a8481537e0d9e74be57dc5e72284a503 100644 (file)
@@ -34,8 +34,6 @@
  * struct plat_max3100 - MAX3100 SPI UART platform data
  * @loopback:            force MAX3100 in loopback
  * @crystal:             1 for 3.6864 Mhz, 0 for 1.8432
- * @poll_time:           poll time for CTS signal in ms, 0 disables (so no hw
- *                       flow ctrl is possible but you have less CPU usage)
  *
  * You should use this structure in your machine description to specify
  * how the MAX3100 is connected.
@@ -43,7 +41,6 @@
 struct plat_max3100 {
        int loopback;
        int crystal;
-       int poll_time;
 };
 
 #define MAX3100_C    (1<<14)
@@ -122,9 +119,6 @@ struct max3100_port {
        /* need to know we are suspending to avoid deadlock on workqueue */
        int suspending;
 
-       /* poll time (in ms) for ctrl lines */
-       int poll_time;
-       /* and its timer */
        struct timer_list       timer;
 };
 
@@ -177,10 +171,8 @@ static void max3100_timeout(struct timer_list *t)
 {
        struct max3100_port *s = from_timer(s, t, timer);
 
-       if (s->port.state) {
-               max3100_dowork(s);
-               mod_timer(&s->timer, jiffies + s->poll_time);
-       }
+       max3100_dowork(s);
+       mod_timer(&s->timer, jiffies + uart_poll_timeout(&s->port));
 }
 
 static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx)
@@ -342,8 +334,7 @@ static void max3100_enable_ms(struct uart_port *port)
                                              struct max3100_port,
                                              port);
 
-       if (s->poll_time > 0)
-               mod_timer(&s->timer, jiffies);
+       mod_timer(&s->timer, jiffies);
        dev_dbg(&s->spi->dev, "%s\n", __func__);
 }
 
@@ -526,9 +517,7 @@ max3100_set_termios(struct uart_port *port, struct ktermios *termios,
                        MAX3100_STATUS_PE | MAX3100_STATUS_FE |
                        MAX3100_STATUS_OE;
 
-       if (s->poll_time > 0)
-               del_timer_sync(&s->timer);
-
+       del_timer_sync(&s->timer);
        uart_update_timeout(port, termios->c_cflag, baud);
 
        spin_lock(&s->conf_lock);
@@ -556,8 +545,7 @@ static void max3100_shutdown(struct uart_port *port)
 
        s->force_end_work = 1;
 
-       if (s->poll_time > 0)
-               del_timer_sync(&s->timer);
+       del_timer_sync(&s->timer);
 
        if (s->workqueue) {
                destroy_workqueue(s->workqueue);
@@ -769,9 +757,6 @@ static int max3100_probe(struct spi_device *spi)
        pdata = dev_get_platdata(&spi->dev);
        max3100s[i]->crystal = pdata->crystal;
        max3100s[i]->loopback = pdata->loopback;
-       max3100s[i]->poll_time = msecs_to_jiffies(pdata->poll_time);
-       if (pdata->poll_time > 0 && max3100s[i]->poll_time == 0)
-               max3100s[i]->poll_time = 1;
        max3100s[i]->minor = i;
        timer_setup(&max3100s[i]->timer, max3100_timeout, 0);