Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3481 → Rev 3482

/drivers/video/drm/i915/kms_display.c
836,119 → 836,15
 
 
 
void __stdcall run_workqueue(struct workqueue_struct *cwq)
{
unsigned long irqflags;
 
// dbgprintf("wq: %x head %x, next %x\n",
// cwq, &cwq->worklist, 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);
 
spin_unlock_irqrestore(&cwq->lock, irqflags);
f(work);
spin_lock_irqsave(&cwq->lock, irqflags);
}
 
spin_unlock_irqrestore(&cwq->lock, irqflags);
}
 
 
static inline
int __queue_work(struct workqueue_struct *wq,
struct work_struct *work)
{
unsigned long flags;
 
// dbgprintf("wq: %x, work: %x\n",
// wq, work );
 
if(!list_empty(&work->entry))
return 0;
 
spin_lock_irqsave(&wq->lock, flags);
 
if(list_empty(&wq->worklist))
TimerHs(0,0, run_workqueue, wq);
 
list_add_tail(&work->entry, &wq->worklist);
 
spin_unlock_irqrestore(&wq->lock, flags);
// dbgprintf("wq: %x head %x, next %x\n",
// wq, &wq->worklist, wq->worklist.next);
 
return 1;
};
 
bool queue_work(struct workqueue_struct *wq, struct work_struct *work)
{
return __queue_work(wq, work);
}
 
 
void __stdcall delayed_work_timer_fn(unsigned long __data)
{
struct delayed_work *dwork = (struct delayed_work *)__data;
struct workqueue_struct *wq = dwork->work.data;
 
// dbgprintf("wq: %x, work: %x\n",
// wq, &dwork->work );
 
__queue_work(wq, &dwork->work);
}
 
 
int queue_delayed_work_on(struct workqueue_struct *wq,
struct delayed_work *dwork, unsigned long delay)
{
struct work_struct *work = &dwork->work;
 
work->data = wq;
TimerHs(0,0, delayed_work_timer_fn, dwork);
return 1;
}
 
int queue_delayed_work(struct workqueue_struct *wq,
struct delayed_work *dwork, unsigned long delay)
{
u32 flags;
 
// dbgprintf("wq: %x, work: %x\n",
// wq, &dwork->work );
 
if (delay == 0)
return __queue_work(wq, &dwork->work);
 
return queue_delayed_work_on(wq, dwork, delay);
}
 
 
struct workqueue_struct *alloc_workqueue(const char *fmt,
unsigned int flags,
int max_active)
{
struct workqueue_struct *wq;
 
wq = kzalloc(sizeof(*wq),0);
if (!wq)
goto err;
 
INIT_LIST_HEAD(&wq->worklist);
 
return wq;
err:
return NULL;
}
 
#define NSEC_PER_SEC 1000000000L
 
void getrawmonotonic(struct timespec *ts)
1028,7 → 924,21
return 1;
}
 
unsigned int hweight16(unsigned int w)
{
unsigned int res = w - ((w >> 1) & 0x5555);
res = (res & 0x3333) + ((res >> 2) & 0x3333);
res = (res + (res >> 4)) & 0x0F0F;
return (res + (res >> 8)) & 0x00FF;
}
 
 
unsigned long round_jiffies_up_relative(unsigned long j)
{
unsigned long j0 = GetTimerTicks();
 
/* Use j0 because jiffies might change while we run */
return round_jiffies_common(j + j0, true) - j0;
}