diff mbox series

[3/3] watchdog: mpc8xxx_wdt: Constify static struct watchdog_ops

Message ID 20210727223042.48150-4-rikard.falkeborn@gmail.com
State New
Headers show
Series [1/3] watchdog: sl28cpld_wdt: Constify static struct watchdog_ops | expand

Commit Message

Rikard Falkeborn July 27, 2021, 10:30 p.m. UTC
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(-)

Comments

Guenter Roeck July 28, 2021, 6:04 p.m. UTC | #1
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

>
diff mbox series

Patch

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,