Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754109AbbFIQzS (ORCPT ); Tue, 9 Jun 2015 12:55:18 -0400 Received: from vpnchicago.adeneo-embedded.us ([65.182.180.190]:32877 "EHLO mxadeneo.adeneo-embedded.us" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752649AbbFIQzL (ORCPT ); Tue, 9 Jun 2015 12:55:11 -0400 From: Jean-Baptiste Theou To: Wim Van Sebroeck CC: Guenter Roeck , , , Jean-Baptiste Theou Subject: [PATCH v5 2/2] gpio_wdt: Add option for early registration Date: Tue, 9 Jun 2015 09:55:03 -0700 Message-ID: <1433868903-20033-2-git-send-email-jtheou@adeneo-embedded.us> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1433868903-20033-1-git-send-email-jtheou@adeneo-embedded.us> References: <1433868903-20033-1-git-send-email-jtheou@adeneo-embedded.us> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.9.9.10] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2349 Lines: 80 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 patch require watchdog registration deferral mechanism Signed-off-by: Jean-Baptiste Theou --- Changes in v5: - None Changes in v4: - Fix symbol - Add empty line Changes in v3: - Simplify changes, since the modification is for built-in only drivers/watchdog/Kconfig | 12 ++++++++++++ drivers/watchdog/gpio_wdt.c | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index e5e7c55..7a5c912 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1,3 +1,4 @@ + # # Watchdog device configuration # @@ -104,6 +105,17 @@ config GPIO_WATCHDOG If you say yes here you get support for watchdog device controlled through GPIO-line. +config GPIO_WATCHDOG_ARCH_INITCALL + bool "Register the watchdog as early as possible" + depends on GPIO_WATCHDOG=y + help + In some situations, the default initcall level (module_init) + in not early enough in the boot process to avoid the watchdog + to be triggered. + If you say yes here, the initcall level would be raised to + arch_initcall. + If in doubt, say N. + config MENF21BMC_WATCHDOG tristate "MEN 14F021P00 BMC Watchdog" depends on MFD_MENF21BMC diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c index cbc313d..1687cc2 100644 --- a/drivers/watchdog/gpio_wdt.c +++ b/drivers/watchdog/gpio_wdt.c @@ -267,7 +267,16 @@ static struct platform_driver gpio_wdt_driver = { .probe = gpio_wdt_probe, .remove = gpio_wdt_remove, }; + +#ifdef CONFIG_GPIO_WATCHDOG_ARCH_INITCALL +static int __init gpio_wdt_init(void) +{ + return platform_driver_register(&gpio_wdt_driver); +} +arch_initcall(gpio_wdt_init); +#else module_platform_driver(gpio_wdt_driver); +#endif MODULE_AUTHOR("Alexander Shiyan "); MODULE_DESCRIPTION("GPIO Watchdog"); -- 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/