From patchwork Mon Oct 16 23:10:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10010085 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 526CE60230 for ; Mon, 16 Oct 2017 23:11:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44327284FC for ; Mon, 16 Oct 2017 23:11:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38FE52859E; Mon, 16 Oct 2017 23:11:30 +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=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 B3D8A284FC for ; Mon, 16 Oct 2017 23:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932780AbdJPXKr (ORCPT ); Mon, 16 Oct 2017 19:10:47 -0400 Received: from mail-pg0-f51.google.com ([74.125.83.51]:46577 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932777AbdJPXKp (ORCPT ); Mon, 16 Oct 2017 19:10:45 -0400 Received: by mail-pg0-f51.google.com with SMTP id k7so8016266pga.3 for ; Mon, 16 Oct 2017 16:10:45 -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=MDcxwr2rH8ZrFaftxddd5SpNPidlVqtLD4wgB4/Mr8c=; b=SQDFJ+FtvK1ozeg4qarvzTI9BV6OL+pDSEbpttFzsmCCvBtFZWZ3cj4Jwi5V3QxKn1 iDmB4NtujxK1v1T2uboWJmocYzE52OO5aYJ/9QnQB5bDCg0bgRGtgXZxxQyASvCplkrZ 0QMAU6B/+Xe6DTy5SvmkkUSM1xdpyZar1m3iM= 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=MDcxwr2rH8ZrFaftxddd5SpNPidlVqtLD4wgB4/Mr8c=; b=HxPAfHlks0Y/WiBAzFn7YPsIGlm2GyBBCxyaJje1i3aaILn3fJdVPXre/tovUE/W5z tZcukxc9hUT/g7BHjQvZup/FwQjDz4SFYxAA8T7Xl/H5kkX++EfqbwkFJB8HRSlthE+d QjQBvxL6DwQpE0cZVbFMbNX3rF1iYbn02bI16zXCkwNGsDoGnY76pyVsqih8caBzL7d1 WxnfHZCTd2OEQc63Lx27ZCREs9NpXHI5NWLRUxRw/UEglZ7/zGudxZG6A0L/KrEoEqGy prAk/lELpfb7FPsKhZFGFi26Oet4Kyq/v78V6bOD2z2OFXU8I8ncNQrqu7F2R6Eh61/3 OOug== X-Gm-Message-State: AMCzsaWNpPOiCh37rNE7zU+cMxmATRMeUGxwYoAHmp2dn3RFrWf8hhGe RjzjczEo5BbMo6YKHvbn97SNDA== X-Google-Smtp-Source: AOwi7QB8DsRU0Wkh+TK/dq29JxopfHMSkyHn5dsZTj8NLXYTe0v7PGje/AqXOWNdGPOzGGraQs/PDg== X-Received: by 10.84.218.14 with SMTP id q14mr10610879pli.111.1508195444799; Mon, 16 Oct 2017 16:10:44 -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 j68sm7519075pgc.6.2017.10.16.16.10.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 16:10:43 -0700 (PDT) Date: Mon, 16 Oct 2017 16:10:42 -0700 From: Kees Cook To: Mauro Carvalho Chehab Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: saa7146: Convert timers to use timer_setup() Message-ID: <20171016231042.GA99769@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: Hans Verkuil Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Signed-off-by: Kees Cook --- drivers/media/common/saa7146/saa7146_fops.c | 4 ++-- drivers/media/common/saa7146/saa7146_vbi.c | 3 +-- drivers/media/common/saa7146/saa7146_video.c | 3 +-- include/media/drv-intf/saa7146_vv.h | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c index c4664f0da874..8c87d6837c49 100644 --- a/drivers/media/common/saa7146/saa7146_fops.c +++ b/drivers/media/common/saa7146/saa7146_fops.c @@ -163,9 +163,9 @@ void saa7146_buffer_next(struct saa7146_dev *dev, } } -void saa7146_buffer_timeout(unsigned long data) +void saa7146_buffer_timeout(struct timer_list *t) { - struct saa7146_dmaqueue *q = (struct saa7146_dmaqueue*)data; + struct saa7146_dmaqueue *q = from_timer(q, t, timeout); struct saa7146_dev *dev = q->dev; unsigned long flags; diff --git a/drivers/media/common/saa7146/saa7146_vbi.c b/drivers/media/common/saa7146/saa7146_vbi.c index ae66c2325228..7fa3147c2d7e 100644 --- a/drivers/media/common/saa7146/saa7146_vbi.c +++ b/drivers/media/common/saa7146/saa7146_vbi.c @@ -366,8 +366,7 @@ static void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv) INIT_LIST_HEAD(&vv->vbi_dmaq.queue); - setup_timer(&vv->vbi_dmaq.timeout, saa7146_buffer_timeout, - (unsigned long)(&vv->vbi_dmaq)); + timer_setup(&vv->vbi_dmaq.timeout, saa7146_buffer_timeout, 0); vv->vbi_dmaq.dev = dev; init_waitqueue_head(&vv->vbi_wq); diff --git a/drivers/media/common/saa7146/saa7146_video.c b/drivers/media/common/saa7146/saa7146_video.c index 51eeed830de4..2b631eaa65b3 100644 --- a/drivers/media/common/saa7146/saa7146_video.c +++ b/drivers/media/common/saa7146/saa7146_video.c @@ -1201,8 +1201,7 @@ static void video_init(struct saa7146_dev *dev, struct saa7146_vv *vv) { INIT_LIST_HEAD(&vv->video_dmaq.queue); - setup_timer(&vv->video_dmaq.timeout, saa7146_buffer_timeout, - (unsigned long)(&vv->video_dmaq)); + timer_setup(&vv->video_dmaq.timeout, saa7146_buffer_timeout, 0); vv->video_dmaq.dev = dev; /* set some default values */ diff --git a/include/media/drv-intf/saa7146_vv.h b/include/media/drv-intf/saa7146_vv.h index 926c5b145279..17bbe3851d75 100644 --- a/include/media/drv-intf/saa7146_vv.h +++ b/include/media/drv-intf/saa7146_vv.h @@ -184,7 +184,7 @@ int saa7146_unregister_device(struct video_device *vid, struct saa7146_dev *dev) void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state); void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); -void saa7146_buffer_timeout(unsigned long data); +void saa7146_buffer_timeout(struct timer_list *t); void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q, struct saa7146_buf *buf);