Commit 86865322 authored by Anson Huang's avatar Anson Huang Committed by Wim Van Sebroeck

watchdog: imx2_wdt: Use 'dev' instead of dereferencing it repeatedly

Add helper variable dev = &pdev->dev to simply the code.
Signed-off-by: default avatarAnson Huang <Anson.Huang@nxp.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/1569308828-8320-3-git-send-email-Anson.Huang@nxp.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent ebe66ded
...@@ -246,13 +246,14 @@ static const struct regmap_config imx2_wdt_regmap_config = { ...@@ -246,13 +246,14 @@ static const struct regmap_config imx2_wdt_regmap_config = {
static int __init imx2_wdt_probe(struct platform_device *pdev) static int __init imx2_wdt_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev;
struct imx2_wdt_device *wdev; struct imx2_wdt_device *wdev;
struct watchdog_device *wdog; struct watchdog_device *wdog;
void __iomem *base; void __iomem *base;
int ret; int ret;
u32 val; u32 val;
wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL); wdev = devm_kzalloc(dev, sizeof(*wdev), GFP_KERNEL);
if (!wdev) if (!wdev)
return -ENOMEM; return -ENOMEM;
...@@ -260,16 +261,16 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) ...@@ -260,16 +261,16 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
if (IS_ERR(base)) if (IS_ERR(base))
return PTR_ERR(base); return PTR_ERR(base);
wdev->regmap = devm_regmap_init_mmio_clk(&pdev->dev, NULL, base, wdev->regmap = devm_regmap_init_mmio_clk(dev, NULL, base,
&imx2_wdt_regmap_config); &imx2_wdt_regmap_config);
if (IS_ERR(wdev->regmap)) { if (IS_ERR(wdev->regmap)) {
dev_err(&pdev->dev, "regmap init failed\n"); dev_err(dev, "regmap init failed\n");
return PTR_ERR(wdev->regmap); return PTR_ERR(wdev->regmap);
} }
wdev->clk = devm_clk_get(&pdev->dev, NULL); wdev->clk = devm_clk_get(dev, NULL);
if (IS_ERR(wdev->clk)) { if (IS_ERR(wdev->clk)) {
dev_err(&pdev->dev, "can't get Watchdog clock\n"); dev_err(dev, "can't get Watchdog clock\n");
return PTR_ERR(wdev->clk); return PTR_ERR(wdev->clk);
} }
...@@ -279,12 +280,12 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) ...@@ -279,12 +280,12 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
wdog->min_timeout = 1; wdog->min_timeout = 1;
wdog->timeout = IMX2_WDT_DEFAULT_TIME; wdog->timeout = IMX2_WDT_DEFAULT_TIME;
wdog->max_hw_heartbeat_ms = IMX2_WDT_MAX_TIME * 1000; wdog->max_hw_heartbeat_ms = IMX2_WDT_MAX_TIME * 1000;
wdog->parent = &pdev->dev; wdog->parent = dev;
ret = platform_get_irq(pdev, 0); ret = platform_get_irq(pdev, 0);
if (ret > 0) if (ret > 0)
if (!devm_request_irq(&pdev->dev, ret, imx2_wdt_isr, 0, if (!devm_request_irq(dev, ret, imx2_wdt_isr, 0,
dev_name(&pdev->dev), wdog)) dev_name(dev), wdog))
wdog->info = &imx2_wdt_pretimeout_info; wdog->info = &imx2_wdt_pretimeout_info;
ret = clk_prepare_enable(wdev->clk); ret = clk_prepare_enable(wdev->clk);
...@@ -294,13 +295,13 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) ...@@ -294,13 +295,13 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
regmap_read(wdev->regmap, IMX2_WDT_WRSR, &val); regmap_read(wdev->regmap, IMX2_WDT_WRSR, &val);
wdog->bootstatus = val & IMX2_WDT_WRSR_TOUT ? WDIOF_CARDRESET : 0; wdog->bootstatus = val & IMX2_WDT_WRSR_TOUT ? WDIOF_CARDRESET : 0;
wdev->ext_reset = of_property_read_bool(pdev->dev.of_node, wdev->ext_reset = of_property_read_bool(dev->of_node,
"fsl,ext-reset-output"); "fsl,ext-reset-output");
platform_set_drvdata(pdev, wdog); platform_set_drvdata(pdev, wdog);
watchdog_set_drvdata(wdog, wdev); watchdog_set_drvdata(wdog, wdev);
watchdog_set_nowayout(wdog, nowayout); watchdog_set_nowayout(wdog, nowayout);
watchdog_set_restart_priority(wdog, 128); watchdog_set_restart_priority(wdog, 128);
watchdog_init_timeout(wdog, timeout, &pdev->dev); watchdog_init_timeout(wdog, timeout, dev);
if (imx2_wdt_is_running(wdev)) { if (imx2_wdt_is_running(wdev)) {
imx2_wdt_set_timeout(wdog, wdog->timeout); imx2_wdt_set_timeout(wdog, wdog->timeout);
...@@ -318,7 +319,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev) ...@@ -318,7 +319,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
if (ret) if (ret)
goto disable_clk; goto disable_clk;
dev_info(&pdev->dev, "timeout %d sec (nowayout=%d)\n", dev_info(dev, "timeout %d sec (nowayout=%d)\n",
wdog->timeout, nowayout); wdog->timeout, nowayout);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment