* [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info
@ 2017-02-24 21:07 Krzysztof Kozlowski
2017-02-24 21:07 ` [PATCH 2/7] watchdog: s3c2410: Select MFD_SYSCON on all Exynos platforms Krzysztof Kozlowski
` (6 more replies)
0 siblings, 7 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 21:07 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
Replace the 'debug' module parameter and pr_info() with proper device
dynamic debug calls because this is the preferred and flexible way of
enabling debugging printks.
Also remove some obvious debug printks.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/watchdog/s3c2410_wdt.c | 29 ++++++-----------------------
1 file changed, 6 insertions(+), 23 deletions(-)
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 7db7847a005c..f7aad19d20ff 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -23,8 +23,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
@@ -83,13 +81,11 @@ static bool nowayout = WATCHDOG_NOWAYOUT;
static int tmr_margin;
static int tmr_atboot = S3C2410_WATCHDOG_ATBOOT;
static int soft_noboot;
-static int debug;
module_param(tmr_margin, int, 0);
module_param(tmr_atboot, int, 0);
module_param(nowayout, bool, 0);
module_param(soft_noboot, int, 0);
-module_param(debug, int, 0);
MODULE_PARM_DESC(tmr_margin, "Watchdog tmr_margin in seconds. (default="
__MODULE_STRING(S3C2410_WATCHDOG_DEFAULT_TIME) ")");
@@ -100,7 +96,6 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, "
"0 to reboot (default 0)");
-MODULE_PARM_DESC(debug, "Watchdog debug, set to >1 for debug (default 0)");
/**
* struct s3c2410_wdt_variant - Per-variant config data
@@ -204,14 +199,6 @@ static const struct platform_device_id s3c2410_wdt_ids[] = {
};
MODULE_DEVICE_TABLE(platform, s3c2410_wdt_ids);
-/* watchdog control routines */
-
-#define DBG(fmt, ...) \
-do { \
- if (debug) \
- pr_info(fmt, ##__VA_ARGS__); \
-} while (0)
-
/* functions */
static inline unsigned int s3c2410wdt_max_timeout(struct clk *clock)
@@ -307,8 +294,8 @@ static int s3c2410wdt_start(struct watchdog_device *wdd)
wtcon |= S3C2410_WTCON_RSTEN;
}
- DBG("%s: count=0x%08x, wtcon=%08lx\n",
- __func__, wdt->count, wtcon);
+ dev_dbg(wdt->dev, "Starting watchdog: count=0x%08x, wtcon=%08lx\n",
+ wdt->count, wtcon);
writel(wdt->count, wdt->reg_base + S3C2410_WTDAT);
writel(wdt->count, wdt->reg_base + S3C2410_WTCNT);
@@ -337,8 +324,8 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd, unsigned timeou
freq = DIV_ROUND_UP(freq, 128);
count = timeout * freq;
- DBG("%s: count=%d, timeout=%d, freq=%lu\n",
- __func__, count, timeout, freq);
+ dev_dbg(wdt->dev, "Heartbeat: count=%d, timeout=%d, freq=%lu\n",
+ count, timeout, freq);
/* if the count is bigger than the watchdog register,
then work out what we need to do (and if) we can
@@ -354,8 +341,8 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd, unsigned timeou
}
}
- DBG("%s: timeout=%d, divisor=%d, count=%d (%08x)\n",
- __func__, timeout, divisor, count, DIV_ROUND_UP(count, divisor));
+ dev_dbg(wdt->dev, "Heartbeat: timeout=%d, divisor=%d, count=%d (%08x)\n",
+ timeout, divisor, count, DIV_ROUND_UP(count, divisor));
count = DIV_ROUND_UP(count, divisor);
wdt->count = count;
@@ -544,8 +531,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
int started = 0;
int ret;
- DBG("%s: probe=%p\n", __func__, pdev);
-
dev = &pdev->dev;
wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
@@ -581,8 +566,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
goto err;
}
- DBG("probe: mapped reg_base=%p\n", wdt->reg_base);
-
wdt->clock = devm_clk_get(dev, "watchdog");
if (IS_ERR(wdt->clock)) {
dev_err(dev, "failed to find watchdog clock source\n");
--
2.9.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/7] watchdog: s3c2410: Select MFD_SYSCON on all Exynos platforms
2017-02-24 21:07 [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info Krzysztof Kozlowski
@ 2017-02-24 21:07 ` Krzysztof Kozlowski
2017-02-24 21:57 ` Guenter Roeck
2017-02-24 21:07 ` [PATCH 3/7] watchdog: s3c2410: Enable COMPILE_TEST Krzysztof Kozlowski
` (5 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 21:07 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
Syscon is used not only on Exynos5 SoCs but also on Exynos3250,
Exynos4412 and ARMv8 versions (Exynos5433, Exynos7).
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/watchdog/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index acb00b53a520..338c5bc46f73 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -335,7 +335,7 @@ config S3C2410_WATCHDOG
tristate "S3C2410 Watchdog"
depends on HAVE_S3C2410_WATCHDOG
select WATCHDOG_CORE
- select MFD_SYSCON if ARCH_EXYNOS5
+ select MFD_SYSCON if ARCH_EXYNOS
help
Watchdog timer block in the Samsung SoCs. This will reboot
the system when the timer expires with the watchdog enabled.
--
2.9.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/7] watchdog: s3c2410: Enable COMPILE_TEST
2017-02-24 21:07 [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info Krzysztof Kozlowski
2017-02-24 21:07 ` [PATCH 2/7] watchdog: s3c2410: Select MFD_SYSCON on all Exynos platforms Krzysztof Kozlowski
@ 2017-02-24 21:07 ` Krzysztof Kozlowski
2017-02-24 21:58 ` Guenter Roeck
2017-02-24 21:07 ` [PATCH 4/7] watchdog: s3c2410: Add prefix to local function Krzysztof Kozlowski
` (4 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 21:07 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
Driver can be compile tested on other architectures as well so use it to
increase build coverage.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/watchdog/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 338c5bc46f73..82d5f07b5e64 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -333,7 +333,7 @@ config HAVE_S3C2410_WATCHDOG
config S3C2410_WATCHDOG
tristate "S3C2410 Watchdog"
- depends on HAVE_S3C2410_WATCHDOG
+ depends on HAVE_S3C2410_WATCHDOG || COMPILE_TEST
select WATCHDOG_CORE
select MFD_SYSCON if ARCH_EXYNOS
help
--
2.9.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/7] watchdog: s3c2410: Add prefix to local function
2017-02-24 21:07 [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info Krzysztof Kozlowski
2017-02-24 21:07 ` [PATCH 2/7] watchdog: s3c2410: Select MFD_SYSCON on all Exynos platforms Krzysztof Kozlowski
2017-02-24 21:07 ` [PATCH 3/7] watchdog: s3c2410: Enable COMPILE_TEST Krzysztof Kozlowski
@ 2017-02-24 21:07 ` Krzysztof Kozlowski
2017-02-24 21:58 ` Guenter Roeck
2017-02-24 21:07 ` [PATCH 5/7] watchdog: s3c2410: Constify local structures Krzysztof Kozlowski
` (3 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 21:07 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
Functions marked static inline might not be inlined so a driver-specific
prefix for function name helps when looking through call backtrace.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/watchdog/s3c2410_wdt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index f7aad19d20ff..a031842ffcb0 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -507,9 +507,8 @@ static inline unsigned int s3c2410wdt_get_bootstatus(struct s3c2410_wdt *wdt)
return 0;
}
-/* s3c2410_get_wdt_driver_data */
static inline struct s3c2410_wdt_variant *
-get_wdt_drv_data(struct platform_device *pdev)
+s3c2410_get_wdt_drv_data(struct platform_device *pdev)
{
if (pdev->dev.of_node) {
const struct of_device_id *match;
@@ -541,7 +540,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
spin_lock_init(&wdt->lock);
wdt->wdt_device = s3c2410_wdd;
- wdt->drv_data = get_wdt_drv_data(pdev);
+ wdt->drv_data = s3c2410_get_wdt_drv_data(pdev);
if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) {
wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node,
"samsung,syscon-phandle");
--
2.9.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/7] watchdog: s3c2410: Constify local structures
2017-02-24 21:07 [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info Krzysztof Kozlowski
` (2 preceding siblings ...)
2017-02-24 21:07 ` [PATCH 4/7] watchdog: s3c2410: Add prefix to local function Krzysztof Kozlowski
@ 2017-02-24 21:07 ` Krzysztof Kozlowski
2017-02-24 22:05 ` Guenter Roeck
2017-02-24 21:07 ` [PATCH 6/7] watchdog: s3c2410: Simplify getting driver data Krzysztof Kozlowski
` (2 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 21:07 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
Structures watchdog_device, watchdog_ops and s3c2410_wdt_variant are not
modified so they can be made const to increase code safeness.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/watchdog/s3c2410_wdt.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index a031842ffcb0..5eaec319e499 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -131,7 +131,7 @@ struct s3c2410_wdt {
unsigned long wtdat_save;
struct watchdog_device wdt_device;
struct notifier_block freq_transition;
- struct s3c2410_wdt_variant *drv_data;
+ const struct s3c2410_wdt_variant *drv_data;
struct regmap *pmureg;
};
@@ -392,7 +392,7 @@ static const struct watchdog_info s3c2410_wdt_ident = {
.identity = "S3C2410 Watchdog",
};
-static struct watchdog_ops s3c2410wdt_ops = {
+static const struct watchdog_ops s3c2410wdt_ops = {
.owner = THIS_MODULE,
.start = s3c2410wdt_start,
.stop = s3c2410wdt_stop,
@@ -401,7 +401,7 @@ static struct watchdog_ops s3c2410wdt_ops = {
.restart = s3c2410wdt_restart,
};
-static struct watchdog_device s3c2410_wdd = {
+static const struct watchdog_device s3c2410_wdd = {
.info = &s3c2410_wdt_ident,
.ops = &s3c2410wdt_ops,
.timeout = S3C2410_WATCHDOG_DEFAULT_TIME,
@@ -507,15 +507,15 @@ static inline unsigned int s3c2410wdt_get_bootstatus(struct s3c2410_wdt *wdt)
return 0;
}
-static inline struct s3c2410_wdt_variant *
+static inline const struct s3c2410_wdt_variant *
s3c2410_get_wdt_drv_data(struct platform_device *pdev)
{
if (pdev->dev.of_node) {
const struct of_device_id *match;
match = of_match_node(s3c2410_wdt_match, pdev->dev.of_node);
- return (struct s3c2410_wdt_variant *)match->data;
+ return (const struct s3c2410_wdt_variant *)match->data;
} else {
- return (struct s3c2410_wdt_variant *)
+ return (const struct s3c2410_wdt_variant *)
platform_get_device_id(pdev)->driver_data;
}
}
--
2.9.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/7] watchdog: s3c2410: Simplify getting driver data
2017-02-24 21:07 [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info Krzysztof Kozlowski
` (3 preceding siblings ...)
2017-02-24 21:07 ` [PATCH 5/7] watchdog: s3c2410: Constify local structures Krzysztof Kozlowski
@ 2017-02-24 21:07 ` Krzysztof Kozlowski
2017-02-24 21:07 ` [PATCH 7/7] watchdog: s3c2410: Minor code cleanup Krzysztof Kozlowski
2017-02-24 21:56 ` [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info Guenter Roeck
6 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 21:07 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
Simplify the flow in helper function for getting the driver data by
using of_device_get_match_data() and only one if() branch.
The code should be equivalent.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/watchdog/s3c2410_wdt.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 5eaec319e499..d7ddee0668c3 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -37,6 +37,7 @@
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
#include <linux/delay.h>
@@ -510,14 +511,16 @@ static inline unsigned int s3c2410wdt_get_bootstatus(struct s3c2410_wdt *wdt)
static inline const struct s3c2410_wdt_variant *
s3c2410_get_wdt_drv_data(struct platform_device *pdev)
{
- if (pdev->dev.of_node) {
- const struct of_device_id *match;
- match = of_match_node(s3c2410_wdt_match, pdev->dev.of_node);
- return (const struct s3c2410_wdt_variant *)match->data;
- } else {
- return (const struct s3c2410_wdt_variant *)
- platform_get_device_id(pdev)->driver_data;
+ const struct s3c2410_wdt_variant *variant;
+
+ variant = of_device_get_match_data(&pdev->dev);
+ if (!variant) {
+ /* Device matched by platform_device_id */
+ variant = (const struct s3c2410_wdt_variant *)
+ platform_get_device_id(pdev)->driver_data;
}
+
+ return variant;
}
static int s3c2410wdt_probe(struct platform_device *pdev)
--
2.9.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 7/7] watchdog: s3c2410: Minor code cleanup
2017-02-24 21:07 [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info Krzysztof Kozlowski
` (4 preceding siblings ...)
2017-02-24 21:07 ` [PATCH 6/7] watchdog: s3c2410: Simplify getting driver data Krzysztof Kozlowski
@ 2017-02-24 21:07 ` Krzysztof Kozlowski
2017-02-24 21:56 ` [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info Guenter Roeck
6 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 21:07 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
Cleanup the code from minor readability issues (no functional changes):
1. Fix checkpatch: ERROR: Do not include the paragraph about writing to
the Free Software Foundation's mailing address.
2. Fix checkpatch: WARNING: quoted string split across lines
3. Fix chechpatch: WARNING: Prefer 'unsigned int' to bare use of
'unsigned'
4. Use 'dev' consistently in probe function instead of mixing dev with
&pdev->dev.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/watchdog/s3c2410_wdt.c | 35 +++++++++++++----------------------
1 file changed, 13 insertions(+), 22 deletions(-)
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index d7ddee0668c3..89c7e98ae278 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -1,5 +1,4 @@
-/* linux/drivers/char/watchdog/s3c2410_wdt.c
- *
+/*
* Copyright (c) 2004 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
*
@@ -17,11 +16,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ */
#include <linux/module.h>
#include <linux/moduleparam.h>
@@ -95,8 +90,7 @@ MODULE_PARM_DESC(tmr_atboot,
__MODULE_STRING(S3C2410_WATCHDOG_ATBOOT));
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, "
- "0 to reboot (default 0)");
+MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, 0 to reboot (default 0)");
/**
* struct s3c2410_wdt_variant - Per-variant config data
@@ -311,7 +305,8 @@ static inline int s3c2410wdt_is_running(struct s3c2410_wdt *wdt)
return readl(wdt->reg_base + S3C2410_WTCON) & S3C2410_WTCON_ENABLE;
}
-static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd, unsigned timeout)
+static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd,
+ unsigned int timeout)
{
struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd);
unsigned long freq = clk_get_rate(wdt->clock);
@@ -525,7 +520,7 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev)
static int s3c2410wdt_probe(struct platform_device *pdev)
{
- struct device *dev;
+ struct device *dev = &pdev->dev;
struct s3c2410_wdt *wdt;
struct resource *wdt_mem;
struct resource *wdt_irq;
@@ -533,13 +528,11 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
int started = 0;
int ret;
- dev = &pdev->dev;
-
wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
if (!wdt)
return -ENOMEM;
- wdt->dev = &pdev->dev;
+ wdt->dev = dev;
spin_lock_init(&wdt->lock);
wdt->wdt_device = s3c2410_wdd;
@@ -595,7 +588,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
/* see if we can actually set the requested timer margin, and if
* not, try the default value */
- watchdog_init_timeout(&wdt->wdt_device, tmr_margin, &pdev->dev);
+ watchdog_init_timeout(&wdt->wdt_device, tmr_margin, dev);
ret = s3c2410wdt_set_heartbeat(&wdt->wdt_device,
wdt->wdt_device.timeout);
if (ret) {
@@ -604,11 +597,10 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
if (started == 0)
dev_info(dev,
- "tmr_margin value out of range, default %d used\n",
- S3C2410_WATCHDOG_DEFAULT_TIME);
+ "tmr_margin value out of range, default %d used\n",
+ S3C2410_WATCHDOG_DEFAULT_TIME);
else
- dev_info(dev, "default timer value is out of range, "
- "cannot start\n");
+ dev_info(dev, "default timer value is out of range, cannot start\n");
}
ret = devm_request_irq(dev, wdt_irq->start, s3c2410wdt_irq, 0,
@@ -622,7 +614,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
watchdog_set_restart_priority(&wdt->wdt_device, 128);
wdt->wdt_device.bootstatus = s3c2410wdt_get_bootstatus(wdt);
- wdt->wdt_device.parent = &pdev->dev;
+ wdt->wdt_device.parent = dev;
ret = watchdog_register_device(&wdt->wdt_device);
if (ret) {
@@ -757,7 +749,6 @@ static struct platform_driver s3c2410wdt_driver = {
module_platform_driver(s3c2410wdt_driver);
-MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>, "
- "Dimitry Andric <dimitry.andric@tomtom.com>");
+MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>, Dimitry Andric <dimitry.andric@tomtom.com>");
MODULE_DESCRIPTION("S3C2410 Watchdog Device Driver");
MODULE_LICENSE("GPL");
--
2.9.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info
2017-02-24 21:07 [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info Krzysztof Kozlowski
` (5 preceding siblings ...)
2017-02-24 21:07 ` [PATCH 7/7] watchdog: s3c2410: Minor code cleanup Krzysztof Kozlowski
@ 2017-02-24 21:56 ` Guenter Roeck
6 siblings, 0 replies; 14+ messages in thread
From: Guenter Roeck @ 2017-02-24 21:56 UTC (permalink / raw)
To: Krzysztof Kozlowski, Wim Van Sebroeck, Kukjin Kim,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
On 02/24/2017 01:07 PM, Krzysztof Kozlowski wrote:
> Replace the 'debug' module parameter and pr_info() with proper device
> dynamic debug calls because this is the preferred and flexible way of
> enabling debugging printks.
>
> Also remove some obvious debug printks.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/s3c2410_wdt.c | 29 ++++++-----------------------
> 1 file changed, 6 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index 7db7847a005c..f7aad19d20ff 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -23,8 +23,6 @@
> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> */
>
> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> -
> #include <linux/module.h>
> #include <linux/moduleparam.h>
> #include <linux/types.h>
> @@ -83,13 +81,11 @@ static bool nowayout = WATCHDOG_NOWAYOUT;
> static int tmr_margin;
> static int tmr_atboot = S3C2410_WATCHDOG_ATBOOT;
> static int soft_noboot;
> -static int debug;
>
> module_param(tmr_margin, int, 0);
> module_param(tmr_atboot, int, 0);
> module_param(nowayout, bool, 0);
> module_param(soft_noboot, int, 0);
> -module_param(debug, int, 0);
>
> MODULE_PARM_DESC(tmr_margin, "Watchdog tmr_margin in seconds. (default="
> __MODULE_STRING(S3C2410_WATCHDOG_DEFAULT_TIME) ")");
> @@ -100,7 +96,6 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
> __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
> MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, "
> "0 to reboot (default 0)");
> -MODULE_PARM_DESC(debug, "Watchdog debug, set to >1 for debug (default 0)");
>
> /**
> * struct s3c2410_wdt_variant - Per-variant config data
> @@ -204,14 +199,6 @@ static const struct platform_device_id s3c2410_wdt_ids[] = {
> };
> MODULE_DEVICE_TABLE(platform, s3c2410_wdt_ids);
>
> -/* watchdog control routines */
> -
> -#define DBG(fmt, ...) \
> -do { \
> - if (debug) \
> - pr_info(fmt, ##__VA_ARGS__); \
> -} while (0)
> -
> /* functions */
>
> static inline unsigned int s3c2410wdt_max_timeout(struct clk *clock)
> @@ -307,8 +294,8 @@ static int s3c2410wdt_start(struct watchdog_device *wdd)
> wtcon |= S3C2410_WTCON_RSTEN;
> }
>
> - DBG("%s: count=0x%08x, wtcon=%08lx\n",
> - __func__, wdt->count, wtcon);
> + dev_dbg(wdt->dev, "Starting watchdog: count=0x%08x, wtcon=%08lx\n",
> + wdt->count, wtcon);
>
> writel(wdt->count, wdt->reg_base + S3C2410_WTDAT);
> writel(wdt->count, wdt->reg_base + S3C2410_WTCNT);
> @@ -337,8 +324,8 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd, unsigned timeou
> freq = DIV_ROUND_UP(freq, 128);
> count = timeout * freq;
>
> - DBG("%s: count=%d, timeout=%d, freq=%lu\n",
> - __func__, count, timeout, freq);
> + dev_dbg(wdt->dev, "Heartbeat: count=%d, timeout=%d, freq=%lu\n",
> + count, timeout, freq);
>
> /* if the count is bigger than the watchdog register,
> then work out what we need to do (and if) we can
> @@ -354,8 +341,8 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd, unsigned timeou
> }
> }
>
> - DBG("%s: timeout=%d, divisor=%d, count=%d (%08x)\n",
> - __func__, timeout, divisor, count, DIV_ROUND_UP(count, divisor));
> + dev_dbg(wdt->dev, "Heartbeat: timeout=%d, divisor=%d, count=%d (%08x)\n",
> + timeout, divisor, count, DIV_ROUND_UP(count, divisor));
>
> count = DIV_ROUND_UP(count, divisor);
> wdt->count = count;
> @@ -544,8 +531,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
> int started = 0;
> int ret;
>
> - DBG("%s: probe=%p\n", __func__, pdev);
> -
> dev = &pdev->dev;
>
> wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
> @@ -581,8 +566,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
> goto err;
> }
>
> - DBG("probe: mapped reg_base=%p\n", wdt->reg_base);
> -
> wdt->clock = devm_clk_get(dev, "watchdog");
> if (IS_ERR(wdt->clock)) {
> dev_err(dev, "failed to find watchdog clock source\n");
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] watchdog: s3c2410: Select MFD_SYSCON on all Exynos platforms
2017-02-24 21:07 ` [PATCH 2/7] watchdog: s3c2410: Select MFD_SYSCON on all Exynos platforms Krzysztof Kozlowski
@ 2017-02-24 21:57 ` Guenter Roeck
0 siblings, 0 replies; 14+ messages in thread
From: Guenter Roeck @ 2017-02-24 21:57 UTC (permalink / raw)
To: Krzysztof Kozlowski, Wim Van Sebroeck, Kukjin Kim,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
On 02/24/2017 01:07 PM, Krzysztof Kozlowski wrote:
> Syscon is used not only on Exynos5 SoCs but also on Exynos3250,
> Exynos4412 and ARMv8 versions (Exynos5433, Exynos7).
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index acb00b53a520..338c5bc46f73 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -335,7 +335,7 @@ config S3C2410_WATCHDOG
> tristate "S3C2410 Watchdog"
> depends on HAVE_S3C2410_WATCHDOG
> select WATCHDOG_CORE
> - select MFD_SYSCON if ARCH_EXYNOS5
> + select MFD_SYSCON if ARCH_EXYNOS
> help
> Watchdog timer block in the Samsung SoCs. This will reboot
> the system when the timer expires with the watchdog enabled.
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/7] watchdog: s3c2410: Enable COMPILE_TEST
2017-02-24 21:07 ` [PATCH 3/7] watchdog: s3c2410: Enable COMPILE_TEST Krzysztof Kozlowski
@ 2017-02-24 21:58 ` Guenter Roeck
0 siblings, 0 replies; 14+ messages in thread
From: Guenter Roeck @ 2017-02-24 21:58 UTC (permalink / raw)
To: Krzysztof Kozlowski, Wim Van Sebroeck, Kukjin Kim,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
On 02/24/2017 01:07 PM, Krzysztof Kozlowski wrote:
> Driver can be compile tested on other architectures as well so use it to
> increase build coverage.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Already submitted as part of 'watchdog: Enable COMPILE_TEST where possible'.
> ---
> drivers/watchdog/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 338c5bc46f73..82d5f07b5e64 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -333,7 +333,7 @@ config HAVE_S3C2410_WATCHDOG
>
> config S3C2410_WATCHDOG
> tristate "S3C2410 Watchdog"
> - depends on HAVE_S3C2410_WATCHDOG
> + depends on HAVE_S3C2410_WATCHDOG || COMPILE_TEST
> select WATCHDOG_CORE
> select MFD_SYSCON if ARCH_EXYNOS
> help
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/7] watchdog: s3c2410: Add prefix to local function
2017-02-24 21:07 ` [PATCH 4/7] watchdog: s3c2410: Add prefix to local function Krzysztof Kozlowski
@ 2017-02-24 21:58 ` Guenter Roeck
0 siblings, 0 replies; 14+ messages in thread
From: Guenter Roeck @ 2017-02-24 21:58 UTC (permalink / raw)
To: Krzysztof Kozlowski, Wim Van Sebroeck, Kukjin Kim,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
On 02/24/2017 01:07 PM, Krzysztof Kozlowski wrote:
> Functions marked static inline might not be inlined so a driver-specific
> prefix for function name helps when looking through call backtrace.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/s3c2410_wdt.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index f7aad19d20ff..a031842ffcb0 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -507,9 +507,8 @@ static inline unsigned int s3c2410wdt_get_bootstatus(struct s3c2410_wdt *wdt)
> return 0;
> }
>
> -/* s3c2410_get_wdt_driver_data */
> static inline struct s3c2410_wdt_variant *
> -get_wdt_drv_data(struct platform_device *pdev)
> +s3c2410_get_wdt_drv_data(struct platform_device *pdev)
> {
> if (pdev->dev.of_node) {
> const struct of_device_id *match;
> @@ -541,7 +540,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
> spin_lock_init(&wdt->lock);
> wdt->wdt_device = s3c2410_wdd;
>
> - wdt->drv_data = get_wdt_drv_data(pdev);
> + wdt->drv_data = s3c2410_get_wdt_drv_data(pdev);
> if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) {
> wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node,
> "samsung,syscon-phandle");
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/7] watchdog: s3c2410: Constify local structures
2017-02-24 21:07 ` [PATCH 5/7] watchdog: s3c2410: Constify local structures Krzysztof Kozlowski
@ 2017-02-24 22:05 ` Guenter Roeck
2017-02-25 7:42 ` Krzysztof Kozlowski
0 siblings, 1 reply; 14+ messages in thread
From: Guenter Roeck @ 2017-02-24 22:05 UTC (permalink / raw)
To: Krzysztof Kozlowski, Wim Van Sebroeck, Kukjin Kim,
Javier Martinez Canillas, linux-watchdog, linux-kernel,
linux-arm-kernel, linux-samsung-soc
On 02/24/2017 01:07 PM, Krzysztof Kozlowski wrote:
> Structures watchdog_device, watchdog_ops and s3c2410_wdt_variant are not
> modified so they can be made const to increase code safeness.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Conflicts with "watchdog: constify watchdog_ops structures" in my tree.
I rebased my tree to v4.10 (which I should not really have done ;-), but
it still doesn't apply due to "fatal: sha1 information is lacking or useless"
and "error: could not build fake ancestor". The subsequent patches also don't
apply. You may have to wait until after -rc1, rebase your patches, and
resubmit.
Guenter
> ---
> drivers/watchdog/s3c2410_wdt.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index a031842ffcb0..5eaec319e499 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -131,7 +131,7 @@ struct s3c2410_wdt {
> unsigned long wtdat_save;
> struct watchdog_device wdt_device;
> struct notifier_block freq_transition;
> - struct s3c2410_wdt_variant *drv_data;
> + const struct s3c2410_wdt_variant *drv_data;
> struct regmap *pmureg;
> };
>
> @@ -392,7 +392,7 @@ static const struct watchdog_info s3c2410_wdt_ident = {
> .identity = "S3C2410 Watchdog",
> };
>
> -static struct watchdog_ops s3c2410wdt_ops = {
> +static const struct watchdog_ops s3c2410wdt_ops = {
> .owner = THIS_MODULE,
> .start = s3c2410wdt_start,
> .stop = s3c2410wdt_stop,
> @@ -401,7 +401,7 @@ static struct watchdog_ops s3c2410wdt_ops = {
> .restart = s3c2410wdt_restart,
> };
>
> -static struct watchdog_device s3c2410_wdd = {
> +static const struct watchdog_device s3c2410_wdd = {
> .info = &s3c2410_wdt_ident,
> .ops = &s3c2410wdt_ops,
> .timeout = S3C2410_WATCHDOG_DEFAULT_TIME,
> @@ -507,15 +507,15 @@ static inline unsigned int s3c2410wdt_get_bootstatus(struct s3c2410_wdt *wdt)
> return 0;
> }
>
> -static inline struct s3c2410_wdt_variant *
> +static inline const struct s3c2410_wdt_variant *
> s3c2410_get_wdt_drv_data(struct platform_device *pdev)
> {
> if (pdev->dev.of_node) {
> const struct of_device_id *match;
> match = of_match_node(s3c2410_wdt_match, pdev->dev.of_node);
> - return (struct s3c2410_wdt_variant *)match->data;
> + return (const struct s3c2410_wdt_variant *)match->data;
> } else {
> - return (struct s3c2410_wdt_variant *)
> + return (const struct s3c2410_wdt_variant *)
> platform_get_device_id(pdev)->driver_data;
> }
> }
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/7] watchdog: s3c2410: Constify local structures
2017-02-24 22:05 ` Guenter Roeck
@ 2017-02-25 7:42 ` Krzysztof Kozlowski
2017-02-27 4:06 ` Guenter Roeck
0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-25 7:42 UTC (permalink / raw)
To: Guenter Roeck
Cc: Wim Van Sebroeck, Kukjin Kim, Javier Martinez Canillas,
linux-watchdog, linux-kernel, linux-arm-kernel,
linux-samsung-soc
On Fri, Feb 24, 2017 at 02:05:56PM -0800, Guenter Roeck wrote:
> On 02/24/2017 01:07 PM, Krzysztof Kozlowski wrote:
> > Structures watchdog_device, watchdog_ops and s3c2410_wdt_variant are not
> > modified so they can be made const to increase code safeness.
> >
> > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
>
> Conflicts with "watchdog: constify watchdog_ops structures" in my tree.
> I rebased my tree to v4.10 (which I should not really have done ;-), but
> it still doesn't apply due to "fatal: sha1 information is lacking or useless"
> and "error: could not build fake ancestor". The subsequent patches also don't
> apply. You may have to wait until after -rc1, rebase your patches, and
> resubmit.
Sure, I'll resend after merge window. These aren't important fixes so
there is no problem in waiting for merge window to end.
Thanks for reviews.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/7] watchdog: s3c2410: Constify local structures
2017-02-25 7:42 ` Krzysztof Kozlowski
@ 2017-02-27 4:06 ` Guenter Roeck
0 siblings, 0 replies; 14+ messages in thread
From: Guenter Roeck @ 2017-02-27 4:06 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Wim Van Sebroeck, Kukjin Kim, Javier Martinez Canillas,
linux-watchdog, linux-kernel, linux-arm-kernel,
linux-samsung-soc
On 02/24/2017 11:42 PM, Krzysztof Kozlowski wrote:
> On Fri, Feb 24, 2017 at 02:05:56PM -0800, Guenter Roeck wrote:
>> On 02/24/2017 01:07 PM, Krzysztof Kozlowski wrote:
>>> Structures watchdog_device, watchdog_ops and s3c2410_wdt_variant are not
>>> modified so they can be made const to increase code safeness.
>>>
>>> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
>>
>> Conflicts with "watchdog: constify watchdog_ops structures" in my tree.
>> I rebased my tree to v4.10 (which I should not really have done ;-), but
>> it still doesn't apply due to "fatal: sha1 information is lacking or useless"
>> and "error: could not build fake ancestor". The subsequent patches also don't
>> apply. You may have to wait until after -rc1, rebase your patches, and
>> resubmit.
>
> Sure, I'll resend after merge window. These aren't important fixes so
> there is no problem in waiting for merge window to end.
>
Watchdog patches are in, so please feel free to resubmit at your convenience.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2017-02-27 5:12 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-24 21:07 [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info Krzysztof Kozlowski
2017-02-24 21:07 ` [PATCH 2/7] watchdog: s3c2410: Select MFD_SYSCON on all Exynos platforms Krzysztof Kozlowski
2017-02-24 21:57 ` Guenter Roeck
2017-02-24 21:07 ` [PATCH 3/7] watchdog: s3c2410: Enable COMPILE_TEST Krzysztof Kozlowski
2017-02-24 21:58 ` Guenter Roeck
2017-02-24 21:07 ` [PATCH 4/7] watchdog: s3c2410: Add prefix to local function Krzysztof Kozlowski
2017-02-24 21:58 ` Guenter Roeck
2017-02-24 21:07 ` [PATCH 5/7] watchdog: s3c2410: Constify local structures Krzysztof Kozlowski
2017-02-24 22:05 ` Guenter Roeck
2017-02-25 7:42 ` Krzysztof Kozlowski
2017-02-27 4:06 ` Guenter Roeck
2017-02-24 21:07 ` [PATCH 6/7] watchdog: s3c2410: Simplify getting driver data Krzysztof Kozlowski
2017-02-24 21:07 ` [PATCH 7/7] watchdog: s3c2410: Minor code cleanup Krzysztof Kozlowski
2017-02-24 21:56 ` [PATCH 1/7] watchdog: s3c2410: Use dev_dbg instead of pr_info 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).