Lines Matching refs: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()
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_active(wdd) || 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()
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()
284 wdd->id = id; in __watchdog_register_device()
286 ret = watchdog_dev_register(wdd); in __watchdog_register_device()
296 set_bit(WDOG_STOP_ON_REBOOT, &wdd->status); in __watchdog_register_device()
298 clear_bit(WDOG_STOP_ON_REBOOT, &wdd->status); in __watchdog_register_device()
301 if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status)) { in __watchdog_register_device()
302 if (!wdd->ops->stop) in __watchdog_register_device()
303 pr_warn("watchdog%d: stop_on_reboot not supported\n", wdd->id); in __watchdog_register_device()
305 wdd->reboot_nb.notifier_call = watchdog_reboot_notifier; in __watchdog_register_device()
307 ret = register_reboot_notifier(&wdd->reboot_nb); in __watchdog_register_device()
310 wdd->id, ret); in __watchdog_register_device()
311 watchdog_dev_unregister(wdd); in __watchdog_register_device()
318 if (wdd->ops->restart) { in __watchdog_register_device()
319 wdd->restart_nb.notifier_call = watchdog_restart_notifier; in __watchdog_register_device()
321 ret = register_restart_handler(&wdd->restart_nb); in __watchdog_register_device()
324 wdd->id, ret); in __watchdog_register_device()
327 if (test_bit(WDOG_NO_PING_ON_SUSPEND, &wdd->status)) { in __watchdog_register_device()
328 wdd->pm_nb.notifier_call = watchdog_pm_notifier; in __watchdog_register_device()
330 ret = register_pm_notifier(&wdd->pm_nb); in __watchdog_register_device()
333 wdd->id, ret); in __watchdog_register_device()
350 int watchdog_register_device(struct watchdog_device *wdd) in watchdog_register_device() argument
357 ret = __watchdog_register_device(wdd); in watchdog_register_device()
359 watchdog_deferred_registration_add(wdd); in watchdog_register_device()
363 dev_str = wdd->parent ? dev_name(wdd->parent) : in watchdog_register_device()
364 (const char *)wdd->info->identity; in watchdog_register_device()
373 static void __watchdog_unregister_device(struct watchdog_device *wdd) in __watchdog_unregister_device() argument
375 if (wdd == NULL) in __watchdog_unregister_device()
378 if (wdd->ops->restart) in __watchdog_unregister_device()
379 unregister_restart_handler(&wdd->restart_nb); in __watchdog_unregister_device()
381 if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status)) in __watchdog_unregister_device()
382 unregister_reboot_notifier(&wdd->reboot_nb); in __watchdog_unregister_device()
384 watchdog_dev_unregister(wdd); in __watchdog_unregister_device()
385 ida_simple_remove(&watchdog_ida, wdd->id); in __watchdog_unregister_device()
396 void watchdog_unregister_device(struct watchdog_device *wdd) in watchdog_unregister_device() argument
400 __watchdog_unregister_device(wdd); in watchdog_unregister_device()
402 watchdog_deferred_registration_del(wdd); in watchdog_unregister_device()
423 struct watchdog_device *wdd) in devm_watchdog_register_device() argument
433 ret = watchdog_register_device(wdd); in devm_watchdog_register_device()
435 *rcwdd = wdd; in devm_watchdog_register_device()
450 struct watchdog_device *wdd; in watchdog_deferred_registration() local
452 wdd = list_first_entry(&wtd_deferred_reg_list, in watchdog_deferred_registration()
454 list_del(&wdd->deferred); in watchdog_deferred_registration()
455 __watchdog_register_device(wdd); in watchdog_deferred_registration()