From: Guenter Roeck Date: Tue, 9 Apr 2019 17:23:51 +0000 (-0700) Subject: watchdog: rn5t618_wdt: Use 'dev' instead of dereferencing it repeatedly X-Git-Tag: v5.15~6382^2~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc71859708e84f0ede91b46a1c3abe1cd5510828;p=platform%2Fkernel%2Flinux-starfive.git 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 --- diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c index e60f557..21fcb36 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);