From patchwork Tue Oct 24 08:22:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10023639 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 23048601E8 for ; Tue, 24 Oct 2017 08:22:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1484F2838F for ; Tue, 24 Oct 2017 08:22:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0938F289A9; Tue, 24 Oct 2017 08:22:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 871C62838F for ; Tue, 24 Oct 2017 08:22:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751820AbdJXIWR (ORCPT ); Tue, 24 Oct 2017 04:22:17 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:54818 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473AbdJXIWP (ORCPT ); Tue, 24 Oct 2017 04:22:15 -0400 Received: by mail-pf0-f196.google.com with SMTP id n89so19125219pfk.11 for ; Tue, 24 Oct 2017 01:22:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=Jisf8BAegshulqItyu7TA7CwvjuZ7mPZ2esF1vZCIDY=; b=P/nokfSJSl5joagVkV0Ekj+0tQDGsv9TLZhwfh+E9ti4crVFsYp96CsuV0yfv/8ooC 974uR3Gxf/M3/kZcDJSP7pdUs38+xQDjD+RY2+yIvjaVEIg+W19Lx5nva6Uolaxs/f0D g7zuqTxueL9uicHeD4KUprw0Q/eIdJRuQsjx8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=Jisf8BAegshulqItyu7TA7CwvjuZ7mPZ2esF1vZCIDY=; b=hTkOJ0BY9Pu3gzqtrJMFbkQzqvwAXRLdSsZbq9s2ZSQsf2aazQUKUf4QRp5biDrlG3 PY3CaX35/5ZLKUKMlIIvI9Wk7D1vUfArd45PckTrxLkTyH3cOH/3V60NTd+0tkNmgQpW /SkGZhlqvU7EwLbZZqaZ5mxthkKUFg8xoSvF/PgoWPgq1YHmGV9a9+GLe9REUOrn8IHC byu7S9Q5SaX9FS7lByA/a2k9kHkgio0149dTsTAxtxYmdnPjl8KheRDbPc6ao20e7HF2 I1Ufuq0aM7AI1u/LMWoNNc+UPyjrwPHNa4hctj+/Q9oVgL4oBgQeAZdzT1lBusO2Soja aY2Q== X-Gm-Message-State: AMCzsaX9XvtFxwJCYaTtto2hJU7A4QNbjMjgKLrwfSYWbaHBqUcct38q do4Abo5BnLzOmjE+RJd+5zQxGQ== X-Google-Smtp-Source: ABhQp+R4X4xibghqXJCwKUeZLYQfHUsuSKV4cMfWFSzQtfmxFgpllHjdbjVN8yiT4so7JMQ6ruoADA== X-Received: by 10.98.233.20 with SMTP id j20mr15917433pfh.281.1508833335237; Tue, 24 Oct 2017 01:22:15 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id d6sm13184656pfc.24.2017.10.24.01.22.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 01:22:12 -0700 (PDT) Date: Tue, 24 Oct 2017 01:22:11 -0700 From: Kees Cook To: Sakari Ailus Cc: Greg Kroah-Hartman , Mauro Carvalho Chehab , Hans Verkuil , Arvind Yadav , Chen Guanqiao , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: atomisp: i2c: Convert timers to use timer_setup() Message-ID: <20171024082211.GA49652@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Kees Cook --- drivers/staging/media/atomisp/i2c/lm3554.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/lm3554.c b/drivers/staging/media/atomisp/i2c/lm3554.c index 679176f7c542..a815f208409f 100644 --- a/drivers/staging/media/atomisp/i2c/lm3554.c +++ b/drivers/staging/media/atomisp/i2c/lm3554.c @@ -171,10 +171,9 @@ static int lm3554_set_config1(struct lm3554 *flash) /* ----------------------------------------------------------------------------- * Hardware trigger */ -static void lm3554_flash_off_delay(long unsigned int arg) +static void lm3554_flash_off_delay(struct timer_list *t) { - struct v4l2_subdev *sd = i2c_get_clientdata((struct i2c_client *)arg); - struct lm3554 *flash = to_lm3554(sd); + struct lm3554 *flash = from_timer(flash, t, flash_off_delay); struct lm3554_platform_data *pdata = flash->pdata; gpio_set_value(pdata->gpio_strobe, 0); @@ -915,8 +914,7 @@ static int lm3554_probe(struct i2c_client *client, mutex_init(&flash->power_lock); - setup_timer(&flash->flash_off_delay, lm3554_flash_off_delay, - (unsigned long)client); + timer_setup(&flash->flash_off_delay, lm3554_flash_off_delay, 0); err = lm3554_gpio_init(client); if (err) {