watchdog: apple: Constify some structures

'struct watchdog_ops' and 'struct watchdog_info' are not modified in this
driver.

Constifying these structure moves some data to a read-only section, so
increases overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
   7319	   1768	      0	   9087	   237f	drivers/watchdog/apple_wdt.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
   7543	   1544	      0	   9087	   237f	drivers/watchdog/apple_wdt.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/99019b7e560c2d9c087be340e68f9cce4db1988e.1786283336.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Christophe JAILLET 2026-08-09 15:49:10 +02:00 committed by Guenter Roeck
parent 382a3cd59e
commit 799ef16e46

View File

@ -139,7 +139,7 @@ static int apple_wdt_restart(struct watchdog_device *wdd, unsigned long mode,
return 0;
}
static struct watchdog_ops apple_wdt_ops = {
static const struct watchdog_ops apple_wdt_ops = {
.owner = THIS_MODULE,
.start = apple_wdt_start,
.stop = apple_wdt_stop,
@ -149,7 +149,7 @@ static struct watchdog_ops apple_wdt_ops = {
.restart = apple_wdt_restart,
};
static struct watchdog_info apple_wdt_info = {
static const struct watchdog_info apple_wdt_info = {
.identity = "Apple SoC Watchdog",
.options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
};