From patchwork Tue Oct 17 00:29:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10010443 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 7365F600CC for ; Tue, 17 Oct 2017 00:38:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64A6B28717 for ; Tue, 17 Oct 2017 00:38:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59D482871A; Tue, 17 Oct 2017 00:38: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.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 E280928717 for ; Tue, 17 Oct 2017 00:38:24 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=//emNVvNATUT0UOBRy5IzDmQQbjgLW+5RQe9zJBgYXY=; b=rq/7tP4TNxIeE5Lb8c6nUcZISb e91pfkgwuMILSCU+6XZ6F/uXChX1RVG89fxi4VdAf5G5i1Wpo3q6EXIenuboAPdzf6huDJdkQS0d4 EGl1/9z2EmrXz9bihdTWnGeH58Njrq64nK6VY5nRFpGUqqMfS+u2oZ2G6OlJFq7WsBRcOb5Imx0K9 WxIO8Mn1ye24t7/VfpsbUvGshscXJDXP4SGqtdEDFSSoy6x5mgpzYNzDeLFI/Yr55P27SC+6kbNTF zpLixh7rWu17NOUH2XyKUaysGH2xhciye5e3Rqfe66OJCHCzWErz341IvjRNqLtDzvAb1g1Qy9n4j kqjEHp5w==; 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 1e4FtS-000208-GK; Tue, 17 Oct 2017 00:38:02 +0000 Received: from mail-pf0-x230.google.com ([2607:f8b0:400e:c00::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e4FtP-0001zF-9Z for linux-arm-kernel@lists.infradead.org; Tue, 17 Oct 2017 00:38:01 +0000 Received: by mail-pf0-x230.google.com with SMTP id n89so47765pfk.11 for ; Mon, 16 Oct 2017 17:37:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QwYmjUjkrD/VX4OKwvL7SJxQ8k8L3dwRexv7EQlQUoY=; b=Ryhf5qa/n9bir+coU8gSSVGfnK4vHivizPHz6OMML6dvWOwsfm/1h8f/sqNpHoebL9 +y3DvXr48kYczbm7Z1Msk9VkgSH6JIQhfnQ9xZyDif8AplkH6e4Br06G/7UNQQl769Bf 43goFEhh4ZFpaeMDO8/ld9v/9oLutU1ei6qn8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QwYmjUjkrD/VX4OKwvL7SJxQ8k8L3dwRexv7EQlQUoY=; b=BGXs6/hfXaTr+H8IaXMmC4CnfTNqWgqVeAms8VW7LdipG592Trwc1sB9q/OQg3HO4T g3+XUbpMQnMW0knTeiUfWbdgrXgEkRPtc7dC68QRC3w2195dm0yGWin0LQS4KbpPwVdJ XHkAun4YHOLIm9eTWtHtF3UBuQBstCCxBgxxhtnRqoOiMHwWgqBwMRb+WkK6i3HkOJk7 kyBqL83xxjOTuWgYxspfjhenaRidhhfGTeBm8U0K324HPzle0meWY0Q8Bt5pyR2nhCX9 CA3BlQaSQgOOhbgOaKDGaZffcrmG73nrlNthuVINTzvAbQBpiyOG6sZgae69BGKU+qZV YVlA== X-Gm-Message-State: AMCzsaXbuHL1KaA43LFQAl4zzdB4SvVq4GReiVCQxYcA6AYXx0gLt4ZZ 1FQXhvVrpvSphPMH/AumTj+T4g== X-Google-Smtp-Source: AOwi7QD0Ouk6UMlMpnpVbxrjB02Gq/xZH7o/06qtavDRPY0U5be1a1v7A72reekwggMKWP/aBfwN8A== X-Received: by 10.98.16.149 with SMTP id 21mr10284318pfq.182.1508200657941; Mon, 16 Oct 2017 17:37:37 -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 y206sm17316455pfb.155.2017.10.16.17.37.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 17:37:36 -0700 (PDT) From: Kees Cook To: "David S. Miller" Subject: [PATCH 45/58] net: seeq: Convert timers to use timer_setup() Date: Mon, 16 Oct 2017 17:29:29 -0700 Message-Id: <1508200182-104605-46-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508200182-104605-1-git-send-email-keescook@chromium.org> References: <1508200182-104605-1-git-send-email-keescook@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171016_173759_365138_CD350EAB X-CRM114-Status: GOOD ( 13.44 ) 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: Kees Cook , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Russell King , Thomas Gleixner , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook --- drivers/net/ethernet/seeq/ether3.c | 11 ++++++----- drivers/net/ethernet/seeq/ether3.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/seeq/ether3.c b/drivers/net/ethernet/seeq/ether3.c index 244c1e171017..da4807723a06 100644 --- a/drivers/net/ethernet/seeq/ether3.c +++ b/drivers/net/ethernet/seeq/ether3.c @@ -170,9 +170,11 @@ ether3_setbuffer(struct net_device *dev, buffer_rw_t read, int start) /* * Switch LED off... */ -static void ether3_ledoff(unsigned long data) +static void ether3_ledoff(struct timer_list *t) { - struct net_device *dev = (struct net_device *)data; + struct dev_priv *private = from_timer(priv, t, timer); + struct net_device *dev = private->dev; + ether3_outw(priv(dev)->regs.config2 |= CFG2_CTRLO, REG_CONFIG2); } @@ -183,8 +185,6 @@ static inline void ether3_ledon(struct net_device *dev) { del_timer(&priv(dev)->timer); priv(dev)->timer.expires = jiffies + HZ / 50; /* leave on for 1/50th second */ - priv(dev)->timer.data = (unsigned long)dev; - priv(dev)->timer.function = ether3_ledoff; add_timer(&priv(dev)->timer); if (priv(dev)->regs.config2 & CFG2_CTRLO) ether3_outw(priv(dev)->regs.config2 &= ~CFG2_CTRLO, REG_CONFIG2); @@ -783,7 +783,8 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id) ether3_addr(dev->dev_addr, ec); - init_timer(&priv(dev)->timer); + priv(dev)->dev = dev; + timer_setup(&priv(dev)->timer, ether3_ledoff, 0); /* Reset card... */ diff --git a/drivers/net/ethernet/seeq/ether3.h b/drivers/net/ethernet/seeq/ether3.h index 2db63b08bdf3..ea2ba286e665 100644 --- a/drivers/net/ethernet/seeq/ether3.h +++ b/drivers/net/ethernet/seeq/ether3.h @@ -165,6 +165,7 @@ struct dev_priv { unsigned char tx_tail; /* buffer nr of transmitting packet */ unsigned int rx_head; /* address to fetch next packet from */ struct timer_list timer; + net_device *dev; int broken; /* 0 = ok, 1 = something went wrong */ };