From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757489AbdJPX2t (ORCPT ); Mon, 16 Oct 2017 19:28:49 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:50494 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757405AbdJPX2r (ORCPT ); Mon, 16 Oct 2017 19:28:47 -0400 X-Google-Smtp-Source: AOwi7QBWfQXfGEQy33tRRqkMWuLxaVT/IedEczHZgas5P4rW5KxUKXjs87wHGnoSFdukn3m06sTHsA== Date: Mon, 16 Oct 2017 16:28:45 -0700 From: Kees Cook To: Greg Kroah-Hartman Cc: Russell King , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] tty: amba-pl011: Convert timers to use timer_setup() Message-ID: <20171016232845.GA101226@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: linux-serial@vger.kernel.org Signed-off-by: Kees Cook --- drivers/tty/serial/amba-pl011.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 111e6a950779..dab36369f71e 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -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 @@ static void pl011_dma_startup(struct uart_amba_port *uap) 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)); -- 2.7.4 -- Kees Cook Pixel Security