From patchwork Mon Oct 16 23:24:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10010145 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 0823060235 for ; Mon, 16 Oct 2017 23:26:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC77B286C5 for ; Mon, 16 Oct 2017 23:26:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEE08286EF; Mon, 16 Oct 2017 23:26:07 +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 502EE286C5 for ; Mon, 16 Oct 2017 23:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932862AbdJPXZA (ORCPT ); Mon, 16 Oct 2017 19:25:00 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:55187 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932857AbdJPXY6 (ORCPT ); Mon, 16 Oct 2017 19:24:58 -0400 Received: by mail-pg0-f41.google.com with SMTP id l24so7989956pgu.11 for ; Mon, 16 Oct 2017 16:24:58 -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=BcQbIprPy591n0RHC15O8Jjg7WBXNZHLPqnzPeL2hLk=; b=bEfJdRVmu56BAAFWqzF1/teDz6KQ902TLcxI7ut15+MZEg7K2cRRFUJIQWeCTCwaac oa+uzaxom/ENZvKWfi2IXmTiWjs5L3YCfrDNGYM7VVgmBGnxCYyxwka88u/nTzKoiy3W BDpTmb5eI5CewETT+Qqb6GFYFirrb4jtfWVvo= 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=BcQbIprPy591n0RHC15O8Jjg7WBXNZHLPqnzPeL2hLk=; b=qoC+AyTI2TahqMhSlnYenq2m47mPKJyh2oYOB4TCS/vqwZyqFiPCDYtSp2i8CMO0gD LddB3ecByZAs5Pew3EuqOg4wCYk6EBhSrIX2vDvxwcizw9/T5ZIhn5V+jqmwj6lU9FE2 6rsWcITlt7iN6dPvgj+YvrvMwcmAR6vj/HE/0DTH7w18BA14CXtIfKeXOH0bNIPxkE9g PB4Jd4v/cLe+WBD3Y9yspAQfIYpMYdqYa5Ouhl2EZYViUTDK6zIeAYkYHZ4dIcMzWGNg /AUNiYChHFPV6rdWmpBVAv3i9tICNcMgJqbyQgBdYyQj1wA1MHAxUTVtF996lWpwWpG1 qOfw== X-Gm-Message-State: AMCzsaWYClIPxrIJu7U0xYVWgj4IpxmNjnkF+WsAOGtBIw1YSdZy6iyi 3WCyR3al2nxvcmZChPQ4XQlQUg== X-Google-Smtp-Source: AOwi7QBCWYtt3juN5PJgLDy2zszz8VaYBfGZPdeORJsSHiMvgfvXfnaCdjhG73ciXMZZRSza8aeiJA== X-Received: by 10.101.65.75 with SMTP id x11mr9265405pgp.388.1508196298080; Mon, 16 Oct 2017 16:24:58 -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 b2sm13429773pgt.14.2017.10.16.16.24.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 16:24:56 -0700 (PDT) Date: Mon, 16 Oct 2017 16:24:56 -0700 From: Kees Cook To: Greg Kroah-Hartman Cc: Mauro Carvalho Chehab , Alan Cox , Daeseok Youn , Arnd Bergmann , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging/atomisp: Convert timers to use timer_setup() Message-ID: <20171016232456.GA100862@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: Greg Kroah-Hartman Cc: Alan Cox Cc: Daeseok Youn Cc: Arnd Bergmann Cc: linux-media@vger.kernel.org Cc: devel@driverdev.osuosl.org Signed-off-by: Kees Cook --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c | 13 ++++--------- drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h | 6 +----- .../media/atomisp/pci/atomisp2/atomisp_compat_css20.c | 2 +- drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c | 15 +++++---------- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index b0c647f4d250..f3cf4ecba630 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -1661,20 +1661,15 @@ void atomisp_css_flush(struct atomisp_device *isp) dev_dbg(isp->dev, "atomisp css flush done\n"); } -#ifndef ISP2401 -void atomisp_wdt(unsigned long isp_addr) -#else -void atomisp_wdt(unsigned long pipe_addr) -#endif +void atomisp_wdt(struct timer_list *t) { #ifndef ISP2401 - struct atomisp_device *isp = (struct atomisp_device *)isp_addr; + struct atomisp_sub_device *asd = from_timer(asd, t, wdt); #else - struct atomisp_video_pipe *pipe = - (struct atomisp_video_pipe *)pipe_addr; + struct atomisp_video_pipe *pipe = from_timer(pipe, t, wdt); struct atomisp_sub_device *asd = pipe->asd; - struct atomisp_device *isp = asd->isp; #endif + struct atomisp_device *isp = asd->isp; #ifdef ISP2401 atomic_inc(&pipe->wdt_count); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h index 31ba4e613d13..4bb83864da2e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h @@ -85,11 +85,7 @@ static inline void __iomem *atomisp_get_io_virt_addr(unsigned int address) void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev); void atomisp_msi_irq_uninit(struct atomisp_device *isp, struct pci_dev *dev); void atomisp_wdt_work(struct work_struct *work); -#ifndef ISP2401 -void atomisp_wdt(unsigned long isp_addr); -#else -void atomisp_wdt(unsigned long pipe_addr); -#endif +void atomisp_wdt(struct timer_list *t); void atomisp_setup_flash(struct atomisp_sub_device *asd); irqreturn_t atomisp_isr(int irq, void *dev); irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index 5027fd20d966..b190f9958066 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -4526,7 +4526,7 @@ int atomisp_css_isr_thread(struct atomisp_device *isp, for (i = 0; i < isp->num_of_streams; i++) atomisp_wdt_stop(&isp->asd[i], 0); #ifndef ISP2401 - atomisp_wdt((unsigned long)isp); + atomisp_wdt(&isp->asd[0].wdt); #else queue_work(isp->wdt_work_queue, &isp->wdt_work); #endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c index e85b3819bffa..20aff7faf44a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c @@ -1150,17 +1150,12 @@ static int init_atomisp_wdts(struct atomisp_device *isp) struct atomisp_sub_device *asd = &isp->asd[i]; asd = &isp->asd[i]; #ifndef ISP2401 - setup_timer(&asd->wdt, atomisp_wdt, (unsigned long)isp); + timer_setup(&asd->wdt, atomisp_wdt, 0); #else - setup_timer(&asd->video_out_capture.wdt, - atomisp_wdt, (unsigned long)&asd->video_out_capture); - setup_timer(&asd->video_out_preview.wdt, - atomisp_wdt, (unsigned long)&asd->video_out_preview); - setup_timer(&asd->video_out_vf.wdt, - atomisp_wdt, (unsigned long)&asd->video_out_vf); - setup_timer(&asd->video_out_video_capture.wdt, - atomisp_wdt, - (unsigned long)&asd->video_out_video_capture); + timer_setup(&asd->video_out_capture.wdt, atomisp_wdt, 0); + timer_setup(&asd->video_out_preview.wdt, atomisp_wdt, 0); + timer_setup(&asd->video_out_vf.wdt, atomisp_wdt, 0); + timer_setup(&asd->video_out_video_capture.wdt, atomisp_wdt, 0); #endif } return 0;