tty: amba-pl011: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Mon, 16 Oct 2017 23:28:45 +0000 (16:28 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Oct 2017 12:06:46 +0000 (14:06 +0200)
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: linux-serial@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/amba-pl011.c

index 111e6a9..dab3636 100644 (file)
@@ -1078,9 +1078,9 @@ static inline void pl011_dma_rx_stop(struct uart_amba_port *uap)
  * Every polling, It checks the residue in the dma buffer and transfer
  * data to the tty. Also, last_residue is updated for the next polling.
  */
-static void pl011_dma_rx_poll(unsigned long args)
+static void pl011_dma_rx_poll(struct timer_list *t)
 {
-       struct uart_amba_port *uap = (struct uart_amba_port *)args;
+       struct uart_amba_port *uap = from_timer(uap, t, dmarx.timer);
        struct tty_port *port = &uap->port.state->port;
        struct pl011_dmarx_data *dmarx = &uap->dmarx;
        struct dma_chan *rxchan = uap->dmarx.chan;
@@ -1192,9 +1192,7 @@ skip_rx:
                        dev_dbg(uap->port.dev, "could not trigger initial "
                                "RX DMA job, fall back to interrupt mode\n");
                if (uap->dmarx.poll_rate) {
-                       init_timer(&(uap->dmarx.timer));
-                       uap->dmarx.timer.function = pl011_dma_rx_poll;
-                       uap->dmarx.timer.data = (unsigned long)uap;
+                       timer_setup(&uap->dmarx.timer, pl011_dma_rx_poll, 0);
                        mod_timer(&uap->dmarx.timer,
                                jiffies +
                                msecs_to_jiffies(uap->dmarx.poll_rate));