* [PATCH 1/3] watchdog: imx2_wdt: Remove unnecessary blank line
@ 2019-09-24 7:07 Anson Huang
2019-09-24 7:07 ` [PATCH 2/3] watchdog: imx2_wdt: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Anson Huang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Anson Huang @ 2019-09-24 7:07 UTC (permalink / raw)
To: wim, linux, shawnguo, s.hauer, kernel, festevam, linux-watchdog,
linux-arm-kernel, linux-kernel
Cc: Linux-imx
Remove unnecessary blank line.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
drivers/watchdog/imx2_wdt.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 8d019a9..6711b4e 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -72,7 +72,6 @@ module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-
static unsigned timeout;
module_param(timeout, uint, 0);
MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default="
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] watchdog: imx2_wdt: Use __maybe_unused instead of #if CONFIG_PM_SLEEP
2019-09-24 7:07 [PATCH 1/3] watchdog: imx2_wdt: Remove unnecessary blank line Anson Huang
@ 2019-09-24 7:07 ` Anson Huang
2019-09-30 13:17 ` Guenter Roeck
2019-09-24 7:07 ` [PATCH 3/3] watchdog: imx2_wdt: Use 'dev' instead of dereferencing it repeatedly Anson Huang
2019-09-30 13:17 ` [PATCH 1/3] watchdog: imx2_wdt: Remove unnecessary blank line Guenter Roeck
2 siblings, 1 reply; 6+ messages in thread
From: Anson Huang @ 2019-09-24 7:07 UTC (permalink / raw)
To: wim, linux, shawnguo, s.hauer, kernel, festevam, linux-watchdog,
linux-arm-kernel, linux-kernel
Cc: Linux-imx
Use __maybe_unused for power management related functions instead
of #if CONFIG_PM_SLEEP to simply the code.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
drivers/watchdog/imx2_wdt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 6711b4e..034f32c 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -358,9 +358,8 @@ static void imx2_wdt_shutdown(struct platform_device *pdev)
}
}
-#ifdef CONFIG_PM_SLEEP
/* Disable watchdog if it is active or non-active but still running */
-static int imx2_wdt_suspend(struct device *dev)
+static int __maybe_unused imx2_wdt_suspend(struct device *dev)
{
struct watchdog_device *wdog = dev_get_drvdata(dev);
struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog);
@@ -381,7 +380,7 @@ static int imx2_wdt_suspend(struct device *dev)
}
/* Enable watchdog and configure it if necessary */
-static int imx2_wdt_resume(struct device *dev)
+static int __maybe_unused imx2_wdt_resume(struct device *dev)
{
struct watchdog_device *wdog = dev_get_drvdata(dev);
struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog);
@@ -406,7 +405,6 @@ static int imx2_wdt_resume(struct device *dev)
return 0;
}
-#endif
static SIMPLE_DEV_PM_OPS(imx2_wdt_pm_ops, imx2_wdt_suspend,
imx2_wdt_resume);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] watchdog: imx2_wdt: Use 'dev' instead of dereferencing it repeatedly
2019-09-24 7:07 [PATCH 1/3] watchdog: imx2_wdt: Remove unnecessary blank line Anson Huang
2019-09-24 7:07 ` [PATCH 2/3] watchdog: imx2_wdt: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Anson Huang
@ 2019-09-24 7:07 ` Anson Huang
2019-09-30 13:18 ` Guenter Roeck
2019-09-30 13:17 ` [PATCH 1/3] watchdog: imx2_wdt: Remove unnecessary blank line Guenter Roeck
2 siblings, 1 reply; 6+ messages in thread
From: Anson Huang @ 2019-09-24 7:07 UTC (permalink / raw)
To: wim, linux, shawnguo, s.hauer, kernel, festevam, linux-watchdog,
linux-arm-kernel, linux-kernel
Cc: Linux-imx
Add helper variable dev = &pdev->dev to simply the code.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
drivers/watchdog/imx2_wdt.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 034f32c..f8d58bf 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -246,13 +246,14 @@ static const struct regmap_config imx2_wdt_regmap_config = {
static int __init imx2_wdt_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct imx2_wdt_device *wdev;
struct watchdog_device *wdog;
void __iomem *base;
int ret;
u32 val;
- wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
+ wdev = devm_kzalloc(dev, sizeof(*wdev), GFP_KERNEL);
if (!wdev)
return -ENOMEM;
@@ -260,16 +261,16 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
if (IS_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);
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);
}
- wdev->clk = devm_clk_get(&pdev->dev, NULL);
+ wdev->clk = devm_clk_get(dev, NULL);
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);
}
@@ -279,12 +280,12 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
wdog->min_timeout = 1;
wdog->timeout = IMX2_WDT_DEFAULT_TIME;
wdog->max_hw_heartbeat_ms = IMX2_WDT_MAX_TIME * 1000;
- wdog->parent = &pdev->dev;
+ wdog->parent = dev;
ret = platform_get_irq(pdev, 0);
if (ret > 0)
- if (!devm_request_irq(&pdev->dev, ret, imx2_wdt_isr, 0,
- dev_name(&pdev->dev), wdog))
+ if (!devm_request_irq(dev, ret, imx2_wdt_isr, 0,
+ dev_name(dev), wdog))
wdog->info = &imx2_wdt_pretimeout_info;
ret = clk_prepare_enable(wdev->clk);
@@ -294,13 +295,13 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
regmap_read(wdev->regmap, IMX2_WDT_WRSR, &val);
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");
platform_set_drvdata(pdev, wdog);
watchdog_set_drvdata(wdog, wdev);
watchdog_set_nowayout(wdog, nowayout);
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)) {
imx2_wdt_set_timeout(wdog, wdog->timeout);
@@ -318,7 +319,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
if (ret)
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);
return 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] watchdog: imx2_wdt: Remove unnecessary blank line
2019-09-24 7:07 [PATCH 1/3] watchdog: imx2_wdt: Remove unnecessary blank line Anson Huang
2019-09-24 7:07 ` [PATCH 2/3] watchdog: imx2_wdt: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Anson Huang
2019-09-24 7:07 ` [PATCH 3/3] watchdog: imx2_wdt: Use 'dev' instead of dereferencing it repeatedly Anson Huang
@ 2019-09-30 13:17 ` Guenter Roeck
2 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2019-09-30 13:17 UTC (permalink / raw)
To: Anson Huang
Cc: wim, shawnguo, s.hauer, kernel, festevam, linux-watchdog,
linux-arm-kernel, linux-kernel, Linux-imx
On Tue, Sep 24, 2019 at 03:07:06PM +0800, Anson Huang wrote:
> Remove unnecessary blank line.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/imx2_wdt.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
> index 8d019a9..6711b4e 100644
> --- a/drivers/watchdog/imx2_wdt.c
> +++ b/drivers/watchdog/imx2_wdt.c
> @@ -72,7 +72,6 @@ module_param(nowayout, bool, 0);
> MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
> __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>
> -
> static unsigned timeout;
> module_param(timeout, uint, 0);
> MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds (default="
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] watchdog: imx2_wdt: Use __maybe_unused instead of #if CONFIG_PM_SLEEP
2019-09-24 7:07 ` [PATCH 2/3] watchdog: imx2_wdt: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Anson Huang
@ 2019-09-30 13:17 ` Guenter Roeck
0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2019-09-30 13:17 UTC (permalink / raw)
To: Anson Huang
Cc: wim, shawnguo, s.hauer, kernel, festevam, linux-watchdog,
linux-arm-kernel, linux-kernel, Linux-imx
On Tue, Sep 24, 2019 at 03:07:07PM +0800, Anson Huang wrote:
> Use __maybe_unused for power management related functions instead
> of #if CONFIG_PM_SLEEP to simply the code.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/imx2_wdt.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
> index 6711b4e..034f32c 100644
> --- a/drivers/watchdog/imx2_wdt.c
> +++ b/drivers/watchdog/imx2_wdt.c
> @@ -358,9 +358,8 @@ static void imx2_wdt_shutdown(struct platform_device *pdev)
> }
> }
>
> -#ifdef CONFIG_PM_SLEEP
> /* Disable watchdog if it is active or non-active but still running */
> -static int imx2_wdt_suspend(struct device *dev)
> +static int __maybe_unused imx2_wdt_suspend(struct device *dev)
> {
> struct watchdog_device *wdog = dev_get_drvdata(dev);
> struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog);
> @@ -381,7 +380,7 @@ static int imx2_wdt_suspend(struct device *dev)
> }
>
> /* Enable watchdog and configure it if necessary */
> -static int imx2_wdt_resume(struct device *dev)
> +static int __maybe_unused imx2_wdt_resume(struct device *dev)
> {
> struct watchdog_device *wdog = dev_get_drvdata(dev);
> struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog);
> @@ -406,7 +405,6 @@ static int imx2_wdt_resume(struct device *dev)
>
> return 0;
> }
> -#endif
>
> static SIMPLE_DEV_PM_OPS(imx2_wdt_pm_ops, imx2_wdt_suspend,
> imx2_wdt_resume);
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] watchdog: imx2_wdt: Use 'dev' instead of dereferencing it repeatedly
2019-09-24 7:07 ` [PATCH 3/3] watchdog: imx2_wdt: Use 'dev' instead of dereferencing it repeatedly Anson Huang
@ 2019-09-30 13:18 ` Guenter Roeck
0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2019-09-30 13:18 UTC (permalink / raw)
To: Anson Huang
Cc: wim, shawnguo, s.hauer, kernel, festevam, linux-watchdog,
linux-arm-kernel, linux-kernel, Linux-imx
On Tue, Sep 24, 2019 at 03:07:08PM +0800, Anson Huang wrote:
> Add helper variable dev = &pdev->dev to simply the code.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/imx2_wdt.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
> index 034f32c..f8d58bf 100644
> --- a/drivers/watchdog/imx2_wdt.c
> +++ b/drivers/watchdog/imx2_wdt.c
> @@ -246,13 +246,14 @@ static const struct regmap_config imx2_wdt_regmap_config = {
>
> static int __init imx2_wdt_probe(struct platform_device *pdev)
> {
> + struct device *dev = &pdev->dev;
> struct imx2_wdt_device *wdev;
> struct watchdog_device *wdog;
> void __iomem *base;
> int ret;
> u32 val;
>
> - wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
> + wdev = devm_kzalloc(dev, sizeof(*wdev), GFP_KERNEL);
> if (!wdev)
> return -ENOMEM;
>
> @@ -260,16 +261,16 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
> if (IS_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);
> 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);
> }
>
> - wdev->clk = devm_clk_get(&pdev->dev, NULL);
> + wdev->clk = devm_clk_get(dev, NULL);
> 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);
> }
>
> @@ -279,12 +280,12 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
> wdog->min_timeout = 1;
> wdog->timeout = IMX2_WDT_DEFAULT_TIME;
> wdog->max_hw_heartbeat_ms = IMX2_WDT_MAX_TIME * 1000;
> - wdog->parent = &pdev->dev;
> + wdog->parent = dev;
>
> ret = platform_get_irq(pdev, 0);
> if (ret > 0)
> - if (!devm_request_irq(&pdev->dev, ret, imx2_wdt_isr, 0,
> - dev_name(&pdev->dev), wdog))
> + if (!devm_request_irq(dev, ret, imx2_wdt_isr, 0,
> + dev_name(dev), wdog))
> wdog->info = &imx2_wdt_pretimeout_info;
>
> ret = clk_prepare_enable(wdev->clk);
> @@ -294,13 +295,13 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
> regmap_read(wdev->regmap, IMX2_WDT_WRSR, &val);
> 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");
> platform_set_drvdata(pdev, wdog);
> watchdog_set_drvdata(wdog, wdev);
> watchdog_set_nowayout(wdog, nowayout);
> 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)) {
> imx2_wdt_set_timeout(wdog, wdog->timeout);
> @@ -318,7 +319,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
> if (ret)
> 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);
>
> return 0;
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-09-30 13:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24 7:07 [PATCH 1/3] watchdog: imx2_wdt: Remove unnecessary blank line Anson Huang
2019-09-24 7:07 ` [PATCH 2/3] watchdog: imx2_wdt: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Anson Huang
2019-09-30 13:17 ` Guenter Roeck
2019-09-24 7:07 ` [PATCH 3/3] watchdog: imx2_wdt: Use 'dev' instead of dereferencing it repeatedly Anson Huang
2019-09-30 13:18 ` Guenter Roeck
2019-09-30 13:17 ` [PATCH 1/3] watchdog: imx2_wdt: Remove unnecessary blank line Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).