Skip to contentSkip to conversation

watchdog: s3c2410_wdt: use dev_err()/dev_info() instead of pr_err()/pr_info()

PATCH Superseded Jingoo Han 2 participants 4 messages Mar 14, 2013 – May 26, 2013

Subsystems (2)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/2 watchdog: s3c2410_wdt: use dev_err()/dev_info() instead of pr_err()/pr_info()

dev_err()/dev_info() are more preferred than pr_err()/pr_info().

---
 drivers/watchdog/s3c2410_wdt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/s3c2410_wdt.c +2 -2
index c1a221c..c681353 100644
@@ -350,7 +350,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
 
 	ret = s3c2410wdt_cpufreq_register();
 	if (ret < 0) {
-		pr_err("failed to register cpufreq\n");
+		dev_err(dev, "failed to register cpufreq\n");
 		goto err_clk;
 	}
 
@@ -465,7 +465,7 @@ static int s3c2410wdt_resume(struct platform_device *dev)
 	writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */
 	writel(wtcon_save, wdt_base + S3C2410_WTCON);
 
-	pr_info("watchdog %sabled\n",
+	dev_info(&dev->dev, "watchdog %sabled\n",
 		(wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis");
 
 	return 0;
Signature · 1 line
1.7.2.5
author
#1 lore raw

PATCH 2/2 watchdog: s3c2410_wdt: convert s3c2410wdt to dev_pm_ops

Instead of using legacy suspend/resume methods, using newer dev_pm_ops structure allows better control over power management.

---
 drivers/watchdog/s3c2410_wdt.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
drivers/watchdog/s3c2410_wdt.c +8 -10
index c681353..803e77d 100644
@@ -440,12 +440,12 @@ static void s3c2410wdt_shutdown(struct platform_device *dev)
 	s3c2410wdt_stop(&s3c2410_wdd);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
 static unsigned long wtcon_save;
 static unsigned long wtdat_save;
 
-static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state)
+static int s3c2410wdt_suspend(struct device *dev)
 {
 	/* Save watchdog state, and turn it off. */
 	wtcon_save = readl(wdt_base + S3C2410_WTCON);
@@ -457,7 +457,7 @@ static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
-static int s3c2410wdt_resume(struct platform_device *dev)
+static int s3c2410wdt_resume(struct device *dev)
 {
 	/* Restore watchdog state. */
 
@@ -465,16 +465,15 @@ static int s3c2410wdt_resume(struct platform_device *dev)
 	writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */
 	writel(wtcon_save, wdt_base + S3C2410_WTCON);
 
-	dev_info(&dev->dev, "watchdog %sabled\n",
+	dev_info(dev, "watchdog %sabled\n",
 		(wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis");
 
 	return 0;
 }
+#endif
 
-#else
-#define s3c2410wdt_suspend NULL
-#define s3c2410wdt_resume  NULL
-#endif /* CONFIG_PM */
+static SIMPLE_DEV_PM_OPS(s3c2410wdt_pm_ops, s3c2410wdt_suspend,
+			s3c2410wdt_resume);
 
 #ifdef CONFIG_OF
 static const struct of_device_id s3c2410_wdt_match[] = {
@@ -488,11 +487,10 @@ static struct platform_driver s3c2410wdt_driver = {
 	.probe		= s3c2410wdt_probe,
 	.remove		= s3c2410wdt_remove,
 	.shutdown	= s3c2410wdt_shutdown,
-	.suspend	= s3c2410wdt_suspend,
-	.resume		= s3c2410wdt_resume,
 	.driver		= {
 		.owner	= THIS_MODULE,
 		.name	= "s3c2410-wdt",
+		.pm	= &s3c2410wdt_pm_ops,
 		.of_match_table	= of_match_ptr(s3c2410_wdt_match),
 	},
 };
Signature · 1 line
1.7.2.5
#2 lore raw

Re: [PATCH 2/2] watchdog: s3c2410_wdt: convert s3c2410wdt to dev_pm_ops

Hi Jingoo,

Quoted 8 lines

Instead of using legacy suspend/resume methods, using newer dev_pm_ops structure allows better control over power management.

---
 drivers/watchdog/s3c2410_wdt.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

Patch added to linux-watchdog-next.

Kind regards,
Wim.