Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	Guenter Roeck <linux@roeck-us.net>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Chen-Yu Tsai <wens@csie.org>
Subject: [PATCH 22/23] watchdog: sunxi_wdt: Use 'dev' instead of dereferencing it repeatedly
Date: Tue,  9 Apr 2019 10:24:00 -0700
Message-ID: <1554830641-9247-23-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1554830641-9247-1-git-send-email-linux@roeck-us.net>

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: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/sunxi_wdt.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/watchdog/sunxi_wdt.c b/drivers/watchdog/sunxi_wdt.c
index f0e7ef40b1e4..9c22f7753c6b 100644
--- a/drivers/watchdog/sunxi_wdt.c
+++ b/drivers/watchdog/sunxi_wdt.c
@@ -233,14 +233,15 @@ MODULE_DEVICE_TABLE(of, sunxi_wdt_dt_ids);
 
 static int sunxi_wdt_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct sunxi_wdt_dev *sunxi_wdt;
 	int err;
 
-	sunxi_wdt = devm_kzalloc(&pdev->dev, sizeof(*sunxi_wdt), GFP_KERNEL);
+	sunxi_wdt = devm_kzalloc(dev, sizeof(*sunxi_wdt), GFP_KERNEL);
 	if (!sunxi_wdt)
 		return -EINVAL;
 
-	sunxi_wdt->wdt_regs = of_device_get_match_data(&pdev->dev);
+	sunxi_wdt->wdt_regs = of_device_get_match_data(dev);
 	if (!sunxi_wdt->wdt_regs)
 		return -ENODEV;
 
@@ -253,9 +254,9 @@ static int sunxi_wdt_probe(struct platform_device *pdev)
 	sunxi_wdt->wdt_dev.timeout = WDT_MAX_TIMEOUT;
 	sunxi_wdt->wdt_dev.max_timeout = WDT_MAX_TIMEOUT;
 	sunxi_wdt->wdt_dev.min_timeout = WDT_MIN_TIMEOUT;
-	sunxi_wdt->wdt_dev.parent = &pdev->dev;
+	sunxi_wdt->wdt_dev.parent = dev;
 
-	watchdog_init_timeout(&sunxi_wdt->wdt_dev, timeout, &pdev->dev);
+	watchdog_init_timeout(&sunxi_wdt->wdt_dev, timeout, dev);
 	watchdog_set_nowayout(&sunxi_wdt->wdt_dev, nowayout);
 	watchdog_set_restart_priority(&sunxi_wdt->wdt_dev, 128);
 
@@ -264,12 +265,12 @@ static int sunxi_wdt_probe(struct platform_device *pdev)
 	sunxi_wdt_stop(&sunxi_wdt->wdt_dev);
 
 	watchdog_stop_on_reboot(&sunxi_wdt->wdt_dev);
-	err = devm_watchdog_register_device(&pdev->dev, &sunxi_wdt->wdt_dev);
+	err = devm_watchdog_register_device(dev, &sunxi_wdt->wdt_dev);
 	if (unlikely(err))
 		return err;
 
-	dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)",
-			sunxi_wdt->wdt_dev.timeout, nowayout);
+	dev_info(dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)",
+		 sunxi_wdt->wdt_dev.timeout, nowayout);
 
 	return 0;
 }
-- 
2.7.4


  parent reply index

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09 17:23 [PATCH 00/23] watchdog: Expand use of device managed functions (series 2 of 3) Guenter Roeck
2019-04-09 17:23 ` [PATCH 01/23] watchdog: max77620_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-09 17:23 ` [PATCH 02/23] watchdog: mena21_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-11  7:18   ` Johannes Thumshirn
2019-04-09 17:23 ` [PATCH 03/23] watchdog: menf21bmc_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-09 17:23 ` [PATCH 04/23] watchdog: meson_gxbb_wdt: " Guenter Roeck
2019-04-09 17:23 ` [PATCH 05/23] watchdog: meson_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-09 17:23 ` [PATCH 06/23] watchdog: mlx_wdt: " Guenter Roeck
2019-04-09 17:23 ` [PATCH 07/23] watchdog: moxart_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-09 17:23 ` [PATCH 08/23] watchdog: mtk_wdt: " Guenter Roeck
2019-04-09 17:23 ` [PATCH 09/23] watchdog: npcm_wdt: Use local variable 'dev' consistently Guenter Roeck
2019-04-09 17:23 ` [PATCH 10/23] watchdog: of_xilinx_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-10  6:38   ` Michal Simek
2019-04-10 12:09     ` Guenter Roeck
2019-04-09 17:23 ` [PATCH 11/23] watchdog: pm8916_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-09 17:23 ` [PATCH 12/23] watchdog: qcom-wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-09 17:23 ` [PATCH 13/23] watchdog: rn5t618_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-09 17:23 ` [PATCH 14/23] watchdog: rtd119x_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-09 17:23 ` [PATCH 15/23] watchdog: rza_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-09 17:23 ` [PATCH 16/23] watchdog: sama5d4_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-09 17:23 ` [PATCH 17/23] watchdog: sirfsoc_wdt: " Guenter Roeck
2019-04-09 17:23 ` [PATCH 18/23] watchdog: 1: " Guenter Roeck
2019-04-09 17:38   ` Guenter Roeck
2019-04-09 17:23 ` [PATCH 19/23] watchdog: st_lpc_wdt: Convert to use device managed functions Guenter Roeck
2019-04-10  7:26   ` Patrice CHOTARD
2019-04-09 17:23 ` [PATCH 20/23] watchdog: stmp3xxx_rtc_wdt: " Guenter Roeck
2019-04-09 17:23 ` [PATCH 21/23] watchdog: stpmic1_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-09 17:24 ` Guenter Roeck [this message]
2019-04-10  7:06   ` [PATCH 22/23] watchdog: sunxi_wdt: " Maxime Ripard
2019-04-09 17:24 ` [PATCH 23/23] watchdog: tangox_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-10 11:20   ` Måns Rullgård

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1554830641-9247-23-git-send-email-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=wens@csie.org \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org
	public-inbox-index linux-watchdog

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git