I'm writing a char device module in Linux, the char device can be mounted several times. How can I know from within a tasklet, which device caused the interrupt ? The tasklet only recieves a constant data as a parameter.
If you look at the code below, I want a way for the task to reach dev_id.
--------------------
Code:
void wiegand_do_tasklet(unsigned long arg) {...}
DECLARE_TASKLET(wiegand_tasklet_zero, wiegand_do_tasklet,WIEGAND_ZERO);
DECLARE_TASKLET(wiegand_tasklet_one, wiegand_do_tasklet,WIEGAND_ONE);
static irqreturn_t wiegand_interrupt(int irq, void *dev_id)
{
if (atomic_read(&first_time) == 0) // Ignore first interrupt.
{
atomic_inc(&first_time);
return IRQ_NONE;
}
else
{
if (!test_and_change_bit(1,(void *)&irq_mode))
{
if (irq == irq1)
tasklet_schedule(&wiegand_tasklet_zero);
else
tasklet_schedule(&wiegand_tasklet_one);
}
}
return IRQ_HANDLED;
}