From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
To: Guenter Roeck <linux@roeck-us.net>, Wim Van Sebroeck <wim@iguana.be>
Cc: <linux-watchdog@vger.kernel.org>
Subject: Re: [PATCH 5/6] watchdog: pretimeout: add device specific notifier pretimeout governor
Date: Tue, 24 Nov 2015 15:25:56 +0200 [thread overview]
Message-ID: <56546564.20207@mentor.com> (raw)
In-Reply-To: <565405A4.8020200@roeck-us.net>
Hi Guenter,
On 24.11.2015 08:37, Guenter Roeck wrote:
> On 11/20/2015 11:11 PM, Vladimir Zapolskiy wrote:
>> Device watchdog pretimeout governor sends a notification back to a
>> watchdog device for further handling. This governor does nothing, if
>> watchdog driver does not define a pretimeout callback.
>>
>
> I can not make up my mind - should this be "device" or "driver" specific ?
I was hesitating to select between "device" and "driver", technically
"driver" should be more appropriate, but I'm not aware of users' accepted
terminology, I believe ordinary users more often operate with "devices"
rather than "drivers".
Anyway it is not sufficient for me, I can rename it, if you ask.
Best wishes,
Vladimir
>> Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
>> ---
>> drivers/watchdog/Kconfig | 15 +++++++++++
>> drivers/watchdog/Makefile | 1 +
>> drivers/watchdog/pretimeout_device.c | 49 ++++++++++++++++++++++++++++++++++++
>> include/linux/watchdog.h | 2 ++
>> 4 files changed, 67 insertions(+)
>> create mode 100644 drivers/watchdog/pretimeout_device.c
>>
>> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
>> index 7e9e2bb..6c1f7e1 100644
>> --- a/drivers/watchdog/Kconfig
>> +++ b/drivers/watchdog/Kconfig
>> @@ -1662,6 +1662,13 @@ config WATCHDOG_PRETIMEOUT_DEFAULT_GOV_USERSPACE
>> Use userspace notifier watchdog pretimeout governor
>> by default.
>>
>> +config WATCHDOG_PRETIMEOUT_DEFAULT_GOV_DEVICE
>> + bool "device"
>> + select WATCHDOG_PRETIMEOUT_GOV_DEVICE
>> + help
>> + Use device specific watchdog pretimeout event handler
>> + by default.
>> +
>> endchoice
>>
>> config WATCHDOG_PRETIMEOUT_GOV_NOOP
>> @@ -1683,6 +1690,14 @@ config WATCHDOG_PRETIMEOUT_GOV_USERSPACE
>> pretimeout event send a notification to userspace for
>> further handling.
>>
>> +config WATCHDOG_PRETIMEOUT_GOV_DEVICE
>> + tristate "Own device watchdog pretimeout governor"
>> + help
>> + Device watchdog pretimeout governor sends a notification
>> + back to a watchdog device for further handling. This governor
>> + does nothing, if watchdog driver does not define a pretimeout
>> + callback.
>> +
>> endif # WATCHDOG_PRETIMEOUT_GOV
>>
>> endif # WATCHDOG
>> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
>> index 7d6755b..0717b64 100644
>> --- a/drivers/watchdog/Makefile
>> +++ b/drivers/watchdog/Makefile
>> @@ -11,6 +11,7 @@ watchdog-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV) += watchdog_pretimeout.o
>> obj-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV_NOOP) += pretimeout_noop.o
>> obj-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV_PANIC) += pretimeout_panic.o
>> obj-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV_USERSPACE) += pretimeout_userspace.o
>> +obj-$(CONFIG_WATCHDOG_PRETIMEOUT_GOV_DEVICE) += pretimeout_device.o
>>
>> # Only one watchdog can succeed. We probe the ISA/PCI/USB based
>> # watchdog-cards first, then the architecture specific watchdog
>> diff --git a/drivers/watchdog/pretimeout_device.c b/drivers/watchdog/pretimeout_device.c
>> new file mode 100644
>> index 0000000..4ce992b
>> --- /dev/null
>> +++ b/drivers/watchdog/pretimeout_device.c
>> @@ -0,0 +1,49 @@
>> +/*
>> + * Copyright (C) 2015 Mentor Graphics
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> + *
>> + */
>> +
>> +#include <linux/module.h>
>> +#include <linux/watchdog.h>
>> +
>> +#include <watchdog_pretimeout.h>
>> +
>> +/**
>> + * pretimeout_device - Run device specific handler on watchdog pretimeout event
>> + * @wdd - watchdog_device
>> + *
>> + */
>> +static void pretimeout_device(struct watchdog_device *wdd)
>> +{
>> + if (wdd->ops->pretimeout)
>> + wdd->ops->pretimeout(wdd);
>> +}
>> +
>> +static struct watchdog_governor watchdog_gov_device = {
>> + .name = "device",
>> + .pretimeout = pretimeout_device,
>> +#ifdef CONFIG_WATCHDOG_PRETIMEOUT_DEFAULT_GOV_DEVICE
>> + .is_default = true,
>> +#endif
>> +};
>> +
>> +static int __init watchdog_gov_device_register(void)
>> +{
>> + return watchdog_register_governor(&watchdog_gov_device);
>> +}
>> +
>> +static void __exit watchdog_gov_device_unregister(void)
>> +{
>> + watchdog_unregister_governor(&watchdog_gov_device);
>> +}
>> +module_init(watchdog_gov_device_register);
>> +module_exit(watchdog_gov_device_unregister);
>> +
>> +MODULE_AUTHOR("Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>");
>> +MODULE_DESCRIPTION("Device specific watchdog pretimeout governor");
>> +MODULE_LICENSE("GPL");
>> diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
>> index 960223e..597dcfb 100644
>> --- a/include/linux/watchdog.h
>> +++ b/include/linux/watchdog.h
>> @@ -27,6 +27,7 @@ struct watchdog_governor;
>> * @status: The routine that shows the status of the watchdog device.
>> * @set_timeout:The routine for setting the watchdog devices timeout value (in seconds).
>> * @get_timeleft:The routine that gets the time left before a reset (in seconds).
>> + * @pretimeout: The routine that runs driver specific handler of pretimeout event.
>> * @ref: The ref operation for dyn. allocated watchdog_device structs
>> * @unref: The unref operation for dyn. allocated watchdog_device structs
>> * @ioctl: The routines that handles extra ioctl calls.
>> @@ -46,6 +47,7 @@ struct watchdog_ops {
>> unsigned int (*status)(struct watchdog_device *);
>> int (*set_timeout)(struct watchdog_device *, unsigned int);
>> unsigned int (*get_timeleft)(struct watchdog_device *);
>> + void (*pretimeout)(struct watchdog_device *);
>> void (*ref)(struct watchdog_device *);
>> void (*unref)(struct watchdog_device *);
>> long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
>>
>
next prev parent reply other threads:[~2015-11-24 13:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-21 7:11 [PATCH 0/6] watchdog: add watchdog pretimeout framework Vladimir Zapolskiy
2015-11-21 7:11 ` [PATCH 1/6] " Vladimir Zapolskiy
2015-11-21 7:11 ` [PATCH 2/6] watchdog: pretimeout: add noop pretimeout governor Vladimir Zapolskiy
2015-11-21 7:11 ` [PATCH 3/6] watchdog: pretimeout: add panic " Vladimir Zapolskiy
2015-11-21 7:11 ` [PATCH 4/6] watchdog: pretimeout: add userspace notifier " Vladimir Zapolskiy
2015-11-21 7:11 ` [PATCH 5/6] watchdog: pretimeout: add device specific " Vladimir Zapolskiy
2015-11-24 6:37 ` Guenter Roeck
2015-11-24 13:25 ` Vladimir Zapolskiy [this message]
2015-11-24 13:50 ` Guenter Roeck
2015-11-21 7:11 ` [PATCH 6/6] watchdog: pretimeout: add ping watchdog " Vladimir Zapolskiy
2015-11-24 6:36 ` Guenter Roeck
2015-11-24 13:27 ` Vladimir Zapolskiy
2015-11-21 17:13 ` [PATCH 0/6] watchdog: add watchdog pretimeout framework Guenter Roeck
2015-11-23 0:38 ` Vladimir Zapolskiy
2015-11-24 6:47 ` Guenter Roeck
2015-11-24 13:25 ` Vladimir Zapolskiy
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=56546564.20207@mentor.com \
--to=vladimir_zapolskiy@mentor.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=wim@iguana.be \
/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