Lines Matching refs:wdd
63 static int watchdog_deferred_registration_add(struct watchdog_device *wdd) in watchdog_deferred_registration_add() argument
65 list_add_tail(&wdd->deferred, in watchdog_deferred_registration_add()
70 static void watchdog_deferred_registration_del(struct watchdog_device *wdd) in watchdog_deferred_registration_del() argument
78 if (wdd_tmp == wdd) { in watchdog_deferred_registration_del()
85 static void watchdog_check_min_max_timeout(struct watchdog_device *wdd) in watchdog_check_min_max_timeout() argument
91 if (wdd->min_timeout > wdd->max_timeout) { in watchdog_check_min_max_timeout()
93 wdd->min_timeout = 0; in watchdog_check_min_max_timeout()
94 wdd->max_timeout = 0; in watchdog_check_min_max_timeout()
111 int watchdog_init_timeout(struct watchdog_device *wdd, in watchdog_init_timeout() argument
117 watchdog_check_min_max_timeout(wdd); in watchdog_init_timeout()
120 if (!watchdog_timeout_invalid(wdd, timeout_parm) && timeout_parm) { in watchdog_init_timeout()
121 wdd->timeout = timeout_parm; in watchdog_init_timeout()
131 if (!watchdog_timeout_invalid(wdd, t) && t) in watchdog_init_timeout()
132 wdd->timeout = t; in watchdog_init_timeout()
140 static int __watchdog_register_device(struct watchdog_device *wdd) in __watchdog_register_device() argument
144 if (wdd == NULL || wdd->info == NULL || wdd->ops == NULL) in __watchdog_register_device()
148 if (wdd->ops->start == NULL || wdd->ops->stop == NULL) in __watchdog_register_device()
151 watchdog_check_min_max_timeout(wdd); in __watchdog_register_device()
159 mutex_init(&wdd->lock); in __watchdog_register_device()
162 if (wdd->parent) { in __watchdog_register_device()
163 ret = of_alias_get_id(wdd->parent->of_node, "watchdog"); in __watchdog_register_device()
174 wdd->id = id; in __watchdog_register_device()
176 ret = watchdog_dev_register(wdd); in __watchdog_register_device()
186 wdd->id = id; in __watchdog_register_device()
188 ret = watchdog_dev_register(wdd); in __watchdog_register_device()
195 devno = wdd->cdev.dev; in __watchdog_register_device()
196 wdd->dev = device_create(watchdog_class, wdd->parent, devno, in __watchdog_register_device()
197 NULL, "watchdog%d", wdd->id); in __watchdog_register_device()
198 if (IS_ERR(wdd->dev)) { in __watchdog_register_device()
199 watchdog_dev_unregister(wdd); in __watchdog_register_device()
201 ret = PTR_ERR(wdd->dev); in __watchdog_register_device()
219 int watchdog_register_device(struct watchdog_device *wdd) in watchdog_register_device() argument
225 ret = __watchdog_register_device(wdd); in watchdog_register_device()
227 ret = watchdog_deferred_registration_add(wdd); in watchdog_register_device()
233 static void __watchdog_unregister_device(struct watchdog_device *wdd) in __watchdog_unregister_device() argument
238 if (wdd == NULL) in __watchdog_unregister_device()
241 devno = wdd->cdev.dev; in __watchdog_unregister_device()
242 ret = watchdog_dev_unregister(wdd); in __watchdog_unregister_device()
246 ida_simple_remove(&watchdog_ida, wdd->id); in __watchdog_unregister_device()
247 wdd->dev = NULL; in __watchdog_unregister_device()
258 void watchdog_unregister_device(struct watchdog_device *wdd) in watchdog_unregister_device() argument
262 __watchdog_unregister_device(wdd); in watchdog_unregister_device()
264 watchdog_deferred_registration_del(wdd); in watchdog_unregister_device()
275 struct watchdog_device *wdd; in watchdog_deferred_registration() local
277 wdd = list_first_entry(&wtd_deferred_reg_list, in watchdog_deferred_registration()
279 list_del(&wdd->deferred); in watchdog_deferred_registration()
280 __watchdog_register_device(wdd); in watchdog_deferred_registration()