October 2017
Intermediate to advanced
586 pages
14h 8m
English
Let's just start with a sample:
static DECLARE_WAIT_QUEUE_HEAD(my_wq); /* declare and init the wait queue */
static struct work_struct my_work;
/* some where in the probe function */
/*
* work queue initialization. "work_handler" is the call back that will be
* executed when our work is scheduled.
*/
INIT_WORK(my_work, work_handler);
static irqreturn_t my_interrupt_handler(int irq, void *dev_id)
{
uint32_t val;
struct my_data = dev_id;
val = readl(my_data->reg_base + REG_OFFSET);
if (val == 0xFFCD45EE)) {
my_data->done = true;
wake_up_interruptible(&my_wq);
} else {
schedule_work(&my_work);
}
return IRQ_HANDLED;
};
In the preceding sample, we used either a wait queue or a work queue in order to wake up a possibly ...
Read now
Unlock full access