From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754019AbdJaWin (ORCPT ); Tue, 31 Oct 2017 18:38:43 -0400 Received: from 19pmail.ess.barracuda.com ([64.235.150.244]:48051 "EHLO 19pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753802AbdJaWil (ORCPT ); Tue, 31 Oct 2017 18:38:41 -0400 Date: Tue, 31 Oct 2017 15:37:54 -0700 From: Paul Burton To: Kees Cook CC: Greg Kroah-Hartman , Paul Burton , Miguel Ojeda Sandonis , Subject: Re: [PATCH] auxdisplay: Convert timers to use timer_setup() Message-ID: <20171031223754.jjkfwppwrxevbc34@pburton-laptop> References: <20171025102257.GA145721@beast> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20171025102257.GA145721@beast> User-Agent: NeoMutt/20171013 X-BESS-ID: 1509489514-298553-26024-108421-3 X-BESS-VER: 2017.12-r1710252241 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.186464 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kees, On Wed, Oct 25, 2017 at 03:22:57AM -0700, Kees Cook wrote: > 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. For the whole patch: Reviewed-by: Paul Burton For the img-ascii-lcd part: Tested-by: Paul Burton Thanks, Paul > Cc: Paul Burton > Cc: Miguel Ojeda Sandonis > Signed-off-by: Kees Cook > --- > drivers/auxdisplay/img-ascii-lcd.c | 10 ++++------ > drivers/auxdisplay/panel.c | 4 ++-- > 2 files changed, 6 insertions(+), 8 deletions(-) > > diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c > index 25306fa27251..c9e32d29ec81 100644 > --- a/drivers/auxdisplay/img-ascii-lcd.c > +++ b/drivers/auxdisplay/img-ascii-lcd.c > @@ -229,9 +229,9 @@ MODULE_DEVICE_TABLE(of, img_ascii_lcd_matches); > * Scroll the current message along the LCD by one character, rearming the > * timer if required. > */ > -static void img_ascii_lcd_scroll(unsigned long arg) > +static void img_ascii_lcd_scroll(struct timer_list *t) > { > - struct img_ascii_lcd_ctx *ctx = (struct img_ascii_lcd_ctx *)arg; > + struct img_ascii_lcd_ctx *ctx = from_timer(ctx, t, timer); > unsigned int i, ch = ctx->scroll_pos; > unsigned int num_chars = ctx->cfg->num_chars; > > @@ -299,7 +299,7 @@ static int img_ascii_lcd_display(struct img_ascii_lcd_ctx *ctx, > ctx->scroll_pos = 0; > > /* update the LCD */ > - img_ascii_lcd_scroll((unsigned long)ctx); > + img_ascii_lcd_scroll(&ctx->timer); > > return 0; > } > @@ -395,9 +395,7 @@ static int img_ascii_lcd_probe(struct platform_device *pdev) > ctx->scroll_rate = HZ / 2; > > /* initialise a timer for scrolling the message */ > - init_timer(&ctx->timer); > - ctx->timer.function = img_ascii_lcd_scroll; > - ctx->timer.data = (unsigned long)ctx; > + timer_setup(&ctx->timer, img_ascii_lcd_scroll, 0); > > platform_set_drvdata(pdev, ctx); > > diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c > index 6911acd896d9..ea7869c0d7f9 100644 > --- a/drivers/auxdisplay/panel.c > +++ b/drivers/auxdisplay/panel.c > @@ -1396,7 +1396,7 @@ static void panel_process_inputs(void) > } > } > > -static void panel_scan_timer(void) > +static void panel_scan_timer(struct timer_list *unused) > { > if (keypad.enabled && keypad_initialized) { > if (spin_trylock_irq(&pprt_lock)) { > @@ -1421,7 +1421,7 @@ static void init_scan_timer(void) > if (scan_timer.function) > return; /* already started */ > > - setup_timer(&scan_timer, (void *)&panel_scan_timer, 0); > + timer_setup(&scan_timer, panel_scan_timer, 0); > scan_timer.expires = jiffies + INPUT_POLL_TIME; > add_timer(&scan_timer); > } > -- > 2.7.4 > > > -- > Kees Cook > Pixel Security