drivers/watchdog: Constify static struct watchdog_ops
cover 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(-)
Signature · 1 line
2.32.0
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.
--- drivers/watchdog/sl28cpld_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sl28cpld_wdt.c +1 -1
@@ -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,
Signature · 1 line
2.32.0
Re: [PATCH 1/3] watchdog: sl28cpld_wdt: Constify static struct watchdog_ops
Quoted 5 lines · Rikard Falkeborn
The struct
sl28cpld_wdt_opsis only assigned to the ops pointer in thewatchdog_devicestruct, which is a pointer to const structwatchdog_ops. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Quoted 20 lines
--- drivers/watchdog/sl28cpld_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/watchdog/sl28cpld_wdt.c +1
-1@@ -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,Signature · 1 line
2.32.0
PATCH 2/3 watchdog: tqmx86: Constify static struct watchdog_ops
In reply to Rikard FalkebornThe 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.
--- drivers/watchdog/tqmx86_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/tqmx86_wdt.c +1 -1
@@ -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,
Signature · 1 line
2.32.0
Re: [PATCH 2/3] watchdog: tqmx86: Constify static struct watchdog_ops
Quoted 5 lines · Rikard Falkeborn
The struct
tqmx86_wdt_opsis only assigned to the ops pointer in thewatchdog_devicestruct, which is a pointer to const structwatchdog_ops. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Quoted 20 lines
--- drivers/watchdog/tqmx86_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/watchdog/tqmx86_wdt.c +1
-1@@ -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,Signature · 1 line
2.32.0
PATCH 3/3 watchdog: mpc8xxx_wdt: Constify static struct watchdog_ops
In reply to Rikard FalkebornThe 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.
--- drivers/watchdog/mpc8xxx_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/mpc8xxx_wdt.c +1 -1
@@ -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,
Signature · 1 line
2.32.0
Re: [PATCH 3/3] watchdog: mpc8xxx_wdt: Constify static struct watchdog_ops
Quoted 5 lines · Rikard Falkeborn
The struct
mpc8xxx_wdt_opsis only assigned to the ops pointer in thewatchdog_devicestruct, which is a pointer to const structwatchdog_ops. Make it const to allow the compiler to put it in read-only memory.Signed-off-by Rikard Falkeborn <[email protected]>
Quoted 20 lines
--- drivers/watchdog/mpc8xxx_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/watchdog/mpc8xxx_wdt.c +1
-1@@ -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,Signature · 1 line
2.32.0