Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4068942yba; Tue, 9 Apr 2019 10:26:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwckLsQV9gOL/5aztYPDCg0O+ch0M25yO8dbEv37pH2N7nKjrTJ5uITJY4LF2PDwHvroL0U X-Received: by 2002:a62:4351:: with SMTP id q78mr38846617pfa.86.1554830800341; Tue, 09 Apr 2019 10:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554830800; cv=none; d=google.com; s=arc-20160816; b=oUDGNow3g0wu6rv9i8jwz2t5IR0tgwhtwS1Tnwo4YyxArIG2emXTUdGaLvLcv5se/F K3HXE6lUALsWxUPHKAsLrJDm4HggWnhF+NWGP20z60EULyFTz9DSq16O8/jjq7Hi8U43 hR80Df66N3Qu2wBo3XFHBs1PfyfqgAmNnUMw8elrr8vAReIlYLbTJY4y+LNhdv2GzcJj XoaXEAuznuLnebVNkOJ9inGZ5LvofLbieFqfSudvgcR9rCkhDFcXGYf5GOcJmxG2jqYa Y9fEcaliACAW/34j9gJfVubQ2NJNzeagmmS4gmHpRNVbfGjmy/ClUFXgDImLbAvjjTpZ TENw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=YlBMQHRRMhSGuQhnSlFbWv+llB56GpesX1o6ChIhKxU=; b=KbKm4iZ1nqUairucI8/4NWnUt8f6lGvA1eH1mPSy02GSCil8rPCL4CzsFIUqEI7BSB N59y+CFydGnJpIO0uTWlA+UdD3o55qwIQvisE0LOCtVh6yfSbBRk+awPrRCwFy4ZJHj2 vo5pCpqyAa9eItSUtya1aYrC58cGJ7/u8uwEKkDjKN1fwNTXRqybGNY/qvIYekXCIOUp yJohY91jrHFop/Ii5yoN2AqOe0i9JD8LnSldpifUFQCrtA4TW/cqeQPTvzH1vaBDUBgM hB5fgMYfpvgD0Mjgr9hVbRQ9h86ob9VWakz1k0/hNLjeAySh77csO9XsoWAsCZteQfp5 KKzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=SuyKz2LI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w17si29849301pll.30.2019.04.09.10.26.24; Tue, 09 Apr 2019 10:26:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=SuyKz2LI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726750AbfDIRY1 (ORCPT + 99 others); Tue, 9 Apr 2019 13:24:27 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44345 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbfDIRYT (ORCPT ); Tue, 9 Apr 2019 13:24:19 -0400 Received: by mail-pf1-f193.google.com with SMTP id y13so10094842pfm.11; Tue, 09 Apr 2019 10:24:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=YlBMQHRRMhSGuQhnSlFbWv+llB56GpesX1o6ChIhKxU=; b=SuyKz2LIVhEGOGyvfhvaUadmHhrM7ZmrNkdyPGDHc3n0iNnXeXR98eWmg51PgWiTM/ /pTTMUCYsFulAXgGdRNFaAERml9yTaH5ud8UywW4DWXGLVifidthNk8DBwnxfT6wzXBB YD742r7C/N8skol38qrBrRhPTdfTFbHf6S0/L/+yTtqx2LFPcwfa++YbTZTcbNghCtOY 4emS23u1wOtU1i8uh/+gfI0GNrvMLJQj0KFtfmkaCP3ITpETkakbWVNLNTo5C56NhEQG mUVmWb78rnJgW74rtgYgGevftCW6hicPmMdbjjOuUbp53yIUWifGOOnvW/KQOY4utksS Y2Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=YlBMQHRRMhSGuQhnSlFbWv+llB56GpesX1o6ChIhKxU=; b=F0XlbSazSntQL4tgLfnD290p7EULseR4KcrQO5cjM05IPaM4C6PRKC7onJaOjiGDwM R95Zed9U1/89X9+7I1FilWg5OGe9LuN0KIYv2z0cSl2NyWToS0VHIXndwLlXqvkvXtJT 5gJHzAbMeH/vLNkxZvf8Ozwrqlg0hFch3pG3l3NmOv97wdt5Zdi9anFwcTPNZA+5pW08 Cyb0pW8Q6U/YK6eTyZZ4GQ+tUuooc9gPBCWEMSCzlqWy67g8PW2ss2pHGyAeh0Uz18Bi IVUYa4Rc1t8vwdVE4YNQiMFfXfnTB4d7M4PBGpPwJpujJlrSXvnDNTptNvVnn2bzhy5p WgGQ== X-Gm-Message-State: APjAAAV5bzRy1QXB5GhqJdAzoKvDPP/446Z8A1vKhBMZpeun6SeOcC72 Rbm88KO19lJ978FStIta9j0= X-Received: by 2002:a63:2747:: with SMTP id n68mr36008288pgn.317.1554830658622; Tue, 09 Apr 2019 10:24:18 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id g10sm15915554pgq.54.2019.04.09.10.24.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 10:24:18 -0700 (PDT) From: Guenter Roeck To: Wim Van Sebroeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Kevin Hilman Subject: [PATCH 05/23] watchdog: meson_wdt: Use 'dev' instead of dereferencing it repeatedly Date: Tue, 9 Apr 2019 10:23:43 -0700 Message-Id: <1554830641-9247-6-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554830641-9247-1-git-send-email-linux@roeck-us.net> References: <1554830641-9247-1-git-send-email-linux@roeck-us.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce local variable 'struct device *dev' and use it instead of dereferencing it repeatedly. The conversion was done automatically with coccinelle using the following semantic patches. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches Cc: Kevin Hilman Signed-off-by: Guenter Roeck --- drivers/watchdog/meson_wdt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/watchdog/meson_wdt.c b/drivers/watchdog/meson_wdt.c index 7fc6acb33c7f..01889cef81e1 100644 --- a/drivers/watchdog/meson_wdt.c +++ b/drivers/watchdog/meson_wdt.c @@ -164,11 +164,12 @@ MODULE_DEVICE_TABLE(of, meson_wdt_dt_ids); static int meson_wdt_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct meson_wdt_dev *meson_wdt; const struct of_device_id *of_id; int err; - meson_wdt = devm_kzalloc(&pdev->dev, sizeof(*meson_wdt), GFP_KERNEL); + meson_wdt = devm_kzalloc(dev, sizeof(*meson_wdt), GFP_KERNEL); if (!meson_wdt) return -ENOMEM; @@ -176,14 +177,14 @@ static int meson_wdt_probe(struct platform_device *pdev) if (IS_ERR(meson_wdt->wdt_base)) return PTR_ERR(meson_wdt->wdt_base); - of_id = of_match_device(meson_wdt_dt_ids, &pdev->dev); + of_id = of_match_device(meson_wdt_dt_ids, dev); if (!of_id) { - dev_err(&pdev->dev, "Unable to initialize WDT data\n"); + dev_err(dev, "Unable to initialize WDT data\n"); return -ENODEV; } meson_wdt->data = of_id->data; - meson_wdt->wdt_dev.parent = &pdev->dev; + meson_wdt->wdt_dev.parent = dev; meson_wdt->wdt_dev.info = &meson_wdt_info; meson_wdt->wdt_dev.ops = &meson_wdt_ops; meson_wdt->wdt_dev.max_timeout = @@ -195,18 +196,18 @@ static int meson_wdt_probe(struct platform_device *pdev) watchdog_set_drvdata(&meson_wdt->wdt_dev, meson_wdt); - watchdog_init_timeout(&meson_wdt->wdt_dev, timeout, &pdev->dev); + watchdog_init_timeout(&meson_wdt->wdt_dev, timeout, dev); watchdog_set_nowayout(&meson_wdt->wdt_dev, nowayout); watchdog_set_restart_priority(&meson_wdt->wdt_dev, 128); meson_wdt_stop(&meson_wdt->wdt_dev); watchdog_stop_on_reboot(&meson_wdt->wdt_dev); - err = devm_watchdog_register_device(&pdev->dev, &meson_wdt->wdt_dev); + err = devm_watchdog_register_device(dev, &meson_wdt->wdt_dev); if (err) return err; - dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)", + dev_info(dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)", meson_wdt->wdt_dev.timeout, nowayout); return 0; -- 2.7.4