From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756777AbdJPXKb (ORCPT ); Mon, 16 Oct 2017 19:10:31 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:53741 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932760AbdJPXK3 (ORCPT ); Mon, 16 Oct 2017 19:10:29 -0400 X-Google-Smtp-Source: ABhQp+R9dI3eu0FYv0yMUSYRQMWi48Cg0RfQcmZfshOuSSpuof2HbICfl511+wQPxtJjUDElNqeL7g== Date: Mon, 16 Oct 2017 16:10:27 -0700 From: Kees Cook To: Mauro Carvalho Chehab Cc: Mats Randgaard , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: tc358743: Convert timers to use timer_setup() Message-ID: <20171016231027.GA99719@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: Mats Randgaard Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Signed-off-by: Kees Cook --- drivers/media/i2c/tc358743.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index a9355032076f..359f63d7dfca 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -1481,9 +1481,9 @@ static irqreturn_t tc358743_irq_handler(int irq, void *dev_id) return handled ? IRQ_HANDLED : IRQ_NONE; } -static void tc358743_irq_poll_timer(unsigned long arg) +static void tc358743_irq_poll_timer(struct timer_list *t) { - struct tc358743_state *state = (struct tc358743_state *)arg; + struct tc358743_state *state = from_timer(state, t, timer); unsigned int msecs; schedule_work(&state->work_i2c_poll); @@ -2147,8 +2147,7 @@ static int tc358743_probe(struct i2c_client *client, } else { INIT_WORK(&state->work_i2c_poll, tc358743_work_i2c_poll); - setup_timer(&state->timer, tc358743_irq_poll_timer, - (unsigned long)state); + timer_setup(&state->timer, tc358743_irq_poll_timer, 0); state->timer.expires = jiffies + msecs_to_jiffies(POLL_INTERVAL_MS); add_timer(&state->timer); -- 2.7.4 -- Kees Cook Pixel Security