watchdog: intel-mid_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>
This commit is contained in:
parent
1f25cb2892
commit
b7b6adf32c
@ -110,12 +110,13 @@ static const struct watchdog_ops mid_wdt_ops = {
|
||||
|
||||
static int mid_wdt_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct watchdog_device *wdt_dev;
|
||||
struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
|
||||
struct intel_mid_wdt_pdata *pdata = dev->platform_data;
|
||||
int ret;
|
||||
|
||||
if (!pdata) {
|
||||
dev_err(&pdev->dev, "missing platform data\n");
|
||||
dev_err(dev, "missing platform data\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -125,7 +126,7 @@ static int mid_wdt_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
wdt_dev = devm_kzalloc(&pdev->dev, sizeof(*wdt_dev), GFP_KERNEL);
|
||||
wdt_dev = devm_kzalloc(dev, sizeof(*wdt_dev), GFP_KERNEL);
|
||||
if (!wdt_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -134,16 +135,15 @@ static int mid_wdt_probe(struct platform_device *pdev)
|
||||
wdt_dev->min_timeout = MID_WDT_TIMEOUT_MIN;
|
||||
wdt_dev->max_timeout = MID_WDT_TIMEOUT_MAX;
|
||||
wdt_dev->timeout = MID_WDT_DEFAULT_TIMEOUT;
|
||||
wdt_dev->parent = &pdev->dev;
|
||||
wdt_dev->parent = dev;
|
||||
|
||||
watchdog_set_drvdata(wdt_dev, &pdev->dev);
|
||||
watchdog_set_drvdata(wdt_dev, dev);
|
||||
|
||||
ret = devm_request_irq(&pdev->dev, pdata->irq, mid_wdt_irq,
|
||||
ret = devm_request_irq(dev, pdata->irq, mid_wdt_irq,
|
||||
IRQF_SHARED | IRQF_NO_SUSPEND, "watchdog",
|
||||
wdt_dev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "error requesting warning irq %d\n",
|
||||
pdata->irq);
|
||||
dev_err(dev, "error requesting warning irq %d\n", pdata->irq);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -163,13 +163,13 @@ static int mid_wdt_probe(struct platform_device *pdev)
|
||||
/* Make sure the watchdog is serviced */
|
||||
set_bit(WDOG_HW_RUNNING, &wdt_dev->status);
|
||||
|
||||
ret = devm_watchdog_register_device(&pdev->dev, wdt_dev);
|
||||
ret = devm_watchdog_register_device(dev, wdt_dev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "error registering watchdog device\n");
|
||||
dev_err(dev, "error registering watchdog device\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_info(&pdev->dev, "Intel MID watchdog device probed\n");
|
||||
dev_info(dev, "Intel MID watchdog device probed\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user