INIT_WORK() with two arguments
Hi,
Im trying to write a keyboard interrupt handler... Im using 2.6.35 linux kernel...
Since INIT_WORK does takes only 3 arguments in 2.6.35 kernel, I have my code as follows
irqreturn_t irq_handler(int irq, void *dev_id, struct pt_regs *regs)
{
/*
* This variables are static because they need to be
* accessible (through pointers) to the bottom half routine.
*/
static int initialised = 0;
static unsigned char scancode;
static struct work_struct task;
unsigned char status;
/*
* Read keyboard status
*/
status = inb(0x64);
scancode = inb(0x60);
if (initialised == 0) {
// INIT_WORK(&task, got_char, &scancode);
INIT_WORK(&task, got_char);
initialised = 1;
} else {
// PREPARE_WORK(&task, got_char, &scancode);
PREPARE_WORK(&task, got_char);
}
queue_work(my_workqueue, &task);
return IRQ_HANDLED;
}
The bottom half code is like this
static void got_char(void *scancode)
{
printk(KERN_INFO "Scan Code %x %s.\n",
(int)*((char *)scancode) & 0x7F,
*((char *)scancode) & 0x80 ? "Released" : "Pressed");
}
If INIT_WORK can take only two arguments I wanted to know how to pass the data(scancode) to got_char() function....