2021-07-27 22:31:52

by Rikard Falkeborn

[permalink] [raw]
Subject: [PATCH 0/3] drivers/watchdog: Constify static struct watchdog_ops

Constify three instances of static struct watchdog_ops. These are only
assigned to the ops field in the watchdog_device struct, which is a
pointer to const struct watchdog_ops.

With these changes applied, all static watchdog_ops structs are const
(checked for next-20210727), 119 instances).

Rikard Falkeborn (3):
watchdog: sl28cpld_wdt: Constify static struct watchdog_ops
watchdog: tqmx86: Constify static struct watchdog_ops
watchdog: mpc8xxx_wdt: Constify static struct watchdog_ops

drivers/watchdog/mpc8xxx_wdt.c | 2 +-
drivers/watchdog/sl28cpld_wdt.c | 2 +-
drivers/watchdog/tqmx86_wdt.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

--
2.32.0



2021-07-27 22:32:45

by Rikard Falkeborn

[permalink] [raw]
Subject: [PATCH 1/3] watchdog: sl28cpld_wdt: Constify static struct watchdog_ops

The struct sl28cpld_wdt_ops is only assigned to the ops pointer in the
watchdog_device struct, which is a pointer to const struct watchdog_ops.
Make it const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <[email protected]>
---
drivers/watchdog/sl28cpld_wdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/sl28cpld_wdt.c b/drivers/watchdog/sl28cpld_wdt.c
index 2de93298475f..9ce456f09f73 100644
--- a/drivers/watchdog/sl28cpld_wdt.c
+++ b/drivers/watchdog/sl28cpld_wdt.c
@@ -108,7 +108,7 @@ static const struct watchdog_info sl28cpld_wdt_info = {
.identity = "sl28cpld watchdog",
};

-static struct watchdog_ops sl28cpld_wdt_ops = {
+static const struct watchdog_ops sl28cpld_wdt_ops = {
.owner = THIS_MODULE,
.start = sl28cpld_wdt_start,
.stop = sl28cpld_wdt_stop,
--
2.32.0


2021-07-27 22:32:55

by Rikard Falkeborn

[permalink] [raw]
Subject: [PATCH 3/3] watchdog: mpc8xxx_wdt: Constify static struct watchdog_ops

The struct mpc8xxx_wdt_ops is only assigned to the ops pointer in the
watchdog_device struct, which is a pointer to const struct watchdog_ops.
Make it const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <[email protected]>
---
drivers/watchdog/mpc8xxx_wdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 2f7ded32e878..1c569be72ea2 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -118,7 +118,7 @@ static struct watchdog_info mpc8xxx_wdt_info = {
.identity = "MPC8xxx",
};

-static struct watchdog_ops mpc8xxx_wdt_ops = {
+static const struct watchdog_ops mpc8xxx_wdt_ops = {
.owner = THIS_MODULE,
.start = mpc8xxx_wdt_start,
.ping = mpc8xxx_wdt_ping,
--
2.32.0


2021-07-27 22:35:29

by Rikard Falkeborn

[permalink] [raw]
Subject: [PATCH 2/3] watchdog: tqmx86: Constify static struct watchdog_ops

The struct tqmx86_wdt_ops is only assigned to the ops pointer in the
watchdog_device struct, which is a pointer to const struct watchdog_ops.
Make it const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <[email protected]>
---
drivers/watchdog/tqmx86_wdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/tqmx86_wdt.c b/drivers/watchdog/tqmx86_wdt.c
index 72d0b0adde38..83860e94ce9d 100644
--- a/drivers/watchdog/tqmx86_wdt.c
+++ b/drivers/watchdog/tqmx86_wdt.c
@@ -62,7 +62,7 @@ static const struct watchdog_info tqmx86_wdt_info = {
.identity = "TQMx86 Watchdog",
};

-static struct watchdog_ops tqmx86_wdt_ops = {
+static const struct watchdog_ops tqmx86_wdt_ops = {
.owner = THIS_MODULE,
.start = tqmx86_wdt_start,
.set_timeout = tqmx86_wdt_set_timeout,
--
2.32.0


2021-07-28 18:05:21

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 1/3] watchdog: sl28cpld_wdt: Constify static struct watchdog_ops

On Wed, Jul 28, 2021 at 12:30:40AM +0200, Rikard Falkeborn wrote:
> The struct sl28cpld_wdt_ops is only assigned to the ops pointer in the
> watchdog_device struct, which is a pointer to const struct watchdog_ops.
> Make it const to allow the compiler to put it in read-only memory.
>
> Signed-off-by: Rikard Falkeborn <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
> drivers/watchdog/sl28cpld_wdt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/sl28cpld_wdt.c b/drivers/watchdog/sl28cpld_wdt.c
> index 2de93298475f..9ce456f09f73 100644
> --- a/drivers/watchdog/sl28cpld_wdt.c
> +++ b/drivers/watchdog/sl28cpld_wdt.c
> @@ -108,7 +108,7 @@ static const struct watchdog_info sl28cpld_wdt_info = {
> .identity = "sl28cpld watchdog",
> };
>
> -static struct watchdog_ops sl28cpld_wdt_ops = {
> +static const struct watchdog_ops sl28cpld_wdt_ops = {
> .owner = THIS_MODULE,
> .start = sl28cpld_wdt_start,
> .stop = sl28cpld_wdt_stop,
> --
> 2.32.0
>

2021-07-28 18:06:02

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 2/3] watchdog: tqmx86: Constify static struct watchdog_ops

On Wed, Jul 28, 2021 at 12:30:41AM +0200, Rikard Falkeborn wrote:
> The struct tqmx86_wdt_ops is only assigned to the ops pointer in the
> watchdog_device struct, which is a pointer to const struct watchdog_ops.
> Make it const to allow the compiler to put it in read-only memory.
>
> Signed-off-by: Rikard Falkeborn <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
> drivers/watchdog/tqmx86_wdt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/tqmx86_wdt.c b/drivers/watchdog/tqmx86_wdt.c
> index 72d0b0adde38..83860e94ce9d 100644
> --- a/drivers/watchdog/tqmx86_wdt.c
> +++ b/drivers/watchdog/tqmx86_wdt.c
> @@ -62,7 +62,7 @@ static const struct watchdog_info tqmx86_wdt_info = {
> .identity = "TQMx86 Watchdog",
> };
>
> -static struct watchdog_ops tqmx86_wdt_ops = {
> +static const struct watchdog_ops tqmx86_wdt_ops = {
> .owner = THIS_MODULE,
> .start = tqmx86_wdt_start,
> .set_timeout = tqmx86_wdt_set_timeout,
> --
> 2.32.0
>

2021-07-28 18:08:53

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 3/3] watchdog: mpc8xxx_wdt: Constify static struct watchdog_ops

On Wed, Jul 28, 2021 at 12:30:42AM +0200, Rikard Falkeborn wrote:
> The struct mpc8xxx_wdt_ops is only assigned to the ops pointer in the
> watchdog_device struct, which is a pointer to const struct watchdog_ops.
> Make it const to allow the compiler to put it in read-only memory.
>
> Signed-off-by: Rikard Falkeborn <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
> drivers/watchdog/mpc8xxx_wdt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
> index 2f7ded32e878..1c569be72ea2 100644
> --- a/drivers/watchdog/mpc8xxx_wdt.c
> +++ b/drivers/watchdog/mpc8xxx_wdt.c
> @@ -118,7 +118,7 @@ static struct watchdog_info mpc8xxx_wdt_info = {
> .identity = "MPC8xxx",
> };
>
> -static struct watchdog_ops mpc8xxx_wdt_ops = {
> +static const struct watchdog_ops mpc8xxx_wdt_ops = {
> .owner = THIS_MODULE,
> .start = mpc8xxx_wdt_start,
> .ping = mpc8xxx_wdt_ping,
> --
> 2.32.0
>