static void xio_work_callback(struct work_struct *work) { struct xio_delayed_work *xdwork; struct xio_ev_data *ev_data; xdwork = container_of(work, struct xio_delayed_work, dwork.work); ev_data = &xdwork->ev_data; /* Add event to event queue */ ev_data->handler = xio_ev_callback; ev_data->data = xdwork; /* tell "poller mechanism" */ xio_context_add_event(xdwork->ctx, ev_data); }
static void __exit xio_lat_cleanup_module(void) { struct xio_ev_data down_event; int state; state = atomic_add_return(0x80, &module_state); if (state & 4) { /* thread is running, loop is still running */ memset(&down_event, 0, sizeof(down_event)); down_event.handler = xio_module_down; down_event.data = NULL; xio_context_add_event(ctx, &down_event); } /* wait fot thread to terminate */ if (state & 2) wait_for_completion(&cleanup_complete); }