2021-03-08 11:26:41

by FLAVIO SULIGOI

[permalink] [raw]
Subject: [PATCH v1 0/2] Watchdog Core Global Parameters

This patch series add a new way to consider the module parameters for the
watchdog module.

Instead of adding this kind of module parameters independently to each
driver, the best solution is declaring each feature only once,
in the watchdog core.

Additionally, I added a implementation example of this "global" parameters
using the module "wdat_wdt"

In details:

===============================
Watchdog Core Global Parameters
===============================

Information for watchdog kernel modules developers.

Introduction
============

Different watchdog modules frequently require the same type of parameters
(for example: *timeout*, *nowayout* feature, *start_enabled* to start the
watchdog on module insertion, etc.).
Instead of adding this kind of module parameters independently to each
driver, the best solution is declaring each feature only once,
in the watchdog core.

In this way, each driver can read these "global" parameters and then,
if needed, can implement them, according to the particular hw watchdog
characteristic.

Using this approach, it is possible reduce some duplicate code in the *new*
watchdog drivers and simplify the code maintenance. Moreover, the code
will be clearer, since the same kind of parameters are often called
with different names (see Documentation/watchdog/watchdog-parameters.rst).
Obviously, for compatibility reasons, we cannot remove the already existing
parameters from the code of the various watchdog modules, but we can use
this "global" approach for the new watchdog drivers.


Global parameters declaration
==============================

The global parameters data structure is declared in
include/linux/watchdog.h, as::

struct watchdog_global_parameters_struct {
int timeout;
int ioport;
int irq;
unsigned long features;
/* Bit numbers for features flags */
#define WDOG_GLOBAL_PARAM_VERBOSE 0
#define WDOG_GLOBAL_PARAM_TEST_MODE 1
#define WDOG_GLOBAL_PARAM_START_ENABLED 2
#define WDOG_GLOBAL_PARAM_NOWAYOUT 3
};

The variable "feature" is a bitwise flags container, to store boolean
features, such as:

* nowayout
* start_enable
* etc...

Other variables can be added, to store some numerical values and other data
required.

The global parameters are declared (as usual for the module parameters)
in the first part of drivers/watchdog/watchdog_core.c file.
The above global data structure is then managed by the function
*void global_parameters_init()*, in the same file.

Global parameters use
=====================

Each watchdog driver, to check if one of the global parameters is enabled,
can use the corresponding in-line function declared in
include/linux/watchdog.h.
At the moment the following functions are ready to use:

* watchdog_global_param_verbose_enabled()
* watchdog_global_param_test_mode_enabled()
* watchdog_global_param_start_enabled()
* watchdog_global_param_nowayout_enabled()



Flavio Suligoi (2):
watchdog: add global watchdog kernel module parameters structure
watchdog: wdat: add start_enable global parameter

Documentation/watchdog/index.rst | 1 +
.../watchdog-core-global-parameters.rst | 74 +++++++++++++++++++
drivers/watchdog/watchdog_core.c | 74 +++++++++++++++++++
drivers/watchdog/wdat_wdt.c | 2 +
include/linux/watchdog.h | 42 +++++++++++
5 files changed, 193 insertions(+)
create mode 100644 Documentation/watchdog/watchdog-core-global-parameters.rst

--
2.25.1


2021-03-08 11:26:58

by FLAVIO SULIGOI

[permalink] [raw]
Subject: [PATCH v1 2/2] watchdog: wdat: add start_enable global parameter

The "start_enable" global parameter, managed in watchdog_core.c,
forces the driver to start the watchdog countdown in the same moment of the
module insertion.
The driver also updates the watchdog status, setting the WDOG_HW_RUNNING
flag, to enable the watchdog ping feature managed by the watchdog_core
itself.

Signed-off-by: Flavio Suligoi <[email protected]>
---
drivers/watchdog/wdat_wdt.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
index cec7917790e5..7304a335227f 100644
--- a/drivers/watchdog/wdat_wdt.c
+++ b/drivers/watchdog/wdat_wdt.c
@@ -437,6 +437,8 @@ static int wdat_wdt_probe(struct platform_device *pdev)
}

wdat_wdt_boot_status(wdat);
+ if (watchdog_global_param_start_enabled())
+ wdat_wdt_start(&wdat->wdd);
wdat_wdt_set_running(wdat);

ret = wdat_wdt_enable_reboot(wdat);
--
2.25.1

2021-03-08 19:41:34

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v1 0/2] Watchdog Core Global Parameters

On 3/8/21 3:21 AM, Flavio Suligoi wrote:
> This patch series add a new way to consider the module parameters for the
> watchdog module.
>
> Instead of adding this kind of module parameters independently to each
> driver, the best solution is declaring each feature only once,
> in the watchdog core.
>

I agree to and like the idea, but I don't see the point of letting drivers
opt in or opt out. This adds a lot of complexity for little if any gain.

Guenter

> Additionally, I added a implementation example of this "global" parameters
> using the module "wdat_wdt"
>
> In details:
>
> ===============================
> Watchdog Core Global Parameters
> ===============================
>
> Information for watchdog kernel modules developers.
>
> Introduction
> ============
>
> Different watchdog modules frequently require the same type of parameters
> (for example: *timeout*, *nowayout* feature, *start_enabled* to start the
> watchdog on module insertion, etc.).
> Instead of adding this kind of module parameters independently to each
> driver, the best solution is declaring each feature only once,
> in the watchdog core.
>
> In this way, each driver can read these "global" parameters and then,
> if needed, can implement them, according to the particular hw watchdog
> characteristic.
>
> Using this approach, it is possible reduce some duplicate code in the *new*
> watchdog drivers and simplify the code maintenance. Moreover, the code
> will be clearer, since the same kind of parameters are often called
> with different names (see Documentation/watchdog/watchdog-parameters.rst).
> Obviously, for compatibility reasons, we cannot remove the already existing
> parameters from the code of the various watchdog modules, but we can use
> this "global" approach for the new watchdog drivers.
>
>
> Global parameters declaration
> ==============================
>
> The global parameters data structure is declared in
> include/linux/watchdog.h, as::
>
> struct watchdog_global_parameters_struct {
> int timeout;
> int ioport;
> int irq;
> unsigned long features;
> /* Bit numbers for features flags */
> #define WDOG_GLOBAL_PARAM_VERBOSE 0
> #define WDOG_GLOBAL_PARAM_TEST_MODE 1
> #define WDOG_GLOBAL_PARAM_START_ENABLED 2
> #define WDOG_GLOBAL_PARAM_NOWAYOUT 3
> };
>
> The variable "feature" is a bitwise flags container, to store boolean
> features, such as:
>
> * nowayout
> * start_enable
> * etc...
>
> Other variables can be added, to store some numerical values and other data
> required.
>
> The global parameters are declared (as usual for the module parameters)
> in the first part of drivers/watchdog/watchdog_core.c file.
> The above global data structure is then managed by the function
> *void global_parameters_init()*, in the same file.
>
> Global parameters use
> =====================
>
> Each watchdog driver, to check if one of the global parameters is enabled,
> can use the corresponding in-line function declared in
> include/linux/watchdog.h.
> At the moment the following functions are ready to use:
>
> * watchdog_global_param_verbose_enabled()
> * watchdog_global_param_test_mode_enabled()
> * watchdog_global_param_start_enabled()
> * watchdog_global_param_nowayout_enabled()
>
>
>
> Flavio Suligoi (2):
> watchdog: add global watchdog kernel module parameters structure
> watchdog: wdat: add start_enable global parameter
>
> Documentation/watchdog/index.rst | 1 +
> .../watchdog-core-global-parameters.rst | 74 +++++++++++++++++++
> drivers/watchdog/watchdog_core.c | 74 +++++++++++++++++++
> drivers/watchdog/wdat_wdt.c | 2 +
> include/linux/watchdog.h | 42 +++++++++++
> 5 files changed, 193 insertions(+)
> create mode 100644 Documentation/watchdog/watchdog-core-global-parameters.rst
>

2021-03-09 10:30:25

by FLAVIO SULIGOI

[permalink] [raw]
Subject: RE: [PATCH v1 0/2] Watchdog Core Global Parameters

Hi Guenter,

> > Instead of adding this kind of module parameters independently to each
> > driver, the best solution is declaring each feature only once, in the
> > watchdog core.
> >
>
> I agree to and like the idea, but I don't see the point of letting drivers opt in
> or opt out. This adds a lot of complexity for little if any gain.

Do you mean that all the support for this "global parameters" should be done
in the watchdog-core only, without write any code in each single
"hardware" driver?
>
> Guenter

Regards,

Flavio

>
> > Additionally, I added a implementation example of this "global"
> > parameters using the module "wdat_wdt"
> >
> > In details:
> >
> > ===============================
> > Watchdog Core Global Parameters
> > ===============================
> >
> > Information for watchdog kernel modules developers.
> >
> > Introduction
> > ============
> >
> > Different watchdog modules frequently require the same type of
> > parameters (for example: *timeout*, *nowayout* feature,
> > *start_enabled* to start the watchdog on module insertion, etc.).
> > Instead of adding this kind of module parameters independently to each
> > driver, the best solution is declaring each feature only once, in the
> > watchdog core.
> >
> > In this way, each driver can read these "global" parameters and then,
> > if needed, can implement them, according to the particular hw watchdog
> > characteristic.
> >
> > Using this approach, it is possible reduce some duplicate code in the
> > *new* watchdog drivers and simplify the code maintenance. Moreover,
> > the code will be clearer, since the same kind of parameters are often
> > called with different names (see Documentation/watchdog/watchdog-
> parameters.rst).
> > Obviously, for compatibility reasons, we cannot remove the already
> > existing parameters from the code of the various watchdog modules, but
> > we can use this "global" approach for the new watchdog drivers.
> >
> >
> > Global parameters declaration
> > ==============================
> >
> > The global parameters data structure is declared in
> > include/linux/watchdog.h, as::
> >
> > struct watchdog_global_parameters_struct {
> > int timeout;
> > int ioport;
> > int irq;
> > unsigned long features;
> > /* Bit numbers for features flags */
> > #define WDOG_GLOBAL_PARAM_VERBOSE 0
> > #define WDOG_GLOBAL_PARAM_TEST_MODE 1
> > #define WDOG_GLOBAL_PARAM_START_ENABLED 2
> > #define WDOG_GLOBAL_PARAM_NOWAYOUT 3
> > };
> >
> > The variable "feature" is a bitwise flags container, to store boolean
> > features, such as:
> >
> > * nowayout
> > * start_enable
> > * etc...
> >
> > Other variables can be added, to store some numerical values and other
> > data required.
> >
> > The global parameters are declared (as usual for the module
> > parameters) in the first part of drivers/watchdog/watchdog_core.c file.
> > The above global data structure is then managed by the function *void
> > global_parameters_init()*, in the same file.
> >
> > Global parameters use
> > =====================
> >
> > Each watchdog driver, to check if one of the global parameters is
> > enabled, can use the corresponding in-line function declared in
> > include/linux/watchdog.h.
> > At the moment the following functions are ready to use:
> >
> > * watchdog_global_param_verbose_enabled()
> > * watchdog_global_param_test_mode_enabled()
> > * watchdog_global_param_start_enabled()
> > * watchdog_global_param_nowayout_enabled()
> >
> >
> >
> > Flavio Suligoi (2):
> > watchdog: add global watchdog kernel module parameters structure
> > watchdog: wdat: add start_enable global parameter
> >
> > Documentation/watchdog/index.rst | 1 +
> > .../watchdog-core-global-parameters.rst | 74 +++++++++++++++++++
> > drivers/watchdog/watchdog_core.c | 74 +++++++++++++++++++
> > drivers/watchdog/wdat_wdt.c | 2 +
> > include/linux/watchdog.h | 42 +++++++++++
> > 5 files changed, 193 insertions(+)
> > create mode 100644
> > Documentation/watchdog/watchdog-core-global-parameters.rst
> >

2021-03-09 15:24:32

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v1 0/2] Watchdog Core Global Parameters

On 3/9/21 2:26 AM, Flavio Suligoi wrote:
> Hi Guenter,
>
>>> Instead of adding this kind of module parameters independently to each
>>> driver, the best solution is declaring each feature only once, in the
>>> watchdog core.
>>>
>>
>> I agree to and like the idea, but I don't see the point of letting drivers opt in
>> or opt out. This adds a lot of complexity for little if any gain.
>
> Do you mean that all the support for this "global parameters" should be done
> in the watchdog-core only, without write any code in each single
> "hardware" driver?

Correct. It should not be up to the driver author to decide if they
want to opt out from global parameters or not. It should be up to
users, and users can opt out by not providing the parameters.

Guenter

>>
>> Guenter
>
> Regards,
>
> Flavio
>
>>
>>> Additionally, I added a implementation example of this "global"
>>> parameters using the module "wdat_wdt"
>>>
>>> In details:
>>>
>>> ===============================
>>> Watchdog Core Global Parameters
>>> ===============================
>>>
>>> Information for watchdog kernel modules developers.
>>>
>>> Introduction
>>> ============
>>>
>>> Different watchdog modules frequently require the same type of
>>> parameters (for example: *timeout*, *nowayout* feature,
>>> *start_enabled* to start the watchdog on module insertion, etc.).
>>> Instead of adding this kind of module parameters independently to each
>>> driver, the best solution is declaring each feature only once, in the
>>> watchdog core.
>>>
>>> In this way, each driver can read these "global" parameters and then,
>>> if needed, can implement them, according to the particular hw watchdog
>>> characteristic.
>>>
>>> Using this approach, it is possible reduce some duplicate code in the
>>> *new* watchdog drivers and simplify the code maintenance. Moreover,
>>> the code will be clearer, since the same kind of parameters are often
>>> called with different names (see Documentation/watchdog/watchdog-
>> parameters.rst).
>>> Obviously, for compatibility reasons, we cannot remove the already
>>> existing parameters from the code of the various watchdog modules, but
>>> we can use this "global" approach for the new watchdog drivers.
>>>
>>>
>>> Global parameters declaration
>>> ==============================
>>>
>>> The global parameters data structure is declared in
>>> include/linux/watchdog.h, as::
>>>
>>> struct watchdog_global_parameters_struct {
>>> int timeout;
>>> int ioport;
>>> int irq;
>>> unsigned long features;
>>> /* Bit numbers for features flags */
>>> #define WDOG_GLOBAL_PARAM_VERBOSE 0
>>> #define WDOG_GLOBAL_PARAM_TEST_MODE 1
>>> #define WDOG_GLOBAL_PARAM_START_ENABLED 2
>>> #define WDOG_GLOBAL_PARAM_NOWAYOUT 3
>>> };
>>>
>>> The variable "feature" is a bitwise flags container, to store boolean
>>> features, such as:
>>>
>>> * nowayout
>>> * start_enable
>>> * etc...
>>>
>>> Other variables can be added, to store some numerical values and other
>>> data required.
>>>
>>> The global parameters are declared (as usual for the module
>>> parameters) in the first part of drivers/watchdog/watchdog_core.c file.
>>> The above global data structure is then managed by the function *void
>>> global_parameters_init()*, in the same file.
>>>
>>> Global parameters use
>>> =====================
>>>
>>> Each watchdog driver, to check if one of the global parameters is
>>> enabled, can use the corresponding in-line function declared in
>>> include/linux/watchdog.h.
>>> At the moment the following functions are ready to use:
>>>
>>> * watchdog_global_param_verbose_enabled()
>>> * watchdog_global_param_test_mode_enabled()
>>> * watchdog_global_param_start_enabled()
>>> * watchdog_global_param_nowayout_enabled()
>>>
>>>
>>>
>>> Flavio Suligoi (2):
>>> watchdog: add global watchdog kernel module parameters structure
>>> watchdog: wdat: add start_enable global parameter
>>>
>>> Documentation/watchdog/index.rst | 1 +
>>> .../watchdog-core-global-parameters.rst | 74 +++++++++++++++++++
>>> drivers/watchdog/watchdog_core.c | 74 +++++++++++++++++++
>>> drivers/watchdog/wdat_wdt.c | 2 +
>>> include/linux/watchdog.h | 42 +++++++++++
>>> 5 files changed, 193 insertions(+)
>>> create mode 100644
>>> Documentation/watchdog/watchdog-core-global-parameters.rst
>>>
>

2021-03-09 18:44:35

by Jerry Hoemann

[permalink] [raw]
Subject: Re: [PATCH v1 0/2] Watchdog Core Global Parameters

On Tue, Mar 09, 2021 at 07:22:28AM -0800, Guenter Roeck wrote:
> On 3/9/21 2:26 AM, Flavio Suligoi wrote:
> > Hi Guenter,
> >
> >>> Instead of adding this kind of module parameters independently to each
> >>> driver, the best solution is declaring each feature only once, in the
> >>> watchdog core.
> >>>
> >>
> >> I agree to and like the idea, but I don't see the point of letting drivers opt in
> >> or opt out. This adds a lot of complexity for little if any gain.
> >
> > Do you mean that all the support for this "global parameters" should be done
> > in the watchdog-core only, without write any code in each single
> > "hardware" driver?
>
> Correct. It should not be up to the driver author to decide if they
> want to opt out from global parameters or not. It should be up to
> users, and users can opt out by not providing the parameters.


Guenter,

What about parameters like "pretimeout" that only some WD drivers have
hw to support?

Might be nice to centralize these parameters as well, but leaving it up
to users to decide might not make sense.

Or do you see the recent work to allow for a software pretimeout
mechanism covering this?

thanks

Jerry

>
> Guenter
>
> >>
> >> Guenter
> >
> > Regards,
> >
> > Flavio
> >
> >>
> >>> Additionally, I added a implementation example of this "global"
> >>> parameters using the module "wdat_wdt"
> >>>
> >>> In details:
> >>>
> >>> ===============================
> >>> Watchdog Core Global Parameters
> >>> ===============================
> >>>
> >>> Information for watchdog kernel modules developers.
> >>>
> >>> Introduction
> >>> ============
> >>>
> >>> Different watchdog modules frequently require the same type of
> >>> parameters (for example: *timeout*, *nowayout* feature,
> >>> *start_enabled* to start the watchdog on module insertion, etc.).
> >>> Instead of adding this kind of module parameters independently to each
> >>> driver, the best solution is declaring each feature only once, in the
> >>> watchdog core.
> >>>
> >>> In this way, each driver can read these "global" parameters and then,
> >>> if needed, can implement them, according to the particular hw watchdog
> >>> characteristic.
> >>>
> >>> Using this approach, it is possible reduce some duplicate code in the
> >>> *new* watchdog drivers and simplify the code maintenance. Moreover,
> >>> the code will be clearer, since the same kind of parameters are often
> >>> called with different names (see Documentation/watchdog/watchdog-
> >> parameters.rst).
> >>> Obviously, for compatibility reasons, we cannot remove the already
> >>> existing parameters from the code of the various watchdog modules, but
> >>> we can use this "global" approach for the new watchdog drivers.
> >>>
> >>>
> >>> Global parameters declaration
> >>> ==============================
> >>>
> >>> The global parameters data structure is declared in
> >>> include/linux/watchdog.h, as::
> >>>
> >>> struct watchdog_global_parameters_struct {
> >>> int timeout;
> >>> int ioport;
> >>> int irq;
> >>> unsigned long features;
> >>> /* Bit numbers for features flags */
> >>> #define WDOG_GLOBAL_PARAM_VERBOSE 0
> >>> #define WDOG_GLOBAL_PARAM_TEST_MODE 1
> >>> #define WDOG_GLOBAL_PARAM_START_ENABLED 2
> >>> #define WDOG_GLOBAL_PARAM_NOWAYOUT 3
> >>> };
> >>>
> >>> The variable "feature" is a bitwise flags container, to store boolean
> >>> features, such as:
> >>>
> >>> * nowayout
> >>> * start_enable
> >>> * etc...
> >>>
> >>> Other variables can be added, to store some numerical values and other
> >>> data required.
> >>>
> >>> The global parameters are declared (as usual for the module
> >>> parameters) in the first part of drivers/watchdog/watchdog_core.c file.
> >>> The above global data structure is then managed by the function *void
> >>> global_parameters_init()*, in the same file.
> >>>
> >>> Global parameters use
> >>> =====================
> >>>
> >>> Each watchdog driver, to check if one of the global parameters is
> >>> enabled, can use the corresponding in-line function declared in
> >>> include/linux/watchdog.h.
> >>> At the moment the following functions are ready to use:
> >>>
> >>> * watchdog_global_param_verbose_enabled()
> >>> * watchdog_global_param_test_mode_enabled()
> >>> * watchdog_global_param_start_enabled()
> >>> * watchdog_global_param_nowayout_enabled()
> >>>
> >>>
> >>>
> >>> Flavio Suligoi (2):
> >>> watchdog: add global watchdog kernel module parameters structure
> >>> watchdog: wdat: add start_enable global parameter
> >>>
> >>> Documentation/watchdog/index.rst | 1 +
> >>> .../watchdog-core-global-parameters.rst | 74 +++++++++++++++++++
> >>> drivers/watchdog/watchdog_core.c | 74 +++++++++++++++++++
> >>> drivers/watchdog/wdat_wdt.c | 2 +
> >>> include/linux/watchdog.h | 42 +++++++++++
> >>> 5 files changed, 193 insertions(+)
> >>> create mode 100644
> >>> Documentation/watchdog/watchdog-core-global-parameters.rst
> >>>
> >

--

-----------------------------------------------------------------------------
Jerry Hoemann Software Engineer Hewlett Packard Enterprise
-----------------------------------------------------------------------------

2021-03-09 20:51:46

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v1 0/2] Watchdog Core Global Parameters

On 3/9/21 10:42 AM, Jerry Hoemann wrote:
> On Tue, Mar 09, 2021 at 07:22:28AM -0800, Guenter Roeck wrote:
>> On 3/9/21 2:26 AM, Flavio Suligoi wrote:
>>> Hi Guenter,
>>>
>>>>> Instead of adding this kind of module parameters independently to each
>>>>> driver, the best solution is declaring each feature only once, in the
>>>>> watchdog core.
>>>>>
>>>>
>>>> I agree to and like the idea, but I don't see the point of letting drivers opt in
>>>> or opt out. This adds a lot of complexity for little if any gain.
>>>
>>> Do you mean that all the support for this "global parameters" should be done
>>> in the watchdog-core only, without write any code in each single
>>> "hardware" driver?
>>
>> Correct. It should not be up to the driver author to decide if they
>> want to opt out from global parameters or not. It should be up to
>> users, and users can opt out by not providing the parameters.
>
>
> Guenter,
>
> What about parameters like "pretimeout" that only some WD drivers have
> hw to support?
>

Those drivers are supposed to set WDIOF_PRETIMEOUT. If they don't, any associated
module parameter would be ignored. That is quite similar to any other non-existing
module parameter.

> Might be nice to centralize these parameters as well, but leaving it up
> to users to decide might not make sense.
>

Decide what, exactly ? Users can still provide a pretimeout module
parameter even if pretimeout is not supported for a given watchdog.
That is the case today, and it won't change.

Given that, I must admit that I don't really understand your concern.

> Or do you see the recent work to allow for a software pretimeout
> mechanism covering this?
>

That is completely orthogonal.

Guenter

> thanks
>
> Jerry
>
>>
>> Guenter
>>
>>>>
>>>> Guenter
>>>
>>> Regards,
>>>
>>> Flavio
>>>
>>>>
>>>>> Additionally, I added a implementation example of this "global"
>>>>> parameters using the module "wdat_wdt"
>>>>>
>>>>> In details:
>>>>>
>>>>> ===============================
>>>>> Watchdog Core Global Parameters
>>>>> ===============================
>>>>>
>>>>> Information for watchdog kernel modules developers.
>>>>>
>>>>> Introduction
>>>>> ============
>>>>>
>>>>> Different watchdog modules frequently require the same type of
>>>>> parameters (for example: *timeout*, *nowayout* feature,
>>>>> *start_enabled* to start the watchdog on module insertion, etc.).
>>>>> Instead of adding this kind of module parameters independently to each
>>>>> driver, the best solution is declaring each feature only once, in the
>>>>> watchdog core.
>>>>>
>>>>> In this way, each driver can read these "global" parameters and then,
>>>>> if needed, can implement them, according to the particular hw watchdog
>>>>> characteristic.
>>>>>
>>>>> Using this approach, it is possible reduce some duplicate code in the
>>>>> *new* watchdog drivers and simplify the code maintenance. Moreover,
>>>>> the code will be clearer, since the same kind of parameters are often
>>>>> called with different names (see Documentation/watchdog/watchdog-
>>>> parameters.rst).
>>>>> Obviously, for compatibility reasons, we cannot remove the already
>>>>> existing parameters from the code of the various watchdog modules, but
>>>>> we can use this "global" approach for the new watchdog drivers.
>>>>>
>>>>>
>>>>> Global parameters declaration
>>>>> ==============================
>>>>>
>>>>> The global parameters data structure is declared in
>>>>> include/linux/watchdog.h, as::
>>>>>
>>>>> struct watchdog_global_parameters_struct {
>>>>> int timeout;
>>>>> int ioport;
>>>>> int irq;
>>>>> unsigned long features;
>>>>> /* Bit numbers for features flags */
>>>>> #define WDOG_GLOBAL_PARAM_VERBOSE 0
>>>>> #define WDOG_GLOBAL_PARAM_TEST_MODE 1
>>>>> #define WDOG_GLOBAL_PARAM_START_ENABLED 2
>>>>> #define WDOG_GLOBAL_PARAM_NOWAYOUT 3
>>>>> };
>>>>>
>>>>> The variable "feature" is a bitwise flags container, to store boolean
>>>>> features, such as:
>>>>>
>>>>> * nowayout
>>>>> * start_enable
>>>>> * etc...
>>>>>
>>>>> Other variables can be added, to store some numerical values and other
>>>>> data required.
>>>>>
>>>>> The global parameters are declared (as usual for the module
>>>>> parameters) in the first part of drivers/watchdog/watchdog_core.c file.
>>>>> The above global data structure is then managed by the function *void
>>>>> global_parameters_init()*, in the same file.
>>>>>
>>>>> Global parameters use
>>>>> =====================
>>>>>
>>>>> Each watchdog driver, to check if one of the global parameters is
>>>>> enabled, can use the corresponding in-line function declared in
>>>>> include/linux/watchdog.h.
>>>>> At the moment the following functions are ready to use:
>>>>>
>>>>> * watchdog_global_param_verbose_enabled()
>>>>> * watchdog_global_param_test_mode_enabled()
>>>>> * watchdog_global_param_start_enabled()
>>>>> * watchdog_global_param_nowayout_enabled()
>>>>>
>>>>>
>>>>>
>>>>> Flavio Suligoi (2):
>>>>> watchdog: add global watchdog kernel module parameters structure
>>>>> watchdog: wdat: add start_enable global parameter
>>>>>
>>>>> Documentation/watchdog/index.rst | 1 +
>>>>> .../watchdog-core-global-parameters.rst | 74 +++++++++++++++++++
>>>>> drivers/watchdog/watchdog_core.c | 74 +++++++++++++++++++
>>>>> drivers/watchdog/wdat_wdt.c | 2 +
>>>>> include/linux/watchdog.h | 42 +++++++++++
>>>>> 5 files changed, 193 insertions(+)
>>>>> create mode 100644
>>>>> Documentation/watchdog/watchdog-core-global-parameters.rst
>>>>>
>>>
>