-/* $OpenBSD: irq_work.h,v 1.7 2022/01/17 12:42:30 jsg Exp $ */
+/* $OpenBSD: irq_work.h,v 1.8 2022/01/19 05:36:54 jsg Exp $ */
/*
* Copyright (c) 2015 Mark Kettenis
*
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/timeout.h>
-#include <machine/cpu.h> /* for CPU_BUSY_CYCLE() */
+#include <sys/task.h>
+
+struct workqueue_struct;
+
+extern struct workqueue_struct *system_wq;
struct irq_work {
- struct timeout to;
+ struct task task;
+ struct taskq *tq;
};
typedef void (*irq_work_func_t)(struct irq_work *);
static inline void
init_irq_work(struct irq_work *work, irq_work_func_t func)
{
- /* process context as intel gen 9 sleeps in irq work */
- timeout_set_proc(&work->to, (void (*)(void *))func, work);
+ work->tq = (struct taskq *)system_wq;
+ task_set(&work->task, (void (*)(void *))func, work);
}
static inline bool
irq_work_queue(struct irq_work *work)
{
- return timeout_add(&work->to, 1);
+ return task_add(work->tq, &work->task);
}
static inline void
irq_work_sync(struct irq_work *work)
{
- timeout_del_barrier(&work->to);
+ taskq_barrier(work->tq);
}
#endif