Linux-Aspeed Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH 4/4] watchdog: aspeed: Move init to arch_initcall
Date: Mon, 18 Sep 2017 06:32:46 -0700	[thread overview]
Message-ID: <b7524108-1927-95a5-e5d6-ade0a8b9ab47@roeck-us.net> (raw)
In-Reply-To: <20170918054905.16470-5-andrew@aj.id.au>

On 09/17/2017 10:49 PM, Andrew Jeffery wrote:
> Probing at device_initcall time lead to perverse cases where the
> watchdog was probed after, say, I2C, which then leaves a potentially
> running watchdog at the mercy of I2C device behaviour and bus
> conditions.
> 
> Load the watchdog driver early to ensure that the kernel is patting it
> well before initialising peripherals.
> 
But you are doing a bit more. You are making it bool, and you are enabling it
by default. Both isn't needed for the intended goal (arch_initcall is converted
to module_initcall if a driver is built as module). Your change focuses on
and optimizes the case where the watchdog is already running. That may not
always be the case, and there may be systems where the driver is not loaded
on purpose.

Guenter

> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>   drivers/watchdog/Kconfig      | 6 ++----
>   drivers/watchdog/aspeed_wdt.c | 7 ++++++-
>   2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index a1b92ebe74b6..6103185983ed 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -741,8 +741,9 @@ config RENESAS_RZAWDT
>   	  Renesas RZ/A SoCs. These watchdogs can be used to reset a system.
>   
>   config ASPEED_WATCHDOG
> -	tristate "Aspeed BMC watchdog support"
> +	bool "Aspeed BMC watchdog support"
>   	depends on ARCH_ASPEED || COMPILE_TEST
> +	default y if ARCH_ASPEED
>   	select WATCHDOG_CORE
>   	help
>   	  Say Y here to include support for the watchdog timer
> @@ -750,9 +751,6 @@ config ASPEED_WATCHDOG
>   
>   	  This driver is required to reboot the SoC.
>   
> -	  To compile this driver as a module, choose M here: the
> -	  module will be called aspeed_wdt.
> -
>   config ZX2967_WATCHDOG
>   	tristate "ZTE zx2967 SoCs watchdog support"
>   	depends on ARCH_ZX
> diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
> index 99bc6fbd8852..679c35abadc4 100644
> --- a/drivers/watchdog/aspeed_wdt.c
> +++ b/drivers/watchdog/aspeed_wdt.c
> @@ -313,7 +313,12 @@ static struct platform_driver aspeed_watchdog_driver = {
>   		.of_match_table = of_match_ptr(aspeed_wdt_of_table),
>   	},
>   };
> -module_platform_driver(aspeed_watchdog_driver);
> +
> +static int __init aspeed_wdt_init(void)
> +{
> +	return platform_driver_register(&aspeed_watchdog_driver);
> +}
> +arch_initcall(aspeed_wdt_init);
>   
>   MODULE_DESCRIPTION("Aspeed Watchdog Driver");
>   MODULE_LICENSE("GPL");
> 


  reply	other threads:[~2017-09-18 13:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18  5:49 [PATCH 0/4] watchdog: aspeed: Retain enabled state and move to Andrew Jeffery
2017-09-18  5:49 ` [PATCH 1/4] watchdog: aspeed: Retain watchdog enabled state Andrew Jeffery
2017-09-18 13:25   ` Guenter Roeck
2017-09-19  2:30     ` Andrew Jeffery
2017-09-20  1:47   ` Joel Stanley
2017-09-20  2:32     ` Andrew Jeffery
2017-09-18  5:49 ` [PATCH 2/4] watchdog: aspeed: Fix 'Apseed' typo in Kconfig Andrew Jeffery
2017-09-18 14:45   ` Guenter Roeck
2017-09-18  5:49 ` [PATCH 3/4] watchdog: aspeed: Remove specific reference to AST2400 " Andrew Jeffery
2017-09-18 14:45   ` Guenter Roeck
2017-09-18  5:49 ` [PATCH 4/4] watchdog: aspeed: Move init to arch_initcall Andrew Jeffery
2017-09-18 13:32   ` Guenter Roeck [this message]
2017-09-19  2:28     ` Andrew Jeffery
2017-09-18  5:53 ` [PATCH 0/4] watchdog: aspeed: Retain enabled state and move to Andrew Jeffery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7524108-1927-95a5-e5d6-ade0a8b9ab47@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-aspeed@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox