Re: [PATCH v2 2/3] watchdog: Add ChromeOS EC-based watchdog driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 18, 2024 at 07:53:23PM +0000, Lukasz Majczak wrote:
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 7d22051b15a2..4700b218340f 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -181,6 +181,17 @@ config BD957XMUF_WATCHDOG
>  	  watchdog. Alternatively say M to compile the driver as a module,
>  	  which will be called bd9576_wdt.
>  
> +config CROS_EC_WATCHDOG
> +	tristate "ChromeOS EC-based watchdog"
> +	select WATCHDOG_CORE
> +	depends on CROS_EC
> +	help
> +	  Watchdog driver for Chromebook devices equipped with embedded controller.
> +	  Trigger event is recorded in EC and checked on the subsequent boot.

Perhaps unrelated to the patch, but I'm curious what the mechanism is.  Does
it use any existing paths for checking the saved events in EC?  What it does
if there is a saved WDT reset event?

> diff --git a/drivers/watchdog/cros_ec_wdt.c b/drivers/watchdog/cros_ec_wdt.c
[...]
> +static int cros_ec_wdt_ping(struct watchdog_device *wdd)
> +{
[...]
> +	arg.req.command = EC_HANG_DETECT_CMD_RELOAD;
> +	ret = cros_ec_wdt_send_cmd(cros_ec, &arg);
> +	if (ret < 0)
> +		dev_dbg(wdd->parent, "Failed to ping watchdog (%d)", ret);

I think this would be worth dev_info() or dev_warn()?

> +static int cros_ec_wdt_start(struct watchdog_device *wdd)
> +{
[...]
> +	/* Prepare watchdog on EC side */
> +	arg.req.command = EC_HANG_DETECT_CMD_SET_TIMEOUT;
> +	arg.req.reboot_timeout_sec = wdd->timeout;
> +	ret = cros_ec_wdt_send_cmd(cros_ec, &arg);
> +	if (ret < 0)
> +		dev_dbg(wdd->parent, "Failed to start watchdog (%d)", ret);

Same here: dev_info() or dev_warn()?

> +static int cros_ec_wdt_stop(struct watchdog_device *wdd)
> +{
[...]
> +	arg.req.command = EC_HANG_DETECT_CMD_CANCEL;
> +	ret = cros_ec_wdt_send_cmd(cros_ec, &arg);
> +	if (ret < 0)
> +		dev_dbg(wdd->parent, "Failed to stop watchdog (%d)", ret);

Same here: dev_info() or dev_warn()?

> +static int cros_ec_wdt_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct cros_ec_dev *ec_dev = dev_get_drvdata(dev->parent);
> +	struct cros_ec_device *cros_ec = ec_dev->ec_dev;
> +	struct watchdog_device *wdd;
> +	union cros_ec_wdt_data arg;
> +	int ret = 0;

nit: `ret` doesn't need to be initialized.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux