From patchwork Thu Oct 5 00:53:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9986221 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 AC96F605A8 for ; Thu, 5 Oct 2017 00:58:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EB7D28C44 for ; Thu, 5 Oct 2017 00:58:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9169228C43; Thu, 5 Oct 2017 00:58:15 +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 073BF28C43 for ; Thu, 5 Oct 2017 00:58:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751914AbdJEAxQ (ORCPT ); Wed, 4 Oct 2017 20:53:16 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:52905 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752943AbdJEAxI (ORCPT ); Wed, 4 Oct 2017 20:53:08 -0400 Received: by mail-pf0-f179.google.com with SMTP id a1so3900138pfj.9 for ; Wed, 04 Oct 2017 17:53:08 -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=3o6JgdKbvefjRg7/aX26W679qt2CxLIF1rYbtYfmBgY=; b=Jkeuoy+JqztTSA+ZBIN017p9mmiODPFdNNSAaevaAF8d/vBcggN/iVAxbvF2sU0dse /o89vBQ5DZejONlxbs/tdkXnfBVBp62Jk7Z6eHYLunqXJOJAmg3VoFykBIVR9NZV6mmt 4mz9erITTatHjtbINNYC0Cs+oTZgJP453H97k= 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=3o6JgdKbvefjRg7/aX26W679qt2CxLIF1rYbtYfmBgY=; b=BMlKdl13RDtMuPyb+Y2oNvOtR8H4ZIHXdXM9vUpy0Wissmuhj7h5oHy0UuGmDQZUlG rnuLl2m/mQOLUxNkPU7thJLZ9pQnfSpWkkWcZfFgFdZxZiV42/NvjnwzwI0z0LCuMcML /QDPk7cjtWtt/dZ+4pIiE1mTpRFRhuaxz1KNT4+kYu4cjz2zm9or+aROqW7R7PAN9MuA HA3bvxBnK+7WUiTSnbGOPs6uDrUknFEiMk0iusECuq+g7LFxiqgPYT7yQexlLmMH42s/ B5kBQkF1b9F16owuj1M2Joo/zjsvaWmkZnl/2Y69flEKvpeZzIxCY/n/ibInLjGGmRn7 lAEw== X-Gm-Message-State: AHPjjUhgjgwUBL8Al9ROsIDRP+AX9oqSgSPkx40yKzNPPkLG28OudHVU ue2VI7RiKJCv8KimaGfHvmw8iw== X-Google-Smtp-Source: AOwi7QCUiXhmQ2vpPFX8DwHFDUM9StfWBP01CDyIZgvf+kW2vOvCrE1YwTCF0Kbd1UpOHf29ZlpkBw== X-Received: by 10.101.89.11 with SMTP id f11mr20067831pgu.393.1507164788325; Wed, 04 Oct 2017 17:53:08 -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 q13sm25097138pgt.87.2017.10.04.17.53.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:53:07 -0700 (PDT) Date: Wed, 4 Oct 2017 17:53:06 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Hans Verkuil , Mauro Carvalho Chehab , linux-media@vger.kernel.org, Thomas Gleixner Subject: [PATCH] media: saa7146: Convert timers to use timer_setup() Message-ID: <20171005005306.GA23710@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 Cc: Thomas Gleixner Signed-off-by: Kees Cook --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- 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 f65c0b934c22..0f7599ad4958 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 37b4654dc21c..ed9b5300dcce 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 fbe36d05fb79..b1f25240968f 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);