From patchwork Tue Oct 24 08:26:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10023651 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 BAB76601E8 for ; Tue, 24 Oct 2017 08:26:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9FF8204FF for ; Tue, 24 Oct 2017 08:26:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E6B1286A3; Tue, 24 Oct 2017 08:26:52 +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.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A209204FF for ; Tue, 24 Oct 2017 08:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=E9kQGTCqbUk6oUKsMWm6e/KH38KMQrGjD8Jsp8h6gII=; b=VHVOBNmAvx3+7H D8nqk2PwVjE3e4EKI1Metmn2HyvJK9m68JVJJ8eV2VWlwTLwEfBELziTR1Maydo17SSPpxOohHYVo flsBIJsyWaCU4VPN6CQ/qAdf34jqXQHZI87pW2l2gpX7ZpCzS8oPQt5DzpJnoukKfmfgVWey0WsJH pw/dLDbM01jk1RJ5pp3+ovgRlMpAgwIYJp6nKJIT+Bb8H2qHFhiVzYWvamHEDghTzT9/geXGgS3CF yYfzUWoHN5hrxlAeEO3NH1BvGFrrJRe4zoeO0Sq9+5SaBT2k3J5eIPFVhoQaVoPx1RHZqa1+kbaoS h3/yPGyfVOUi/mhIRoBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e6uXz-0005nB-IH; Tue, 24 Oct 2017 08:26:51 +0000 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e6uXs-0005e1-77 for linux-arm-kernel@lists.infradead.org; Tue, 24 Oct 2017 08:26:47 +0000 Received: by mail-pg0-x241.google.com with SMTP id s75so13932907pgs.0 for ; Tue, 24 Oct 2017 01:26:23 -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=tGZTyqqme4b3hajfeZHr/LzfehTeC07il9Bn+GAepV0=; b=fgbeazlFCLz825UF0OvTLHDCBGYge7Fra9ZwPRct+HzAxiwGYrThJQQ/Zkw6hMcLkb uftrgOpofafwpmmGc3tQEpexepjGC2eyxsep1sx3GNzQikAmsbCpF5vAVcUJA5rFRXl5 ulxHyW2RJK/RMKVMLCMna84QcoTl1zpIMYEs4= 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=tGZTyqqme4b3hajfeZHr/LzfehTeC07il9Bn+GAepV0=; b=nRldbf5G79Y+YyRg1ejQvJaJXKgH7X5YL2RKwBKZ8x9X3Wy+zNYOZ4Ulo5YyqdiVL8 T66fGVRPM1jTTbxvzLlmiTqkhW+5uge9bqTOg/PAUtWY0VuCAKNWLkLOKz6oww0X53Ve EOJ83h9W619vaqJKyWp7oXAZiyZg2GRc99qPkHp0/B7TH9Mv3MMYs3eMNZhgxh5hcDK5 g5yqpj6Tf58ZcBJ1HmrQ246vsweO/3xgmTKV2MqErkAXdKnCGEHI/9DMMIZDHtTTcjws LwyJWCaC3wCrnXTcrUL/6OoJcxWNUQei+FDhHxJ7U8vLwqVFqM92TQ5tEHhI9g9llOe6 SAEQ== X-Gm-Message-State: AMCzsaUx2xRm/vJAq64NB7GolMpxK/ybMnC424yxt5haVqRGj2Nj1HKy 2qJKEIqLghQ5WuGtsQOu8Jko0Q== X-Google-Smtp-Source: ABhQp+RjD46ZikNr+mo3h9pGu3/A2k84gCKq63jJLGfmf9VetxqeHJ6zDItHDK+IPNE4hClfKWCTJg== X-Received: by 10.159.198.8 with SMTP id f8mr8564374plo.209.1508833583154; Tue, 24 Oct 2017 01:26:23 -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 x79sm16881495pfa.156.2017.10.24.01.26.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 01:26:22 -0700 (PDT) Date: Tue, 24 Oct 2017 01:26:21 -0700 From: Kees Cook To: Greg Kroah-Hartman Subject: [PATCH] staging: vc04_services: Convert timers to use timer_setup() Message-ID: <20171024082621.GA18529@beast> MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171024_012644_406914_5AF0BA5D X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , devel@driverdev.osuosl.org, Keerthi Reddy , linux-kernel@vger.kernel.org, Eric Anholt , Michael Zoran , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: Greg Kroah-Hartman Cc: Eric Anholt Cc: Stefan Wahren Cc: Michael Zoran Cc: Keerthi Reddy Cc: linux-rpi-kernel@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Cc: devel@driverdev.osuosl.org Signed-off-by: Kees Cook Tested-by: Stefan Wahren --- .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 13 +++++++------ .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 6fcc62603580..6d16cc036c0c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -109,7 +109,7 @@ static const char *const resume_state_names[] = { * requested */ #define FORCE_SUSPEND_TIMEOUT_MS 200 -static void suspend_timer_callback(unsigned long context); +static void suspend_timer_callback(struct timer_list *t); typedef struct user_service_struct { VCHIQ_SERVICE_T *service; @@ -2184,8 +2184,9 @@ vchiq_arm_init_state(VCHIQ_STATE_T *state, VCHIQ_ARM_STATE_T *arm_state) arm_state->suspend_timer_timeout = SUSPEND_TIMER_TIMEOUT_MS; arm_state->suspend_timer_running = 0; - setup_timer(&arm_state->suspend_timer, suspend_timer_callback, - (unsigned long)(state)); + arm_state->state = state; + timer_setup(&arm_state->suspend_timer, suspend_timer_callback, + 0); arm_state->first_connect = 0; @@ -3017,10 +3018,10 @@ vchiq_instance_set_trace(VCHIQ_INSTANCE_T instance, int trace) instance->trace = (trace != 0); } -static void suspend_timer_callback(unsigned long context) +static void suspend_timer_callback(struct timer_list *t) { - VCHIQ_STATE_T *state = (VCHIQ_STATE_T *)context; - VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); + VCHIQ_ARM_STATE_T *arm_state = from_timer(arm_state, t, suspend_timer); + VCHIQ_STATE_T *state = arm_state->state; if (!arm_state) goto out; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h index a4cc0db899be..40bb0c63b1a9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h @@ -83,6 +83,7 @@ typedef struct vchiq_arm_state_struct { unsigned int wake_address; + VCHIQ_STATE_T *state; struct timer_list suspend_timer; int suspend_timer_timeout; int suspend_timer_running;