Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: stpmic1_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 <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Guenter Roeck and committed by
Wim Van Sebroeck
d07c4ad8 55082c03

+7 -6
+7 -6
drivers/watchdog/stpmic1_wdt.c
··· 81 81 82 82 static int pmic_wdt_probe(struct platform_device *pdev) 83 83 { 84 + struct device *dev = &pdev->dev; 84 85 int ret; 85 86 struct stpmic1 *pmic; 86 87 struct stpmic1_wdt *wdt; 87 88 88 - if (!pdev->dev.parent) 89 + if (!dev->parent) 89 90 return -EINVAL; 90 91 91 - pmic = dev_get_drvdata(pdev->dev.parent); 92 + pmic = dev_get_drvdata(dev->parent); 92 93 if (!pmic) 93 94 return -EINVAL; 94 95 95 - wdt = devm_kzalloc(&pdev->dev, sizeof(struct stpmic1_wdt), GFP_KERNEL); 96 + wdt = devm_kzalloc(dev, sizeof(struct stpmic1_wdt), GFP_KERNEL); 96 97 if (!wdt) 97 98 return -ENOMEM; 98 99 ··· 103 102 wdt->wdtdev.ops = &pmic_watchdog_ops; 104 103 wdt->wdtdev.min_timeout = PMIC_WDT_MIN_TIMEOUT; 105 104 wdt->wdtdev.max_timeout = PMIC_WDT_MAX_TIMEOUT; 106 - wdt->wdtdev.parent = &pdev->dev; 105 + wdt->wdtdev.parent = dev; 107 106 108 107 wdt->wdtdev.timeout = PMIC_WDT_DEFAULT_TIMEOUT; 109 - watchdog_init_timeout(&wdt->wdtdev, 0, &pdev->dev); 108 + watchdog_init_timeout(&wdt->wdtdev, 0, dev); 110 109 111 110 watchdog_set_nowayout(&wdt->wdtdev, nowayout); 112 111 watchdog_set_drvdata(&wdt->wdtdev, wdt); 113 112 114 - ret = devm_watchdog_register_device(&pdev->dev, &wdt->wdtdev); 113 + ret = devm_watchdog_register_device(dev, &wdt->wdtdev); 115 114 if (ret) 116 115 return ret; 117 116