From patchwork Tue Oct 17 00:28:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10010413 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 5AB74600CC for ; Tue, 17 Oct 2017 00:35:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BEC7286D7 for ; Tue, 17 Oct 2017 00:35:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4040428718; Tue, 17 Oct 2017 00:35:26 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 95206286D7 for ; Tue, 17 Oct 2017 00:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753474AbdJQAfH (ORCPT ); Mon, 16 Oct 2017 20:35:07 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:53336 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933230AbdJQAaI (ORCPT ); Mon, 16 Oct 2017 20:30:08 -0400 Received: by mail-pf0-f180.google.com with SMTP id t188so35974pfd.10 for ; Mon, 16 Oct 2017 17:30:08 -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=UeHuj6AOzuRDiMXiiWuiqAWFnyvqutqJfI1Vt+GNlZM=; b=KxiFg24ajz285kWJncSlKzkZk0ugBXG0oa45wtv3Ed+2op/7tSfrtKNW1PANCAOjKe 9R31Q6D4sPeeKsBiTvTneHqMB0vIaim8RB309zgGD9ETZulEmqF18NmnNmONoSUT5vvz 0V44rb1PnctRIEt0gZy8XftAHi5k7djNkj0QU= 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=UeHuj6AOzuRDiMXiiWuiqAWFnyvqutqJfI1Vt+GNlZM=; b=kZNzx7kvBhd1nBobV0c/AgTBVZ0qYhLpFFPceq6WhLK8lSawNe83Ec0v5oTJCwNNE+ piFiPdeTg7dFaPgxmD/xaoJLgfnjGYwFIV3V5NWmXLfcxWyfHMARVmf81bZM5hrrwPR0 onhwjqe6GhUPEZhsRbpS6CC0HZ9F/XDLQNjnciIRVIAZtKEgOco9bgjY5ez8OLJIgbVy GzsheMFHaG5QlJzPb7SihyeP7A9YMy3t3pM3Z/lZSvvj1pZ1Vj6jkIbC0hiDmepUImdG yt5J3AAmeZdprxBv3M9SFpMVuLwBgsT7Fxqwpad/RKiW7831IxyrZ/8jbXMcnm+bwXlS UgWg== X-Gm-Message-State: AMCzsaVRQqlqIYukTQpO3/0HdYOC+6aYwtDTXEQn86mee3SQbDkX+2VR q+g4VSWadWCboCX9jdLCUnnAinE1z8A= X-Google-Smtp-Source: AOwi7QCanQF8IeLRmAB+b6mSn1WA6CYQKCysz/Rok1V2EB4/nR61pOXXfTFDnmwcIKurxKNskGTeAQ== X-Received: by 10.98.189.26 with SMTP id a26mr10436945pff.260.1508200207863; Mon, 16 Oct 2017 17:30:07 -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 x73sm16170671pff.102.2017.10.16.17.29.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 17:30:04 -0700 (PDT) From: Kees Cook To: "David S. Miller" Cc: Kees Cook , "yuval.shaia@oracle.com" , Tobias Klauser , Jarod Wilson , Philippe Reynes , netdev@vger.kernel.org, linux-parisc@vger.kernel.org, Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH 14/58] net: tulip: de2104x: Convert timers to use timer_setup() Date: Mon, 16 Oct 2017 17:28:58 -0700 Message-Id: <1508200182-104605-15-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> Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@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: "David S. Miller" Cc: "yuval.shaia@oracle.com" Cc: Tobias Klauser Cc: Jarod Wilson Cc: Philippe Reynes Cc: netdev@vger.kernel.org Cc: linux-parisc@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Tobias Klauser --- drivers/net/ethernet/dec/tulip/de2104x.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c index c87b8cc42963..13430f75496c 100644 --- a/drivers/net/ethernet/dec/tulip/de2104x.c +++ b/drivers/net/ethernet/dec/tulip/de2104x.c @@ -333,8 +333,8 @@ static void de_set_rx_mode (struct net_device *dev); static void de_tx (struct de_private *de); static void de_clean_rings (struct de_private *de); static void de_media_interrupt (struct de_private *de, u32 status); -static void de21040_media_timer (unsigned long data); -static void de21041_media_timer (unsigned long data); +static void de21040_media_timer (struct timer_list *t); +static void de21041_media_timer (struct timer_list *t); static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media); @@ -959,9 +959,9 @@ static void de_next_media (struct de_private *de, const u32 *media, } } -static void de21040_media_timer (unsigned long data) +static void de21040_media_timer (struct timer_list *t) { - struct de_private *de = (struct de_private *) data; + struct de_private *de = from_timer(de, t, media_timer); struct net_device *dev = de->dev; u32 status = dr32(SIAStatus); unsigned int carrier; @@ -1040,9 +1040,9 @@ static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media) return 1; } -static void de21041_media_timer (unsigned long data) +static void de21041_media_timer (struct timer_list *t) { - struct de_private *de = (struct de_private *) data; + struct de_private *de = from_timer(de, t, media_timer); struct net_device *dev = de->dev; u32 status = dr32(SIAStatus); unsigned int carrier; @@ -1999,12 +1999,9 @@ static int de_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) de->msg_enable = (debug < 0 ? DE_DEF_MSG_ENABLE : debug); de->board_idx = board_idx; spin_lock_init (&de->lock); - init_timer(&de->media_timer); - if (de->de21040) - de->media_timer.function = de21040_media_timer; - else - de->media_timer.function = de21041_media_timer; - de->media_timer.data = (unsigned long) de; + timer_setup(&de->media_timer, + de->de21040 ? de21040_media_timer : de21041_media_timer, + 0); netif_carrier_off(dev);