From patchwork Tue Oct 24 15:16:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10025993 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 5485060375 for ; Wed, 25 Oct 2017 07:50:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 427FB28AF1 for ; Wed, 25 Oct 2017 07:50:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3522628B05; Wed, 25 Oct 2017 07:50:04 +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 CBE2E28AF1 for ; Wed, 25 Oct 2017 07:50:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EF3D66E624; Wed, 25 Oct 2017 07:49:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 519FC6E544 for ; Tue, 24 Oct 2017 15:16:51 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id s2so14774406pge.10 for ; Tue, 24 Oct 2017 08:16:51 -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=N8KSwhdYOJsqYtP8Ea6kKpImJDL42l/n6XG4Q8IncAE=; b=EdN9BzBTEZeSr+UAwiF9MvwOlavVR3FWmJKerXOJgcaYuwRvDOd6BMgfClWF0C79Y0 22Xrd0WrBM8DRygmBxEXBr5r4jOjwSjcL+kFMxeScLjgB5QqYHYDFZTipzC+AvUqxiDS QcRE23j1GM8RluS/iKFom4/zu81dixP1J6xS4= 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=N8KSwhdYOJsqYtP8Ea6kKpImJDL42l/n6XG4Q8IncAE=; b=S4pbbsnZR86Q7wJTnLxfwQHXsa/OqKhaFBlb9WGU+UT1TifR5n7PM/CdqLvUvpZtHG BWtmXjiT/NaMT523tqQyWpd5WE+fz0Eozwc9saSumFZguZJTbNDwAz8FW3zCFQATDXW7 n0tgfDjyuIYwaRJRKf7m+zGdt/r7x5eqx5BYyTGHtrwV5okafoRz4EGy2s83AI/3hywK hZNvqzi0OUeYiAmsZLhvNFdv1k8ucpH8pscS30GxwRjfwNFb3QR6P8KFMQOioDE53/EZ dvfn6yqBIdEXpoBdRJucHpIN+cWDXq8U+YdKoSG00AS7e4SMn22XRgPvxArLFmNuzSsT tHyw== X-Gm-Message-State: AMCzsaVqfh/cjgmDsRT9gF1FH1vfdRUnw6ey3IraH5DdpXX3mciiIIh1 H4RmYTh97c/wkcWCcyQmcNjbgQ== X-Google-Smtp-Source: ABhQp+ScMr5SF530c/vhAvskl1LQ+c28AwQoeasrygXk96eHSxuL4ahje3DrYAIGeklIGXZQWndDWg== X-Received: by 10.84.240.1 with SMTP id y1mr13138063plk.360.1508858210858; Tue, 24 Oct 2017 08:16:50 -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 t18sm1186225pfi.98.2017.10.24.08.16.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 08:16:49 -0700 (PDT) Date: Tue, 24 Oct 2017 08:16:48 -0700 From: Kees Cook To: Eric Anholt Subject: [PATCH] drm/vc4: Convert timers to use timer_setup() Message-ID: <20171024151648.GA104538@beast> MIME-Version: 1.0 Content-Disposition: inline X-Mailman-Approved-At: Wed, 25 Oct 2017 07:49:22 +0000 Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org 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. Cc: Eric Anholt Cc: David Airlie Cc: dri-devel@lists.freedesktop.org Signed-off-by: Kees Cook --- drivers/gpu/drm/vc4/vc4_bo.c | 9 +++------ drivers/gpu/drm/vc4/vc4_gem.c | 10 ++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c index 3afdbf4bc10b..ee07e072cd2a 100644 --- a/drivers/gpu/drm/vc4/vc4_bo.c +++ b/drivers/gpu/drm/vc4/vc4_bo.c @@ -461,10 +461,9 @@ static void vc4_bo_cache_time_work(struct work_struct *work) mutex_unlock(&vc4->bo_lock); } -static void vc4_bo_cache_time_timer(unsigned long data) +static void vc4_bo_cache_time_timer(struct timer_list *t) { - struct drm_device *dev = (struct drm_device *)data; - struct vc4_dev *vc4 = to_vc4_dev(dev); + struct vc4_dev *vc4 = from_timer(vc4, t, bo_cache.time_timer); schedule_work(&vc4->bo_cache.time_work); } @@ -768,9 +767,7 @@ int vc4_bo_cache_init(struct drm_device *dev) INIT_LIST_HEAD(&vc4->bo_cache.time_list); INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work); - setup_timer(&vc4->bo_cache.time_timer, - vc4_bo_cache_time_timer, - (unsigned long)dev); + timer_setup(&vc4->bo_cache.time_timer, vc4_bo_cache_time_timer, 0); return 0; } diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index d0c6bfb68c4e..ce6bca06f937 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c @@ -281,10 +281,10 @@ vc4_reset_work(struct work_struct *work) } static void -vc4_hangcheck_elapsed(unsigned long data) +vc4_hangcheck_elapsed(struct timer_list *t) { - struct drm_device *dev = (struct drm_device *)data; - struct vc4_dev *vc4 = to_vc4_dev(dev); + struct vc4_dev *vc4 = from_timer(vc4, t, hangcheck.timer); + struct drm_device *dev = vc4->dev; uint32_t ct0ca, ct1ca; unsigned long irqflags; struct vc4_exec_info *bin_exec, *render_exec; @@ -1091,9 +1091,7 @@ vc4_gem_init(struct drm_device *dev) spin_lock_init(&vc4->job_lock); INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work); - setup_timer(&vc4->hangcheck.timer, - vc4_hangcheck_elapsed, - (unsigned long)dev); + timer_setup(&vc4->hangcheck.timer, vc4_hangcheck_elapsed, 0); INIT_WORK(&vc4->job_done_work, vc4_job_done_work);