From patchwork Thu Nov 9 18:48:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10052595 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 6CA866035D for ; Fri, 10 Nov 2017 08:45:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C9CC2B263 for ; Fri, 10 Nov 2017 08:45:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 514232B26F; Fri, 10 Nov 2017 08:45:25 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D10E32B263 for ; Fri, 10 Nov 2017 08:45:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C48C26EA3E; Fri, 10 Nov 2017 08:44:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2BDB6E18F for ; Thu, 9 Nov 2017 18:48:42 +0000 (UTC) Received: by mail-pf0-x244.google.com with SMTP id b79so4892996pfk.5 for ; Thu, 09 Nov 2017 10:48:42 -0800 (PST) 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=1pdCh/fY0CdCo2X3kNSoyZfnK9+ad10J1SHJx1wdh8s=; b=OsELVE5LvF8+FljZiO2n5YonviAzTZ2IyzUJ9xJMSZ7qVMmUAVgcqKwiNZVcFFl59o 48vRYc/XkdQgVrS687IclZaNj3myZA39cooeiXH+cO7wnoGpvpxaYVQaDoX8LS4GSxzq P2n7peMTlySzbK7X6Uz4NDAzi7g9OkOfRojdY= 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=1pdCh/fY0CdCo2X3kNSoyZfnK9+ad10J1SHJx1wdh8s=; b=AK7TiGatbJ3wnqkuu9xrj34giNjDc3mC4g6rUaWIrMsR8au4DMV/ajZGSOs+OcrMAs EIe+mv/a2/ZTWCh6EF5mj9/nOESXVZf684zxIo5OZg8+iYPvsjtFSyyn5I/JY7j6P0Jm 9t4/eNE3IokeO4arIYCPy9v7UT+h580ntFY8wh8hxKIsIdGGJzAeAsolysrtN/mpHPwI agOmNoGY1KMRyVZolSgT3PXJq9zf3+EzP0ZeJZcoLCaqmKkjnANyXlTTVp+jwwAvhxD4 0nEASOFdsygfat/zl5FTvEX9lUQNRusQpbO050S91pA0NirOViWkTAbXfjPM8pGrvrO+ n8Jw== X-Gm-Message-State: AJaThX43dmCFvL42vAQlBbaNR13QFuzBXyNi7kElULWvMycMp61CdMYF c9h7sw5k/tZPAq35Hr/379ARyw== X-Google-Smtp-Source: ABhQp+Spjl2eDkAHpEYQKVTOnkJfk6M+fXA8chPIa7xFmtCmAT5xbITFPQ/7cRt0Olr/fr5Fz3Cmkg== X-Received: by 10.99.122.28 with SMTP id v28mr1314818pgc.394.1510253322497; Thu, 09 Nov 2017 10:48:42 -0800 (PST) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id a4sm15424102pfj.72.2017.11.09.10.48.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Nov 2017 10:48:41 -0800 (PST) Date: Thu, 9 Nov 2017 10:48:40 -0800 From: Kees Cook To: Bartlomiej Zolnierkiewicz Subject: [PATCH] video: fbdev: pxa3xx_gcu: Convert timers to use timer_setup() Message-ID: <20171109184840.GA115388@beast> MIME-Version: 1.0 Content-Disposition: inline X-Mailman-Approved-At: Fri, 10 Nov 2017 08:44:19 +0000 Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Himanshu Jha , dri-devel@lists.freedesktop.org, "Gustavo A. R. Silva" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. This also fixes the use of the "priv" variable in QERROR(), since it was pointing to struct timer_list, not struct pxa3xx_gcu_priv. Cc: Bartlomiej Zolnierkiewicz Cc: "Gustavo A. R. Silva" Cc: Himanshu Jha Cc: dri-devel@lists.freedesktop.org Cc: linux-fbdev@vger.kernel.org Signed-off-by: Kees Cook --- If you can take this for v4.15, please do. Otherwise, I can carry it in the timers tree in late rc1. Thanks! --- drivers/video/fbdev/pxa3xx-gcu.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c index 164fb524744a..208cd5a5e15c 100644 --- a/drivers/video/fbdev/pxa3xx-gcu.c +++ b/drivers/video/fbdev/pxa3xx-gcu.c @@ -512,24 +512,26 @@ pxa3xx_gcu_mmap(struct file *file, struct vm_area_struct *vma) #ifdef PXA3XX_GCU_DEBUG_TIMER static struct timer_list pxa3xx_gcu_debug_timer; +static struct pxa3xx_gcu_priv *debug_timer_priv; -static void pxa3xx_gcu_debug_timedout(unsigned long ptr) +static void pxa3xx_gcu_debug_timedout(struct timer_list *unused) { - struct pxa3xx_gcu_priv *priv = (struct pxa3xx_gcu_priv *) ptr; + struct pxa3xx_gcu_priv *priv = debug_timer_priv; QERROR("Timer DUMP"); - /* init the timer structure */ - setup_timer(&pxa3xx_gcu_debug_timer, pxa3xx_gcu_debug_timedout, ptr); mod_timer(&pxa3xx_gcu_debug_timer, jiffies + 5 * HZ); } -static void pxa3xx_gcu_init_debug_timer(void) +static void pxa3xx_gcu_init_debug_timer(struct pxa3xx_gcu_priv *priv) { - pxa3xx_gcu_debug_timedout((unsigned long) &pxa3xx_gcu_debug_timer); + /* init the timer structure */ + debug_timer_priv = priv; + timer_setup(&pxa3xx_gcu_debug_timer, pxa3xx_gcu_debug_timedout, 0); + pxa3xx_gcu_debug_timedout(NULL); } #else -static inline void pxa3xx_gcu_init_debug_timer(void) {} +static inline void pxa3xx_gcu_init_debug_timer(struct pxa3xx_gcu_priv *) {} #endif static int @@ -666,7 +668,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) platform_set_drvdata(pdev, priv); priv->resource_mem = r; pxa3xx_gcu_reset(priv); - pxa3xx_gcu_init_debug_timer(); + pxa3xx_gcu_init_debug_timer(priv); dev_info(dev, "registered @0x%p, DMA 0x%p (%d bytes), IRQ %d\n", (void *) r->start, (void *) priv->shared_phys,