[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1434398321-16035-4-git-send-email-vivien.didelot@savoirfairelinux.com>
Date: Mon, 15 Jun 2015 15:58:41 -0400
From: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
To: linux-watchdog@...r.kernel.org
Cc: Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
Wim Van Sebroeck <wim@...ana.be>,
Guenter Roeck <linux@...ck-us.net>,
linux-kernel@...r.kernel.org, kernel@...oirfairelinux.com
Subject: [RESEND PATCH 3/3] watchdog: max63xx: add heartbeat to platform data
Actually, there is no way but the module parameter to set the desired
heartbeat. This patch allows a platform code to set it in the device
platform data. This is convenient for platforms and built-in drivers.
To do so, initialize heartbeat to zero to allow the module parameter to
takes precedence over the platform setting. If not set, it will still
default to DEFAULT_HEARTBEAT.
Signed-off-by: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
---
drivers/watchdog/max63xx_wdt.c | 8 ++++++--
include/linux/platform_data/max63xx_wdt.h | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/max63xx_wdt.c b/drivers/watchdog/max63xx_wdt.c
index 9ab9fd1..dc522ed 100644
--- a/drivers/watchdog/max63xx_wdt.c
+++ b/drivers/watchdog/max63xx_wdt.c
@@ -30,10 +30,10 @@
#define MAX63XX_DISABLED 3
-static unsigned int heartbeat = DEFAULT_HEARTBEAT;
+static unsigned int heartbeat;
module_param(heartbeat, int, 0);
MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat period in seconds from 1 to "
- __MODULE_STRING(MAX_HEARTBEAT) ", default "
+ __MODULE_STRING(MAX_HEARTBEAT) ", default will be "
__MODULE_STRING(DEFAULT_HEARTBEAT));
static bool nowayout = WATCHDOG_NOWAYOUT;
@@ -239,6 +239,10 @@ static int max63xx_wdt_probe(struct platform_device *pdev)
data->pdata = dev_get_platdata(&pdev->dev);
+ /* The module parameter takes precedence over the platform setting */
+ if (!heartbeat && data->pdata && data->pdata->heartbeat)
+ heartbeat = data->pdata->heartbeat;
+
if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
heartbeat = DEFAULT_HEARTBEAT;
diff --git a/include/linux/platform_data/max63xx_wdt.h b/include/linux/platform_data/max63xx_wdt.h
index ae28024..8127b1a 100644
--- a/include/linux/platform_data/max63xx_wdt.h
+++ b/include/linux/platform_data/max63xx_wdt.h
@@ -14,12 +14,14 @@
/**
* struct max63xx_platform_data - MAX63xx connectivity info
+ * @heartbeat: Watchdog heartbeat period in seconds.
* @wdi: Watchdog Input GPIO number.
* @set0: Watchdog SET0 GPIO number.
* @set1: Watchdog SET1 GPIO number.
* @set2: Watchdog SET2 GPIO number.
*/
struct max63xx_platform_data {
+ unsigned int heartbeat;
unsigned int wdi;
unsigned int set0, set1, set2;
};
--
2.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists