From patchwork Tue Oct 24 09:29:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10023815 X-Patchwork-Delegate: kvalo@adurom.com 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 3880E60245 for ; Tue, 24 Oct 2017 09:29:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EE80289D3 for ; Tue, 24 Oct 2017 09:29:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 236E7289D8; Tue, 24 Oct 2017 09:29:20 +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=ham 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 98426289D3 for ; Tue, 24 Oct 2017 09:29:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752020AbdJXJ3S (ORCPT ); Tue, 24 Oct 2017 05:29:18 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:43356 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752007AbdJXJ3M (ORCPT ); Tue, 24 Oct 2017 05:29:12 -0400 Received: by mail-pg0-f68.google.com with SMTP id s75so14045632pgs.0 for ; Tue, 24 Oct 2017 02:29:12 -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=7BdizsuwuKYbiD26sEy4urD+1sqM7JybVaZEA/HhRUY=; b=Kpq1eE4dSGDOisCAe1zUZiMFGli0Kefpc1tOBYAjBBV8OYOLmTZTN3h1UgB/6Togmc f6zIvVZs4m9dpDJ2FsHBoEjCZv3bT2t5tvZMgBFzLNVTjO7SRQVL0NwO3bd9IDODqGFT TQJkxWxYDn6KDO4xxfaTRji84Dc3PvgyDc56E= 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=7BdizsuwuKYbiD26sEy4urD+1sqM7JybVaZEA/HhRUY=; b=f0Zjk8pI6a5Wz8TkTAOrsJvDIwcazyChJuxiXmgiI6YX5OZZb/DTmAa3F+d8vs5ixx UuEPHcpNPearfZ5L+QWPeNSgqTvdwE4R6lISEN+tNEU5s0z5H2iASmlloylGClp3hUd1 OGCbCKus9mscPI40OuzDZTjazc4PdiEUcgwcKNp1DBYUHLmAT9rHxtbxj5pKTX3OfNoI HYCo4HlAJ4gFdhxwtloma1BtWR3vrK5/DHTe71aUPSkBIe1v+cIq951hlUlb7lxuuYz9 2OJgtu7+QnhgA3iF9GBaN2wNiE4WZ+ksQCtnySj2DRsjVyOifgjS0dEqb4p7Z2nGOXe0 HnKQ== X-Gm-Message-State: AMCzsaWZCpVhfx9xMbJNNIlbQr/VDASClT2Rk+hF7NCnCd5qOAi/3/UJ Nfys3+viRxCe81DtwvQFBm7Waw== X-Google-Smtp-Source: ABhQp+SLYioi5Ybjxbd8tUfOXpsFX7h7hQ7fapGF7fySjyK+56p4/5binTJXcP+fBRMBtNHedNURYg== X-Received: by 10.84.194.131 with SMTP id h3mr12746446pld.264.1508837351446; Tue, 24 Oct 2017 02:29:11 -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 t24sm17285468pfj.46.2017.10.24.02.29.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 02:29:10 -0700 (PDT) Date: Tue, 24 Oct 2017 02:29:09 -0700 From: Kees Cook To: Kalle Valo Cc: Amitkumar Karwar , Prameela Rani Garnepudi , Pavani Muthyala , Karun Eagalapati , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers/wireless: rsi: Convert timers to use timer_setup() Message-ID: <20171024092909.GA47160@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@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: Kalle Valo Cc: Amitkumar Karwar Cc: Prameela Rani Garnepudi Cc: Pavani Muthyala Cc: Karun Eagalapati Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook --- drivers/net/wireless/rsi/rsi_91x_hal.c | 7 +++---- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 4 ++-- drivers/net/wireless/rsi/rsi_91x_main.c | 4 +--- drivers/net/wireless/rsi/rsi_common.h | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c index 689527d7007a..1176de646942 100644 --- a/drivers/net/wireless/rsi/rsi_91x_hal.c +++ b/drivers/net/wireless/rsi/rsi_91x_hal.c @@ -418,9 +418,9 @@ int rsi_prepare_beacon(struct rsi_common *common, struct sk_buff *skb) return 0; } -static void bl_cmd_timeout(unsigned long priv) +static void bl_cmd_timeout(struct timer_list *t) { - struct rsi_hw *adapter = (struct rsi_hw *)priv; + struct rsi_hw *adapter = from_timer(adapter, t, bl_cmd_timer); adapter->blcmd_timer_expired = true; del_timer(&adapter->bl_cmd_timer); @@ -428,8 +428,7 @@ static void bl_cmd_timeout(unsigned long priv) static int bl_start_cmd_timer(struct rsi_hw *adapter, u32 timeout) { - setup_timer(&adapter->bl_cmd_timer, (void *)&bl_cmd_timeout, - (unsigned long)adapter); + timer_setup(&adapter->bl_cmd_timer, bl_cmd_timeout, 0); adapter->bl_cmd_timer.expires = (msecs_to_jiffies(timeout) + jiffies); adapter->blcmd_timer_expired = false; diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c index b1f5dbbde3cb..9427c9d7c9c7 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c @@ -1663,9 +1663,9 @@ static void rsi_resume_conn_channel(struct rsi_common *common) } } -void rsi_roc_timeout(unsigned long data) +void rsi_roc_timeout(struct timer_list *t) { - struct rsi_common *common = (struct rsi_common *)data; + struct rsi_common *common = from_timer(common, t, roc_timer); rsi_dbg(INFO_ZONE, "Remain on channel expired\n"); diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c index 71b8cfb8252e..2a1fbb7db6c4 100644 --- a/drivers/net/wireless/rsi/rsi_91x_main.c +++ b/drivers/net/wireless/rsi/rsi_91x_main.c @@ -262,9 +262,7 @@ struct rsi_hw *rsi_91x_init(void) rsi_default_ps_params(adapter); spin_lock_init(&adapter->ps_lock); - common->roc_timer.data = (unsigned long)common; - common->roc_timer.function = (void *)&rsi_roc_timeout; - init_timer(&common->roc_timer); + timer_setup(&common->roc_timer, rsi_roc_timeout, 0); common->init_done = true; return adapter; diff --git a/drivers/net/wireless/rsi/rsi_common.h b/drivers/net/wireless/rsi/rsi_common.h index 272e18d750ff..29acaea3636d 100644 --- a/drivers/net/wireless/rsi/rsi_common.h +++ b/drivers/net/wireless/rsi/rsi_common.h @@ -85,5 +85,5 @@ void rsi_91x_deinit(struct rsi_hw *adapter); int rsi_read_pkt(struct rsi_common *common, s32 rcv_pkt_len); struct rsi_sta *rsi_find_sta(struct rsi_common *common, u8 *mac_addr); struct ieee80211_vif *rsi_get_vif(struct rsi_hw *adapter, u8 *mac); -void rsi_roc_timeout(unsigned long data); +void rsi_roc_timeout(struct timer_list *t); #endif