Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

watchdog: Make API functions const correct

Many watchdog API functions do not modify the watchdog_device nor
device. Mark their arguments as const to reflect this and improve
const-correctness of the API.

No functional change intended.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Kari Argillander and committed by
Wim Van Sebroeck
439cf01b d303d37e

+10 -7
+1 -1
Documentation/watchdog/watchdog-kernel-api.rst
··· 293 293 294 294 extern int watchdog_init_timeout(struct watchdog_device *wdd, 295 295 unsigned int timeout_parm, 296 - struct device *dev); 296 + const struct device *dev); 297 297 298 298 The watchdog_init_timeout function allows you to initialize the timeout field 299 299 using the module timeout parameter or by retrieving the timeout-sec property from
+2 -1
drivers/watchdog/watchdog_core.c
··· 117 117 * bounds. 118 118 */ 119 119 int watchdog_init_timeout(struct watchdog_device *wdd, 120 - unsigned int timeout_parm, struct device *dev) 120 + unsigned int timeout_parm, 121 + const struct device *dev) 121 122 { 122 123 const char *dev_str = wdd->parent ? dev_name(wdd->parent) : 123 124 (const char *)wdd->info->identity;
+7 -5
include/linux/watchdog.h
··· 129 129 #define WATCHDOG_NOWAYOUT_INIT_STATUS (WATCHDOG_NOWAYOUT << WDOG_NO_WAY_OUT) 130 130 131 131 /* Use the following function to check whether or not the watchdog is active */ 132 - static inline bool watchdog_active(struct watchdog_device *wdd) 132 + static inline bool watchdog_active(const struct watchdog_device *wdd) 133 133 { 134 134 return test_bit(WDOG_ACTIVE, &wdd->status); 135 135 } ··· 138 138 * Use the following function to check whether or not the hardware watchdog 139 139 * is running 140 140 */ 141 - static inline bool watchdog_hw_running(struct watchdog_device *wdd) 141 + static inline bool watchdog_hw_running(const struct watchdog_device *wdd) 142 142 { 143 143 return test_bit(WDOG_HW_RUNNING, &wdd->status); 144 144 } ··· 169 169 } 170 170 171 171 /* Use the following function to check if a timeout value is invalid */ 172 - static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigned int t) 172 + static inline bool watchdog_timeout_invalid(const struct watchdog_device *wdd, 173 + unsigned int t) 173 174 { 174 175 /* 175 176 * The timeout is invalid if ··· 189 188 } 190 189 191 190 /* Use the following function to check if a pretimeout value is invalid */ 192 - static inline bool watchdog_pretimeout_invalid(struct watchdog_device *wdd, 191 + static inline bool watchdog_pretimeout_invalid(const struct watchdog_device *wdd, 193 192 unsigned int t) 194 193 { 195 194 return t && wdd->timeout && t >= wdd->timeout; ··· 219 218 /* drivers/watchdog/watchdog_core.c */ 220 219 void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority); 221 220 extern int watchdog_init_timeout(struct watchdog_device *wdd, 222 - unsigned int timeout_parm, struct device *dev); 221 + unsigned int timeout_parm, 222 + const struct device *dev); 223 223 extern int watchdog_register_device(struct watchdog_device *); 224 224 extern void watchdog_unregister_device(struct watchdog_device *); 225 225 int watchdog_dev_suspend(struct watchdog_device *wdd);