ddk: v3.10

git-svn-id: svn://kolibrios.org@3763 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge)
2013-07-05 07:41:18 +00:00
parent 8a0dae3f14
commit a3e5776171
7 changed files with 308 additions and 27 deletions

View File

@@ -2,6 +2,8 @@
#include <linux/workqueue.h>
#include <ddk.h>
extern int driver_wq_state;
struct workqueue_struct *alloc_workqueue(const char *fmt,
unsigned int flags,
int max_active)
@@ -29,29 +31,28 @@ void run_workqueue(struct workqueue_struct *cwq)
// dbgprintf("wq: %x head %x, next %x\n",
// cwq, &cwq->worklist, cwq->worklist.next);
repeat:
spin_lock_irqsave(&cwq->lock, irqflags);
while (!list_empty(&cwq->worklist))
while(driver_wq_state != 0)
{
struct work_struct *work = list_entry(cwq->worklist.next,
spin_lock_irqsave(&cwq->lock, irqflags);
while (!list_empty(&cwq->worklist))
{
struct work_struct *work = list_entry(cwq->worklist.next,
struct work_struct, entry);
work_func_t f = work->func;
list_del_init(cwq->worklist.next);
// dbgprintf("head %x, next %x\n",
// &cwq->worklist, cwq->worklist.next);
work_func_t f = work->func;
list_del_init(cwq->worklist.next);
// printf("work %p, func %p\n",
// work, f);
spin_unlock_irqrestore(&cwq->lock, irqflags);
f(work);
spin_lock_irqsave(&cwq->lock, irqflags);
}
spin_unlock_irqrestore(&cwq->lock, irqflags);
f(work);
spin_lock_irqsave(&cwq->lock, irqflags);
}
spin_unlock_irqrestore(&cwq->lock, irqflags);
delay(1);
goto repeat;
delay(1);
};
}