Good idea. I think with
static inline int get_obj_refcount(struct foo *obj)
{
int c;
spin_lock_irq(&obj->lock);
c = obj->refcount;
spin_unlock_irq(&obj->lock);
return c;
}
then
wait_event(&obj->wait, !get_obj_refcount(&obj));
looks like a pretty clean solution.
- R.