Lines Matching full:wdd
67 static void watchdog_deferred_registration_add(struct watchdog_device *wdd) in watchdog_deferred_registration_add() argument
69 list_add_tail(&wdd->deferred, in watchdog_deferred_registration_add()
73 static void watchdog_deferred_registration_del(struct watchdog_device *wdd) in watchdog_deferred_registration_del() argument
81 if (wdd_tmp == wdd) { in watchdog_deferred_registration_del()
88 static void watchdog_check_min_max_timeout(struct watchdog_device *wdd) in watchdog_check_min_max_timeout() argument
94 if (!wdd->max_hw_heartbeat_ms && wdd->min_timeout > wdd->max_timeout) { in watchdog_check_min_max_timeout()
96 wdd->min_timeout = 0; in watchdog_check_min_max_timeout()
97 wdd->max_timeout = 0; in watchdog_check_min_max_timeout()
103 * @wdd: watchdog device
118 int watchdog_init_timeout(struct watchdog_device *wdd, in watchdog_init_timeout() argument
121 const char *dev_str = wdd->parent ? dev_name(wdd->parent) : in watchdog_init_timeout()
122 (const char *)wdd->info->identity; in watchdog_init_timeout()
126 watchdog_check_min_max_timeout(wdd); in watchdog_init_timeout()
130 if (!watchdog_timeout_invalid(wdd, timeout_parm)) { in watchdog_init_timeout()
131 wdd->timeout = timeout_parm; in watchdog_init_timeout()
142 if (t && !watchdog_timeout_invalid(wdd, t)) { in watchdog_init_timeout()
143 wdd->timeout = t; in watchdog_init_timeout()
150 if (ret < 0 && wdd->timeout) in watchdog_init_timeout()
152 wdd->timeout); in watchdog_init_timeout()
161 struct watchdog_device *wdd; in watchdog_reboot_notifier() local
163 wdd = container_of(nb, struct watchdog_device, reboot_nb); in watchdog_reboot_notifier()
165 if (watchdog_hw_running(wdd)) { in watchdog_reboot_notifier()
168 ret = wdd->ops->stop(wdd); in watchdog_reboot_notifier()
169 trace_watchdog_stop(wdd, ret); in watchdog_reboot_notifier()
181 struct watchdog_device *wdd = container_of(nb, struct watchdog_device, in watchdog_restart_notifier() local
186 ret = wdd->ops->restart(wdd, action, data); in watchdog_restart_notifier()
196 struct watchdog_device *wdd; in watchdog_pm_notifier() local
199 wdd = container_of(nb, struct watchdog_device, pm_nb); in watchdog_pm_notifier()
205 ret = watchdog_dev_suspend(wdd); in watchdog_pm_notifier()
210 ret = watchdog_dev_resume(wdd); in watchdog_pm_notifier()
222 * @wdd: watchdog device
230 * If a wdd->ops->restart function is provided when watchdog_register_device is
234 void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority) in watchdog_set_restart_priority() argument
236 wdd->restart_nb.priority = priority; in watchdog_set_restart_priority()
240 static int ___watchdog_register_device(struct watchdog_device *wdd) in ___watchdog_register_device() argument
244 if (wdd == NULL || wdd->info == NULL || wdd->ops == NULL) in ___watchdog_register_device()
248 if (!wdd->ops->start || (!wdd->ops->stop && !wdd->max_hw_heartbeat_ms)) in ___watchdog_register_device()
251 watchdog_check_min_max_timeout(wdd); in ___watchdog_register_device()
260 if (wdd->parent) { in ___watchdog_register_device()
261 ret = of_alias_get_id(wdd->parent->of_node, "watchdog"); in ___watchdog_register_device()
272 wdd->id = id; in ___watchdog_register_device()
274 ret = watchdog_dev_register(wdd); in ___watchdog_register_device()
285 wdd->id = id; in ___watchdog_register_device()
287 ret = watchdog_dev_register(wdd); in ___watchdog_register_device()
297 set_bit(WDOG_STOP_ON_REBOOT, &wdd->status); in ___watchdog_register_device()
299 clear_bit(WDOG_STOP_ON_REBOOT, &wdd->status); in ___watchdog_register_device()
302 if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status)) { in ___watchdog_register_device()
303 if (!wdd->ops->stop) in ___watchdog_register_device()
304 pr_warn("watchdog%d: stop_on_reboot not supported\n", wdd->id); in ___watchdog_register_device()
306 wdd->reboot_nb.notifier_call = watchdog_reboot_notifier; in ___watchdog_register_device()
308 ret = register_reboot_notifier(&wdd->reboot_nb); in ___watchdog_register_device()
311 wdd->id, ret); in ___watchdog_register_device()
312 watchdog_dev_unregister(wdd); in ___watchdog_register_device()
319 if (wdd->ops->restart) { in ___watchdog_register_device()
320 wdd->restart_nb.notifier_call = watchdog_restart_notifier; in ___watchdog_register_device()
322 ret = register_restart_handler(&wdd->restart_nb); in ___watchdog_register_device()
325 wdd->id, ret); in ___watchdog_register_device()
328 if (test_bit(WDOG_NO_PING_ON_SUSPEND, &wdd->status)) { in ___watchdog_register_device()
329 wdd->pm_nb.notifier_call = watchdog_pm_notifier; in ___watchdog_register_device()
331 ret = register_pm_notifier(&wdd->pm_nb); in ___watchdog_register_device()
334 wdd->id, ret); in ___watchdog_register_device()
340 static int __watchdog_register_device(struct watchdog_device *wdd) in __watchdog_register_device() argument
345 ret = ___watchdog_register_device(wdd); in __watchdog_register_device()
347 dev_str = wdd->parent ? dev_name(wdd->parent) : in __watchdog_register_device()
348 (const char *)wdd->info->identity; in __watchdog_register_device()
358 * @wdd: watchdog device
367 int watchdog_register_device(struct watchdog_device *wdd) in watchdog_register_device() argument
373 ret = __watchdog_register_device(wdd); in watchdog_register_device()
375 watchdog_deferred_registration_add(wdd); in watchdog_register_device()
382 static void __watchdog_unregister_device(struct watchdog_device *wdd) in __watchdog_unregister_device() argument
384 if (wdd == NULL) in __watchdog_unregister_device()
387 if (wdd->ops->restart) in __watchdog_unregister_device()
388 unregister_restart_handler(&wdd->restart_nb); in __watchdog_unregister_device()
390 if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status)) in __watchdog_unregister_device()
391 unregister_reboot_notifier(&wdd->reboot_nb); in __watchdog_unregister_device()
393 watchdog_dev_unregister(wdd); in __watchdog_unregister_device()
394 ida_free(&watchdog_ida, wdd->id); in __watchdog_unregister_device()
399 * @wdd: watchdog device to unregister
405 void watchdog_unregister_device(struct watchdog_device *wdd) in watchdog_unregister_device() argument
409 __watchdog_unregister_device(wdd); in watchdog_unregister_device()
411 watchdog_deferred_registration_del(wdd); in watchdog_unregister_device()
425 * @wdd: watchdog device
432 struct watchdog_device *wdd) in devm_watchdog_register_device() argument
442 ret = watchdog_register_device(wdd); in devm_watchdog_register_device()
444 *rcwdd = wdd; in devm_watchdog_register_device()
459 struct watchdog_device *wdd; in watchdog_deferred_registration() local
461 wdd = list_first_entry(&wtd_deferred_reg_list, in watchdog_deferred_registration()
463 list_del(&wdd->deferred); in watchdog_deferred_registration()
464 __watchdog_register_device(wdd); in watchdog_deferred_registration()