From patchwork Thu Oct 5 00:50: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: 9986249 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 68E01605A8 for ; Thu, 5 Oct 2017 01:05:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5998A28C21 for ; Thu, 5 Oct 2017 01:05:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DCAB28C43; Thu, 5 Oct 2017 01:05:41 +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 D725428C21 for ; Thu, 5 Oct 2017 01:05:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751527AbdJEBFV (ORCPT ); Wed, 4 Oct 2017 21:05:21 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:47894 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429AbdJEAuu (ORCPT ); Wed, 4 Oct 2017 20:50:50 -0400 Received: by mail-pf0-f177.google.com with SMTP id u12so7133232pfl.4 for ; Wed, 04 Oct 2017 17:50:50 -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=GFh7OrtfRsjH+hsuMoRl9I9Rahwsci4He5uAU5kF0wg=; b=ct1BiZTrdwH9+rpzbWbO6OBpd46cy5x6tgjcxL7C9UFkpnTYXz1VHALmxGUIm6LOyK Yky+Pmi8N7wQ6CxloOWgPl3kn+NyC2zHD9mtXgfhNlut3l1GHWxAMMlc8drjYF1ODGen 4vKAhcNZz6CDhKgY1rAY5DYWlsORipQlcTsvc= 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=GFh7OrtfRsjH+hsuMoRl9I9Rahwsci4He5uAU5kF0wg=; b=NLB+OpFG2qSzRPicFCTLd0sj0UtpjJN/8CiC3ZqtJuGQTQlBOGOHSg5444t70mOCZS I7iyxht6hA+IZufm7iiq0gz9EMO1rr0nsWTQ2EVZtL2bOYVVxO+I2RedoRjJMeetAjLp h9scAwepdPnHKWbor5Ld6ymWcbgvfVYNgPuOrntMRP4SUZbLPXfYhYNRAUhJVjH8h67V qlQx4GawawdYCJTlC2cDEwC0zlpxDlNjGrjCKZ4uOkapjwoSIkBDFvGVWA4lPF1kL907 jh3i21tWJhsqf97548NSAdy+kwNjFqFBauU8gFag7I3XeZ+vr/pLuL9TWUDj8JEcNbmW H1PQ== X-Gm-Message-State: AMCzsaWSUh6ywrHLGkZGcgyqDObApMw78eY9mBttixIIGsUYj7EgIccG VSCHeodrHgwS1U3J0n0RGaRCnQ== X-Google-Smtp-Source: AOwi7QAn+X/14WSz6Hcbqx44/5nuj8B0mCSuoU1Rjx0kuC2p/7sIa+ran8tzEzToOQLBWcWAHGNqgA== X-Received: by 10.159.245.141 with SMTP id a13mr16503741pls.441.1507164649859; Wed, 04 Oct 2017 17:50:49 -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 r12sm24465416pgp.81.2017.10.04.17.50.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:50:48 -0700 (PDT) Date: Wed, 4 Oct 2017 17:50:48 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: "David S. Miller" , "yuval.shaia@oracle.com" , Tobias Klauser , Jarod Wilson , Philippe Reynes , netdev@vger.kernel.org, linux-parisc@vger.kernel.org, Thomas Gleixner Subject: [PATCH] net: tulip: de2104x: Convert timers to use Message-ID: <20171005005048.GA23304@beast> MIME-Version: 1.0 Content-Disposition: inline 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 Cc: Thomas Gleixner Signed-off-by: Kees Cook Reviewed-by: Tobias Klauser --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- 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);