Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1159814

[PATCH v2 3/3] gpio_wdt: Add option for early registration

Path csiph.com!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Jean-Baptiste Theou <jtheou@adeneo-embedded.us>
Newsgroups linux.kernel
Subject [PATCH v2 3/3] gpio_wdt: Add option for early registration
Date Sat, 06 Jun 2015 03:50:02 +0200
Message-ID <pybpg-1Wz-7@gated-at.bofh.it> (permalink)
References <pybpg-1Wz-3@gated-at.bofh.it>
X-Original-To Wim Van Sebroeck <wim@iguana.be>
X-Mailer git-send-email 2.4.2
MIME-Version 1.0
Content-Type text/plain
X-Originating-IP [173.10.76.58]
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 79
Organization linux.* mail to news gateway
X-Original-Cc Guenter Roeck <linux@roeck-us.net>, <linux-watchdog@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Jean-Baptiste Theou <jtheou@adeneo-embedded.us>
X-Original-Date Fri, 5 Jun 2015 18:46:52 -0700
X-Original-Message-ID <1433555212-4729-3-git-send-email-jtheou@adeneo-embedded.us>
X-Original-References <1433555212-4729-1-git-send-email-jtheou@adeneo-embedded.us>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1159814

Show key headers only | View raw


In some situation, mainly when it's not possible to disable a
watchdog, you may want the watchdog driver to be started as soon
as possible.

Adding GPIO_WATCHDOG_ARCH_INITCALL to raise initcall from
module_init to arch_initcall. This is only for a built-in
module.

This patch require watchdog registration deferral mechanism

Signed-off-by: Jean-Baptiste Theou <jtheou@adeneo-embedded.us>
---
 drivers/watchdog/Kconfig    | 14 ++++++++++++++
 drivers/watchdog/gpio_wdt.c | 13 +++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index e5e7c55..a9655a9 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1,3 +1,4 @@
+
 #
 # Watchdog device configuration
 #
@@ -114,6 +115,19 @@ config MENF21BMC_WATCHDOG
 	  This driver can also be built as a module. If so the module
 	  will be called menf21bmc_wdt.
 
+config GPIO_WATCHDOG_ARCH_INITCALL
+	bool "Register the watchdog as early as possible"
+	depends on GPIO_WATCHDOG
+	help
+	  This option make sense only on a built-in situation.
+
+	  In some situation, the default initcall level (module_init)
+	  in not early enough on the boot process to avoid the watchdog
+	  to be trigger.
+	  If you say yes here, the initcall level would be raise to
+	  arch_initcall.
+	  "If in doubt, leave it out" - say N.
+
 config WM831X_WATCHDOG
 	tristate "WM831x watchdog"
 	depends on MFD_WM831X
diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
index cbc313d..07a39cd 100644
--- a/drivers/watchdog/gpio_wdt.c
+++ b/drivers/watchdog/gpio_wdt.c
@@ -267,8 +267,21 @@ static struct platform_driver gpio_wdt_driver = {
 	.probe	= gpio_wdt_probe,
 	.remove	= gpio_wdt_remove,
 };
+#ifndef GPIO_WATCHDOG_ARCH_INITCALL
 module_platform_driver(gpio_wdt_driver);
+#else
+static int __init gpio_wdt_init(void)
+{
+	return platform_driver_register(&gpio_wdt_driver);
+}
+arch_initcall(gpio_wdt_init);
 
+static void __exit gpio_wdt_exit(void)
+{
+	platform_driver_unregister(&gpio_wdt_driver);
+}
+module_exit(gpio_wdt_exit);
+#endif
 MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
 MODULE_DESCRIPTION("GPIO Watchdog");
 MODULE_LICENSE("GPL");
-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/3] watchdog_core: Add watchdog registration deferral mechanism Jean-Baptiste Theou <jtheou@adeneo-embedded.us> - 2015-06-06 03:50 +0200
  [PATCH v2 2/3] watchdog-kernel-api: Add registration deferral mechanism Jean-Baptiste Theou <jtheou@adeneo-embedded.us> - 2015-06-06 03:50 +0200
  [PATCH v2 3/3] gpio_wdt: Add option for early registration Jean-Baptiste Theou <jtheou@adeneo-embedded.us> - 2015-06-06 03:50 +0200

csiph-web