From patchwork Mon Oct 16 23:10:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10010083 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 5282B60230 for ; Mon, 16 Oct 2017 23:11:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44ECB284FC for ; Mon, 16 Oct 2017 23:11:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39F922859E; Mon, 16 Oct 2017 23:11:23 +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 E7C86284FC for ; Mon, 16 Oct 2017 23:11:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932796AbdJPXKx (ORCPT ); Mon, 16 Oct 2017 19:10:53 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:47588 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932794AbdJPXKu (ORCPT ); Mon, 16 Oct 2017 19:10:50 -0400 Received: by mail-pg0-f54.google.com with SMTP id r25so8021852pgn.4 for ; Mon, 16 Oct 2017 16:10:50 -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=lb+vPcDk6CKAjsyPE0oym9/I8v9Opo+BECJDDazY8Gg=; b=kzWeHDA1i5ubD79HId1AlTUEpew33GFD592m4m8YquLUxO1QsEUTe3+ujla2pMUAT3 RoDjaPvJbgG2XpNDqt4jBcYrV1X6v/QSCsiM6iU9/tE+GquIT/ag6NMuAx76o9nxdlVL TCewAoOMSnqwvi6owBoSne6FrupxOfNJxbtFw= 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=lb+vPcDk6CKAjsyPE0oym9/I8v9Opo+BECJDDazY8Gg=; b=BChMPVkvzYe1wJWJtH9PnZhMHpmQAg8x+xxslkuPEFW+YhuHyUYJl2XFd4WAV6cxwg SB+X8I07Xx1LslAPPnUu3Q4p74vu2Yv+FDwnnaBLXnDQlNrWZ0/E83JEurA3fef6xJrZ nJ78hWtxv6NjiRtaxmVGR0qb0zXELPnkX3uoSaDYtemW11QGDkGJWotpkNkcjNDEafV+ tkoI8Y1vq643waiCs58dkvymRowPonIUZhqbemSmmhn104+msMb2uwITtW+7YbZxeyim H4XoU7vOABfCwYYOAGMRtN75xnSiz7I5h6py1mletXFeDAJtbpEkyP0kLfwicXVuCt2P niSA== X-Gm-Message-State: AMCzsaVK5LdXijoIuaFBQrYbHX+83vWA/IpuSIP/6T4VRtKjr3hINSIQ GqQGprxIfyNZxUGBce7mfLLOnA== X-Google-Smtp-Source: AOwi7QDZ6RPFc4rhlkiQohnIUBBWGp81JdLAJJlqqc7jCdZwI6vJeWm2qTsDE30Ng8he2WzcVs7aDw== X-Received: by 10.99.6.75 with SMTP id 72mr9293799pgg.350.1508195449716; Mon, 16 Oct 2017 16:10:49 -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 y27sm15865286pfi.107.2017.10.16.16.10.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 16:10:48 -0700 (PDT) Date: Mon, 16 Oct 2017 16:10:47 -0700 From: Kees Cook To: Mauro Carvalho Chehab Cc: devendra sharma , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: dvb-core: Convert timers to use timer_setup() Message-ID: <20171016231047.GA99788@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: devendra sharma Cc: linux-media@vger.kernel.org Signed-off-by: Kees Cook --- drivers/media/dvb-core/dmxdev.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c index 18e4230865be..3ddd44e1ee77 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -329,9 +329,9 @@ static int dvb_dmxdev_set_buffer_size(struct dmxdev_filter *dmxdevfilter, return 0; } -static void dvb_dmxdev_filter_timeout(unsigned long data) +static void dvb_dmxdev_filter_timeout(struct timer_list *t) { - struct dmxdev_filter *dmxdevfilter = (struct dmxdev_filter *)data; + struct dmxdev_filter *dmxdevfilter = from_timer(dmxdevfilter, t, timer); dmxdevfilter->buffer.error = -ETIMEDOUT; spin_lock_irq(&dmxdevfilter->dev->lock); @@ -346,8 +346,6 @@ static void dvb_dmxdev_filter_timer(struct dmxdev_filter *dmxdevfilter) del_timer(&dmxdevfilter->timer); if (para->timeout) { - dmxdevfilter->timer.function = dvb_dmxdev_filter_timeout; - dmxdevfilter->timer.data = (unsigned long)dmxdevfilter; dmxdevfilter->timer.expires = jiffies + 1 + (HZ / 2 + HZ * para->timeout) / 1000; add_timer(&dmxdevfilter->timer); @@ -754,7 +752,7 @@ static int dvb_demux_open(struct inode *inode, struct file *file) dvb_ringbuffer_init(&dmxdevfilter->buffer, NULL, 8192); dmxdevfilter->type = DMXDEV_TYPE_NONE; dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED); - init_timer(&dmxdevfilter->timer); + timer_setup(&dmxdevfilter->timer, dvb_dmxdev_filter_timeout, 0); dvbdev->users++;