296
297
298
299
300
301static int uwbd(void *unused)
302{
303 unsigned long flags;
304 struct list_head list = LIST_HEAD_INIT(list);
305 struct uwb_event *evt, *nxt;
306 int should_stop = 0;
307 while (1) {
308 wait_event_interruptible_timeout(
309 uwbd_wq,
310 !list_empty(&uwbd_event_list)
311 || (should_stop = kthread_should_stop()),
312 HZ);
313 if (should_stop)
314 break;
315 try_to_freeze();
316
317 mutex_lock(&uwbd_event_mutex);
318 spin_lock_irqsave(&uwbd_event_list_lock, flags);
319 list_splice_init(&uwbd_event_list, &list);
320 spin_unlock_irqrestore(&uwbd_event_list_lock, flags);
321 list_for_each_entry_safe(evt, nxt, &list, list_node) {
322 list_del(&evt->list_node);
323 uwbd_event_handle(evt);
324 kfree(evt);
325 }
326 mutex_unlock(&uwbd_event_mutex);
327
328 uwb_beca_purge();
329 }
330 return 0;
331}
332
333
334
335void uwbd_start(void)
336{