From patchwork Mon Oct 16 23:10:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10010081 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 B744E60230 for ; Mon, 16 Oct 2017 23:11:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A73EF284FC for ; Mon, 16 Oct 2017 23:11:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A5C62859E; Mon, 16 Oct 2017 23:11:14 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable 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 2BB72284FC for ; Mon, 16 Oct 2017 23:11:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932813AbdJPXK6 (ORCPT ); Mon, 16 Oct 2017 19:10:58 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:43970 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932776AbdJPXKz (ORCPT ); Mon, 16 Oct 2017 19:10:55 -0400 Received: by mail-pg0-f54.google.com with SMTP id s75so7171783pgs.0 for ; Mon, 16 Oct 2017 16:10:55 -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=oBW+b1nyMOcoNbiv6RdUD/stwzWQO2seHYWkND4XEC4=; b=YuTFTwKe4BSEzmD0nguVv8QzKloQNmPgGLdAeVtwQN8KnzJ40cxr8zmhJNmqAUDNX7 zw7XGDw09b7q1ToSVe/g9QTSWe/gy//pnA0hTPOn0MR+jYpj82iHt11R3LzYtdZuNeJ6 bscPCkhDifAFYhGIkf8Pyh0VpbBVeTnUJDOT8= 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=oBW+b1nyMOcoNbiv6RdUD/stwzWQO2seHYWkND4XEC4=; b=Z2cR4h5ggYNQ9QL5kAyOryswKeLJt2uGFbuCPnsyrVmw8HipvVfkPa6c6RGk+yIOiu PQQrLaPCiwhPCdxtJVmZ56Mqr7W++y98jZeaCKryL6xCOzvDQho2IkscoNvqjvVwGDck Vkk+Xfts3HtErahQ+rvcfcvyXcovqTDPHWaeKjVDF/Sm0W4IbOnrxZTmdjbwM2GN/kq8 BJZ3oz+V00v7gwp3gLNmI8PjwMYS4XyAuVokE9g+wcuU1YlyhUfi1YUX/M9wbtqX19V2 BShUqA3juc+v3NSxxjsQ9MyN1OP0rFx2y4SIBDEAlMBRaT/1USZmH075EqefWvmRnLy8 LlSQ== X-Gm-Message-State: AMCzsaWahm5uKJqiM43T0lKtojLmTNiWd5zzyyewZlJm5JG6tbJ2tquB DcpzIJWHD1PEs73RL6DXHaXdIA== X-Google-Smtp-Source: AOwi7QDVo60vdgmdR1WSeNQEdWNgXy47bA3iZfyZTnlBuCMdRYp91xyc/lh5gyu8WNRc3l0ApI7Cqw== X-Received: by 10.99.3.21 with SMTP id 21mr9142268pgd.77.1508195454952; Mon, 16 Oct 2017 16:10:54 -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 c9sm12630233pfj.76.2017.10.16.16.10.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 16:10:53 -0700 (PDT) Date: Mon, 16 Oct 2017 16:10:53 -0700 From: Kees Cook To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: tvaudio: Convert timers to use timer_setup() Message-ID: <20171016231053.GA99808@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. Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Signed-off-by: Kees Cook --- drivers/media/i2c/tvaudio.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/tvaudio.c b/drivers/media/i2c/tvaudio.c index ce86534450ac..16a1e08ce06c 100644 --- a/drivers/media/i2c/tvaudio.c +++ b/drivers/media/i2c/tvaudio.c @@ -300,9 +300,9 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd) * if available, ... */ -static void chip_thread_wake(unsigned long data) +static void chip_thread_wake(struct timer_list *t) { - struct CHIPSTATE *chip = (struct CHIPSTATE*)data; + struct CHIPSTATE *chip = from_timer(chip, t, wt); wake_up_process(chip->thread); } @@ -1995,7 +1995,7 @@ static int tvaudio_probe(struct i2c_client *client, const struct i2c_device_id * v4l2_ctrl_handler_setup(&chip->hdl); chip->thread = NULL; - init_timer(&chip->wt); + timer_setup(&chip->wt, chip_thread_wake, 0); if (desc->flags & CHIP_NEED_CHECKMODE) { if (!desc->getrxsubchans || !desc->setaudmode) { /* This shouldn't be happen. Warn user, but keep working @@ -2005,8 +2005,6 @@ static int tvaudio_probe(struct i2c_client *client, const struct i2c_device_id * return 0; } /* start async thread */ - chip->wt.function = chip_thread_wake; - chip->wt.data = (unsigned long)chip; chip->thread = kthread_run(chip_thread, chip, "%s", client->name); if (IS_ERR(chip->thread)) {