From patchwork Tue Oct 24 15:23:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10024875 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 3DFE160375 for ; Tue, 24 Oct 2017 15:24:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ECB120072 for ; Tue, 24 Oct 2017 15:24:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21E5020416; Tue, 24 Oct 2017 15:24:27 +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 1EAB520072 for ; Tue, 24 Oct 2017 15:24:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932365AbdJXPX5 (ORCPT ); Tue, 24 Oct 2017 11:23:57 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:45588 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932505AbdJXPXF (ORCPT ); Tue, 24 Oct 2017 11:23:05 -0400 Received: by mail-pg0-f67.google.com with SMTP id b192so14800589pga.2 for ; Tue, 24 Oct 2017 08:23:05 -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=WQ/2Hzu9oFnmxGX6plbOu53XmfzW9jWxE42jVsHid5A=; b=hdGbyt4VVzZUs2gynt0xILgxm23/GSrNnTZ3WJmHQM/s0kGBsEPUMBN1bw2nGzSFNu RR0YkNVrHojkrwuiKpOmb4QEegXbswqE9+qvB5TpW1qj9XjwKEmd5POFI7wqCIhKANP1 wX/nnEqoZOhMnCNjSDhY16Y6R8usWd7Q/Epac= 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=WQ/2Hzu9oFnmxGX6plbOu53XmfzW9jWxE42jVsHid5A=; b=DtavJD0CORFzV3fa5ZoX9Al7TsuOmPb3njqpmqeM2Nkc54RrD0nKseZFfFL8QW3dqx pRea4CbRoNksscYPnG2pgkH19D4OXSmYyp5EzWKbRqvsMSS0fdDTxMee0liRuuOWtbYy bDD3P3IOvI7F5YbE/Zzts05HXzfAhXVcdpEOSeKMdBNck+F5vmShoz3MSQ4pCCWSLaSp EjnfulyuzpOSCs9gor5S6+iG1QSnG3USFLzv1oNrBHweEnLRHHpgbAWcDBQ7h3m97fhC FkUEAM5JXkUFXEJyB8ZRibMHxkygN2dwkQzNDEdcGvjtdPxgjqMyWtZlWQCBdyiqUxum waWQ== X-Gm-Message-State: AMCzsaUlTHzSa+HbWQx9zkrMnbP16Y46QEt0Ko13mLAHpzH+mxIupsaz ZKAlOsVp9j9Pb2pWBWQg6QRZdw== X-Google-Smtp-Source: ABhQp+R+tv/rCnHFUpCGGAv48e87XqyS7bktAO5eF6a+UFSuOQ8ovhVYJUoJ9p/ER+LBUydonGqemA== X-Received: by 10.98.74.149 with SMTP id c21mr16747180pfj.200.1508858585308; Tue, 24 Oct 2017 08:23:05 -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 62sm1090112pfw.129.2017.10.24.08.23.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 08:23:04 -0700 (PDT) Date: Tue, 24 Oct 2017 08:23:03 -0700 From: Kees Cook To: Mauro Carvalho Chehab Cc: Hans Verkuil , "David S. Miller" , Johannes Berg , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: radio: Convert timers to use timer_setup() Message-ID: <20171024152303.GA104951@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: "David S. Miller" Cc: Johannes Berg Cc: linux-media@vger.kernel.org Signed-off-by: Kees Cook --- drivers/media/radio/radio-cadet.c | 7 +++---- drivers/media/radio/wl128x/fmdrv_common.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index 6888b7db449d..7575e5370a49 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c @@ -281,9 +281,9 @@ static bool cadet_has_rds_data(struct cadet *dev) } -static void cadet_handler(unsigned long data) +static void cadet_handler(struct timer_list *t) { - struct cadet *dev = (void *)data; + struct cadet *dev = from_timer(dev, t, readtimer); /* Service the RDS fifo */ if (mutex_trylock(&dev->lock)) { @@ -309,7 +309,6 @@ static void cadet_handler(unsigned long data) /* * Clean up and exit */ - setup_timer(&dev->readtimer, cadet_handler, data); dev->readtimer.expires = jiffies + msecs_to_jiffies(50); add_timer(&dev->readtimer); } @@ -318,7 +317,7 @@ static void cadet_start_rds(struct cadet *dev) { dev->rdsstat = 1; outb(0x80, dev->io); /* Select RDS fifo */ - setup_timer(&dev->readtimer, cadet_handler, (unsigned long)dev); + timer_setup(&dev->readtimer, cadet_handler, 0); dev->readtimer.expires = jiffies + msecs_to_jiffies(50); add_timer(&dev->readtimer); } diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c index ab3428bf63fe..800d69c3f80b 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.c +++ b/drivers/media/radio/wl128x/fmdrv_common.c @@ -543,13 +543,13 @@ static inline void fm_irq_common_cmd_resp_helper(struct fmdev *fmdev, u8 stage) * interrupt process. Therefore reset stage index to re-enable default * interrupts. So that next interrupt will be processed as usual. */ -static void int_timeout_handler(unsigned long data) +static void int_timeout_handler(struct timer_list *t) { struct fmdev *fmdev; struct fm_irq *fmirq; fmdbg("irq: timeout,trying to re-enable fm interrupts\n"); - fmdev = (struct fmdev *)data; + fmdev = from_timer(fmdev, t, irq_info.timer); fmirq = &fmdev->irq_info; fmirq->retry++; @@ -1550,8 +1550,7 @@ int fmc_prepare(struct fmdev *fmdev) atomic_set(&fmdev->tx_cnt, 1); fmdev->resp_comp = NULL; - setup_timer(&fmdev->irq_info.timer, &int_timeout_handler, - (unsigned long)fmdev); + timer_setup(&fmdev->irq_info.timer, int_timeout_handler, 0); /*TODO: add FM_STIC_EVENT later */ fmdev->irq_info.mask = FM_MAL_EVENT;