/** * blocking_notifier_chain_cond_register - Cond add notifier to a blocking notifier chain * @nh: Pointer to head of the blocking notifier chain * @n: New entry in notifier chain * * Adds a notifier to a blocking notifier chain, only if not already * present in the chain. * Must be called in process context. * * Currently always returns zero. */ int blocking_notifier_chain_cond_register(struct blocking_notifier_head *nh, struct notifier_block *n) { int ret; down_write(&nh->rwsem); ret = notifier_chain_cond_register(&nh->head, n); up_write(&nh->rwsem); return ret; }
int vmm_blocking_notifier_cond_register(struct vmm_blocking_notifier_chain *nc, struct vmm_notifier_block *n) { int ret; vmm_semaphore_down(&nc->rwsem); ret = notifier_chain_cond_register(&nc->head, n); vmm_semaphore_up(&nc->rwsem); return ret; }