From cc71859708e84f0ede91b46a1c3abe1cd5510828 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Tue, 9 Apr 2019 10:23:51 -0700 Subject: [PATCH] watchdog: rn5t618_wdt: Use 'dev' instead of dereferencing it repeatedly 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 Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/rn5t618_wdt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c index e60f55702ab7..21fcb36f9074 100644 --- a/drivers/watchdog/rn5t618_wdt.c +++ b/drivers/watchdog/rn5t618_wdt.c @@ -146,11 +146,12 @@ static const struct watchdog_ops rn5t618_wdt_ops = { static int rn5t618_wdt_probe(struct platform_device *pdev) { - struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent); + struct device *dev = &pdev->dev; + struct rn5t618 *rn5t618 = dev_get_drvdata(dev->parent); struct rn5t618_wdt *wdt; int min_timeout, max_timeout; - wdt = devm_kzalloc(&pdev->dev, sizeof(struct rn5t618_wdt), GFP_KERNEL); + wdt = devm_kzalloc(dev, sizeof(struct rn5t618_wdt), GFP_KERNEL); if (!wdt) return -ENOMEM; @@ -163,10 +164,10 @@ static int rn5t618_wdt_probe(struct platform_device *pdev) wdt->wdt_dev.min_timeout = min_timeout; wdt->wdt_dev.max_timeout = max_timeout; wdt->wdt_dev.timeout = max_timeout; - wdt->wdt_dev.parent = &pdev->dev; + wdt->wdt_dev.parent = dev; watchdog_set_drvdata(&wdt->wdt_dev, wdt); - watchdog_init_timeout(&wdt->wdt_dev, timeout, &pdev->dev); + watchdog_init_timeout(&wdt->wdt_dev, timeout, dev); watchdog_set_nowayout(&wdt->wdt_dev, nowayout); platform_set_drvdata(pdev, wdt);