From patchwork Thu Oct 5 00:54:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9986193 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 EB69460291 for ; Thu, 5 Oct 2017 00:54:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBA7A28C43 for ; Thu, 5 Oct 2017 00:54:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D018028C45; Thu, 5 Oct 2017 00:54:54 +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=ham 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 CEF2728C43 for ; Thu, 5 Oct 2017 00:54:53 +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=oc6JGcu3kgK1J6oRSIY0+Az1fAhGM3ln680XtyRuvIw=; b=ssbTWzbxwDLn0a 5P86Ywv+Kc1K434S0UtDz0/B8/Qhw/yG0MdCy3gy5nhk7eLXyz2+OXlp5U+2JelGEOMo5hxSJV8XK QoKiEnJvhBhBqZnWBlpUtfhWrGaSrrEn17zY2ngQOSjYe7RpIwmNP9WQC/BVQkLHsnqoI5H7ljVQT QeGp1SUpEprAiHvplIn2dFQj/5zzN8jfS71LQXmwFdn1kil+eLdQmO4yfAjD6fj3phf2m68rY3bQB 8JrpmrKBg8WA/DUU+tCrWXBGl29p+aQjZBhtCV3BUPPevdypjdxgTPyJNi54jDZ19CtMooGd5RqnL b0nlIzrwlVGFByg4fMnQ==; 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 1dzuR3-0000XY-7J; Thu, 05 Oct 2017 00:54:45 +0000 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dzuQk-0000Mx-V4 for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2017 00:54:28 +0000 Received: by mail-pf0-x22c.google.com with SMTP id r68so7134012pfj.3 for ; Wed, 04 Oct 2017 17:54:05 -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=u5qUCbLhFtdkIWPz+ACkz/BCNVKDP5XXXLQifUlwjMk=; b=oDotOJ6Z8c6FbUx5dWl3ewl1+3em1iJ+N7vOwO9ydlmcB+WMzhfuI+um5ocqZU67LN 1IHp6uhe3+r0h8R72xxZ2w1wLLL+wY5DUFqAgdh3SacxiFXj62Nmn7qoWXUQ4goQeEq/ QNz7pj6rdxpb4Bc1EEDIyhFpkFGYGm9n0ZWfI= 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=u5qUCbLhFtdkIWPz+ACkz/BCNVKDP5XXXLQifUlwjMk=; b=Qq/R/4KqP0PF5GHJNIVn39AK/Bc7dEVejslvAV1Ua5E+Erag7PnRjjVGcTjKPlj8D9 Bb+bE7vx4sBeoT+6VMHbcpfLhGvnqkfNUecZlpANjxlMV1KrkHjOWa/8VWF9I9R6vV21 49gQFE5GH367zD7ix9Hk/XbVD8eSAF+4XQUrdHYHkgbCPrPlLYrklRxlQwyCtpdzcmEs 2yFBhl8dtiMh0USDiqUTy7Q/ApPcdg+Bzlsd1Hdsl7B5iLQ1+qXAYad1syM5ZNR7YMRX JRtGGWEpDQIxdUGetGXNEwLqMCpqaGTUcYitTyDef3/yr4FcCb598mw3fQSPQX8Dfuqy rSwg== X-Gm-Message-State: AHPjjUg5IghbL69gYl+a/VhPLNkfgNT6Ny7iV0GDCNUkZSsrQVg9JEMb txwZyb7y/IJiUpkM99VolDG0Vg== X-Google-Smtp-Source: AOwi7QCVhon2RGKVcxX1iTDdvw3TNCaLfZixDdy5O5HaPoufeAQd7ZPmSMaLp0YrEVyHrVrvtqvdSg== X-Received: by 10.98.223.88 with SMTP id u85mr22154904pfg.219.1507164844936; Wed, 04 Oct 2017 17:54:04 -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 e66sm26315569pfe.79.2017.10.04.17.54.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:54:03 -0700 (PDT) Date: Wed, 4 Oct 2017 17:54:02 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Subject: [PATCH] watchdog: lpc18xx_wdt: Convert timers to use Message-ID: <20171005005402.GA23880@beast> MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171004_175427_032970_F44C1CF7 X-CRM114-Status: GOOD ( 12.79 ) 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: linux-watchdog@vger.kernel.org, Joachim Eastwood , Wim Van Sebroeck , Guenter Roeck , Thomas Gleixner , 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: Wim Van Sebroeck Cc: Guenter Roeck Cc: Joachim Eastwood Cc: linux-watchdog@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: Thomas Gleixner Signed-off-by: Kees Cook Acked-by: Guenter Roeck --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/watchdog/lpc18xx_wdt.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/watchdog/lpc18xx_wdt.c b/drivers/watchdog/lpc18xx_wdt.c index 3b8bb59adf02..b4221f43cd94 100644 --- a/drivers/watchdog/lpc18xx_wdt.c +++ b/drivers/watchdog/lpc18xx_wdt.c @@ -78,10 +78,10 @@ static int lpc18xx_wdt_feed(struct watchdog_device *wdt_dev) return 0; } -static void lpc18xx_wdt_timer_feed(unsigned long data) +static void lpc18xx_wdt_timer_feed(struct timer_list *t) { - struct watchdog_device *wdt_dev = (struct watchdog_device *)data; - struct lpc18xx_wdt_dev *lpc18xx_wdt = watchdog_get_drvdata(wdt_dev); + struct lpc18xx_wdt_dev *lpc18xx_wdt = from_timer(lpc18xx_wdt, t, timer); + struct watchdog_device *wdt_dev = &lpc18xx_wdt->wdt_dev; lpc18xx_wdt_feed(wdt_dev); @@ -96,7 +96,9 @@ static void lpc18xx_wdt_timer_feed(unsigned long data) */ static int lpc18xx_wdt_stop(struct watchdog_device *wdt_dev) { - lpc18xx_wdt_timer_feed((unsigned long)wdt_dev); + struct lpc18xx_wdt_dev *lpc18xx_wdt = watchdog_get_drvdata(wdt_dev); + + lpc18xx_wdt_timer_feed(&lpc18xx_wdt->timer); return 0; } @@ -267,8 +269,7 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev) __lpc18xx_wdt_set_timeout(lpc18xx_wdt); - setup_timer(&lpc18xx_wdt->timer, lpc18xx_wdt_timer_feed, - (unsigned long)&lpc18xx_wdt->wdt_dev); + timer_setup(&lpc18xx_wdt->timer, lpc18xx_wdt_timer_feed, 0); watchdog_set_nowayout(&lpc18xx_wdt->wdt_dev, nowayout); watchdog_set_restart_priority(&lpc18xx_wdt->wdt_dev, 128);