Lines Matching full:nf

150 	struct ssam_event_notifier *nf;  in ssam_nfblk_call_chain()  local
155 list_for_each_entry_rcu(nf, &nh->head, base.node, in ssam_nfblk_call_chain()
157 if (ssam_event_matches_notifier(nf, event)) { in ssam_nfblk_call_chain()
158 ret = (ret & SSAM_NOTIF_STATE_MASK) | nf->base.fn(nf, event); in ssam_nfblk_call_chain()
300 * @nf: The notifier system reference.
308 * Note: ``nf->lock`` must be held when calling this function.
315 ssam_nf_refcount_inc(struct ssam_nf *nf, struct ssam_event_registry reg, in ssam_nf_refcount_inc() argument
320 struct rb_node **link = &nf->refcount.rb_node; in ssam_nf_refcount_inc()
324 lockdep_assert_held(&nf->lock); in ssam_nf_refcount_inc()
355 rb_insert_color(&entry->node, &nf->refcount); in ssam_nf_refcount_inc()
363 * @nf: The notifier system reference.
371 * Note: ``nf->lock`` must be held when calling this function.
377 ssam_nf_refcount_dec(struct ssam_nf *nf, struct ssam_event_registry reg, in ssam_nf_refcount_dec() argument
382 struct rb_node *node = nf->refcount.rb_node; in ssam_nf_refcount_dec()
385 lockdep_assert_held(&nf->lock); in ssam_nf_refcount_dec()
401 rb_erase(&entry->node, &nf->refcount); in ssam_nf_refcount_dec()
413 * @nf: The notifier system reference.
420 * Note: ``nf->lock`` must be held when calling this function.
422 static void ssam_nf_refcount_dec_free(struct ssam_nf *nf, in ssam_nf_refcount_dec_free() argument
428 lockdep_assert_held(&nf->lock); in ssam_nf_refcount_dec_free()
430 entry = ssam_nf_refcount_dec(nf, reg, id); in ssam_nf_refcount_dec_free()
438 * @nf: The notification system.
440 static bool ssam_nf_refcount_empty(struct ssam_nf *nf) in ssam_nf_refcount_empty() argument
442 return RB_EMPTY_ROOT(&nf->refcount); in ssam_nf_refcount_empty()
447 * @nf: The notifier system
464 static void ssam_nf_call(struct ssam_nf *nf, struct device *dev, u16 rqid, in ssam_nf_call() argument
475 nf_head = &nf->head[ssh_rqid_to_event(rqid)]; in ssam_nf_call()
494 * @nf: The notifier system to initialize.
496 static int ssam_nf_init(struct ssam_nf *nf) in ssam_nf_init() argument
501 status = ssam_nf_head_init(&nf->head[i]); in ssam_nf_init()
508 ssam_nf_head_destroy(&nf->head[i]); in ssam_nf_init()
513 mutex_init(&nf->lock); in ssam_nf_init()
519 * @nf: The notifier system to deinitialize.
521 static void ssam_nf_destroy(struct ssam_nf *nf) in ssam_nf_destroy() argument
526 ssam_nf_head_destroy(&nf->head[i]); in ssam_nf_destroy()
528 mutex_destroy(&nf->lock); in ssam_nf_destroy()
780 struct ssam_nf *nf; in ssam_event_queue_work_fn() local
785 nf = &queue->cplt->event.notif; in ssam_event_queue_work_fn()
794 ssam_nf_call(nf, dev, item->rqid, &item->event); in ssam_event_queue_work_fn()
2207 * Note: ``nf->lock`` must be held when calling this function.
2217 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_nf_refcount_enable() local
2220 lockdep_assert_held(&nf->lock); in ssam_nf_refcount_enable()
2271 * Note: ``nf->lock`` must be held when calling this function.
2281 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_nf_refcount_disable_free() local
2284 lockdep_assert_held(&nf->lock); in ssam_nf_refcount_disable_free()
2332 struct ssam_nf *nf; in ssam_notifier_register() local
2338 nf = &ctrl->cplt.event.notif; in ssam_notifier_register()
2339 nf_head = &nf->head[ssh_rqid_to_event(rqid)]; in ssam_notifier_register()
2341 mutex_lock(&nf->lock); in ssam_notifier_register()
2344 entry = ssam_nf_refcount_inc(nf, n->event.reg, n->event.id); in ssam_notifier_register()
2346 mutex_unlock(&nf->lock); in ssam_notifier_register()
2354 ssam_nf_refcount_dec_free(nf, n->event.reg, n->event.id); in ssam_notifier_register()
2356 mutex_unlock(&nf->lock); in ssam_notifier_register()
2364 ssam_nf_refcount_dec_free(nf, n->event.reg, n->event.id); in ssam_notifier_register()
2365 mutex_unlock(&nf->lock); in ssam_notifier_register()
2371 mutex_unlock(&nf->lock); in ssam_notifier_register()
2401 struct ssam_nf *nf; in __ssam_notifier_unregister() local
2407 nf = &ctrl->cplt.event.notif; in __ssam_notifier_unregister()
2408 nf_head = &nf->head[ssh_rqid_to_event(rqid)]; in __ssam_notifier_unregister()
2410 mutex_lock(&nf->lock); in __ssam_notifier_unregister()
2413 mutex_unlock(&nf->lock); in __ssam_notifier_unregister()
2422 entry = ssam_nf_refcount_dec(nf, n->event.reg, n->event.id); in __ssam_notifier_unregister()
2439 mutex_unlock(&nf->lock); in __ssam_notifier_unregister()
2472 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_controller_event_enable() local
2479 mutex_lock(&nf->lock); in ssam_controller_event_enable()
2481 entry = ssam_nf_refcount_inc(nf, reg, id); in ssam_controller_event_enable()
2483 mutex_unlock(&nf->lock); in ssam_controller_event_enable()
2489 ssam_nf_refcount_dec_free(nf, reg, id); in ssam_controller_event_enable()
2490 mutex_unlock(&nf->lock); in ssam_controller_event_enable()
2494 mutex_unlock(&nf->lock); in ssam_controller_event_enable()
2523 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_controller_event_disable() local
2530 mutex_lock(&nf->lock); in ssam_controller_event_disable()
2532 entry = ssam_nf_refcount_dec(nf, reg, id); in ssam_controller_event_disable()
2534 mutex_unlock(&nf->lock); in ssam_controller_event_disable()
2540 mutex_unlock(&nf->lock); in ssam_controller_event_disable()
2568 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_notifier_disable_registered() local
2572 mutex_lock(&nf->lock); in ssam_notifier_disable_registered()
2573 for (n = rb_first(&nf->refcount); n; n = rb_next(n)) { in ssam_notifier_disable_registered()
2582 mutex_unlock(&nf->lock); in ssam_notifier_disable_registered()
2593 mutex_unlock(&nf->lock); in ssam_notifier_disable_registered()
2613 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_notifier_restore_registered() local
2616 mutex_lock(&nf->lock); in ssam_notifier_restore_registered()
2617 for (n = rb_first(&nf->refcount); n; n = rb_next(n)) { in ssam_notifier_restore_registered()
2625 mutex_unlock(&nf->lock); in ssam_notifier_restore_registered()
2637 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_notifier_is_empty() local
2640 mutex_lock(&nf->lock); in ssam_notifier_is_empty()
2641 result = ssam_nf_refcount_empty(nf); in ssam_notifier_is_empty()
2642 mutex_unlock(&nf->lock); in ssam_notifier_is_empty()
2658 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_notifier_unregister_all() local
2661 mutex_lock(&nf->lock); in ssam_notifier_unregister_all()
2662 rbtree_postorder_for_each_entry_safe(e, n, &nf->refcount, node) { in ssam_notifier_unregister_all()
2667 nf->refcount = RB_ROOT; in ssam_notifier_unregister_all()
2668 mutex_unlock(&nf->lock); in ssam_notifier_unregister_all()