Lines Matching refs: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()
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()
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()
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()
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()
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()
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()
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()
2176 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_nf_refcount_enable() local
2179 lockdep_assert_held(&nf->lock); in ssam_nf_refcount_enable()
2230 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_nf_refcount_disable_free() local
2233 lockdep_assert_held(&nf->lock); in ssam_nf_refcount_disable_free()
2280 struct ssam_nf *nf; in ssam_notifier_register() local
2286 nf = &ctrl->cplt.event.notif; in ssam_notifier_register()
2287 nf_head = &nf->head[ssh_rqid_to_event(rqid)]; in ssam_notifier_register()
2289 mutex_lock(&nf->lock); in ssam_notifier_register()
2292 entry = ssam_nf_refcount_inc(nf, n->event.reg, n->event.id); in ssam_notifier_register()
2294 mutex_unlock(&nf->lock); in ssam_notifier_register()
2302 ssam_nf_refcount_dec_free(nf, n->event.reg, n->event.id); in ssam_notifier_register()
2304 mutex_unlock(&nf->lock); in ssam_notifier_register()
2312 ssam_nf_refcount_dec_free(nf, n->event.reg, n->event.id); in ssam_notifier_register()
2313 mutex_unlock(&nf->lock); in ssam_notifier_register()
2319 mutex_unlock(&nf->lock); in ssam_notifier_register()
2343 struct ssam_nf *nf; in ssam_notifier_unregister() local
2349 nf = &ctrl->cplt.event.notif; in ssam_notifier_unregister()
2350 nf_head = &nf->head[ssh_rqid_to_event(rqid)]; in ssam_notifier_unregister()
2352 mutex_lock(&nf->lock); in ssam_notifier_unregister()
2355 mutex_unlock(&nf->lock); in ssam_notifier_unregister()
2364 entry = ssam_nf_refcount_dec(nf, n->event.reg, n->event.id); in ssam_notifier_unregister()
2381 mutex_unlock(&nf->lock); in ssam_notifier_unregister()
2414 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_controller_event_enable() local
2421 mutex_lock(&nf->lock); in ssam_controller_event_enable()
2423 entry = ssam_nf_refcount_inc(nf, reg, id); in ssam_controller_event_enable()
2425 mutex_unlock(&nf->lock); in ssam_controller_event_enable()
2431 ssam_nf_refcount_dec_free(nf, reg, id); in ssam_controller_event_enable()
2432 mutex_unlock(&nf->lock); in ssam_controller_event_enable()
2436 mutex_unlock(&nf->lock); in ssam_controller_event_enable()
2465 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_controller_event_disable() local
2472 mutex_lock(&nf->lock); in ssam_controller_event_disable()
2474 entry = ssam_nf_refcount_dec(nf, reg, id); in ssam_controller_event_disable()
2476 mutex_unlock(&nf->lock); in ssam_controller_event_disable()
2482 mutex_unlock(&nf->lock); in ssam_controller_event_disable()
2510 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_notifier_disable_registered() local
2514 mutex_lock(&nf->lock); in ssam_notifier_disable_registered()
2515 for (n = rb_first(&nf->refcount); n; n = rb_next(n)) { in ssam_notifier_disable_registered()
2524 mutex_unlock(&nf->lock); in ssam_notifier_disable_registered()
2535 mutex_unlock(&nf->lock); in ssam_notifier_disable_registered()
2555 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_notifier_restore_registered() local
2558 mutex_lock(&nf->lock); in ssam_notifier_restore_registered()
2559 for (n = rb_first(&nf->refcount); n; n = rb_next(n)) { in ssam_notifier_restore_registered()
2567 mutex_unlock(&nf->lock); in ssam_notifier_restore_registered()
2579 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_notifier_is_empty() local
2582 mutex_lock(&nf->lock); in ssam_notifier_is_empty()
2583 result = ssam_nf_refcount_empty(nf); in ssam_notifier_is_empty()
2584 mutex_unlock(&nf->lock); in ssam_notifier_is_empty()
2600 struct ssam_nf *nf = &ctrl->cplt.event.notif; in ssam_notifier_unregister_all() local
2603 mutex_lock(&nf->lock); in ssam_notifier_unregister_all()
2604 rbtree_postorder_for_each_entry_safe(e, n, &nf->refcount, node) { in ssam_notifier_unregister_all()
2609 nf->refcount = RB_ROOT; in ssam_notifier_unregister_all()
2610 mutex_unlock(&nf->lock); in ssam_notifier_unregister_all()