linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] drivers/watchdog: Constify static struct watchdog_ops
@ 2021-07-27 22:30 Rikard Falkeborn
  2021-07-27 22:30 ` [PATCH 1/3] watchdog: sl28cpld_wdt: " Rikard Falkeborn
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rikard Falkeborn @ 2021-07-27 22:30 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck
  Cc: linux-watchdog, linux-kernel, Rikard Falkeborn

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] watchdog: sl28cpld_wdt: Constify static struct watchdog_ops
  2021-07-27 22:30 [PATCH 0/3] drivers/watchdog: Constify static struct watchdog_ops Rikard Falkeborn
@ 2021-07-27 22:30 ` Rikard Falkeborn
  2021-07-28 18:04   ` Guenter Roeck
  2021-07-27 22:30 ` [PATCH 2/3] watchdog: tqmx86: " Rikard Falkeborn
  2021-07-27 22:30 ` [PATCH 3/3] watchdog: mpc8xxx_wdt: " Rikard Falkeborn
  2 siblings, 1 reply; 7+ messages in thread
From: Rikard Falkeborn @ 2021-07-27 22:30 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck
  Cc: linux-watchdog, linux-kernel, Rikard Falkeborn

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 <rikard.falkeborn@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] watchdog: tqmx86: Constify static struct watchdog_ops
  2021-07-27 22:30 [PATCH 0/3] drivers/watchdog: Constify static struct watchdog_ops Rikard Falkeborn
  2021-07-27 22:30 ` [PATCH 1/3] watchdog: sl28cpld_wdt: " Rikard Falkeborn
@ 2021-07-27 22:30 ` Rikard Falkeborn
  2021-07-28 18:04   ` Guenter Roeck
  2021-07-27 22:30 ` [PATCH 3/3] watchdog: mpc8xxx_wdt: " Rikard Falkeborn
  2 siblings, 1 reply; 7+ messages in thread
From: Rikard Falkeborn @ 2021-07-27 22:30 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck
  Cc: linux-watchdog, linux-kernel, Rikard Falkeborn

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 <rikard.falkeborn@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] watchdog: mpc8xxx_wdt: Constify static struct watchdog_ops
  2021-07-27 22:30 [PATCH 0/3] drivers/watchdog: Constify static struct watchdog_ops Rikard Falkeborn
  2021-07-27 22:30 ` [PATCH 1/3] watchdog: sl28cpld_wdt: " Rikard Falkeborn
  2021-07-27 22:30 ` [PATCH 2/3] watchdog: tqmx86: " Rikard Falkeborn
@ 2021-07-27 22:30 ` Rikard Falkeborn
  2021-07-28 18:04   ` Guenter Roeck
  2 siblings, 1 reply; 7+ messages in thread
From: Rikard Falkeborn @ 2021-07-27 22:30 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck
  Cc: linux-watchdog, linux-kernel, Rikard Falkeborn

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 <rikard.falkeborn@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] watchdog: sl28cpld_wdt: Constify static struct watchdog_ops
  2021-07-27 22:30 ` [PATCH 1/3] watchdog: sl28cpld_wdt: " Rikard Falkeborn
@ 2021-07-28 18:04   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-07-28 18:04 UTC (permalink / raw)
  To: Rikard Falkeborn; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

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 <rikard.falkeborn@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  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
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] watchdog: tqmx86: Constify static struct watchdog_ops
  2021-07-27 22:30 ` [PATCH 2/3] watchdog: tqmx86: " Rikard Falkeborn
@ 2021-07-28 18:04   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-07-28 18:04 UTC (permalink / raw)
  To: Rikard Falkeborn; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

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 <rikard.falkeborn@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  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
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] watchdog: mpc8xxx_wdt: Constify static struct watchdog_ops
  2021-07-27 22:30 ` [PATCH 3/3] watchdog: mpc8xxx_wdt: " Rikard Falkeborn
@ 2021-07-28 18:04   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-07-28 18:04 UTC (permalink / raw)
  To: Rikard Falkeborn; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

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 <rikard.falkeborn@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  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
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-07-28 18:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 22:30 [PATCH 0/3] drivers/watchdog: Constify static struct watchdog_ops Rikard Falkeborn
2021-07-27 22:30 ` [PATCH 1/3] watchdog: sl28cpld_wdt: " Rikard Falkeborn
2021-07-28 18:04   ` Guenter Roeck
2021-07-27 22:30 ` [PATCH 2/3] watchdog: tqmx86: " Rikard Falkeborn
2021-07-28 18:04   ` Guenter Roeck
2021-07-27 22:30 ` [PATCH 3/3] watchdog: mpc8xxx_wdt: " Rikard Falkeborn
2021-07-28 18:04   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).