Passing info from the top-half ISR to the bottom-half

kernelnewbie@gate.debonne.net
Thu, 24 Oct 2002 18:29:26 -0700 (PDT)


My ISR is split into top-half and bottom-half processing. The bottom-half
is implemented as a tasklet (I'm using Kernel 2.4). The top-half knows
which physical device (minor number) caused the interrupt and that info
has to be passed to the tasklet somehow.

The DECLARE_TASKLET macro provides an unsigned long data argument, but it
appears that that argument must be constant. Rubini's book says it's fine
to pass a pointer via this data argument, and I'd like to pass the pointer
to my device control block, but since the argument must be a constant, the
best I can do is pass a pointer to a global which points to my DCB. But
this won't work because another device's interrupt will overwrite it.

Do I have to make a separate DECLARE_TASKLET for each physical device like
the following:

Declarations:

dev_t g_dev[4];

DECLARE_TASKLET (tasklet0, do_tasklet, (unsigned long) &g_dev[0]);
DECLARE_TASKLET (tasklet1, do_tasklet, (unsigned long) &g_dev[1]);
DECLARE_TASKLET (tasklet2, do_tasklet, (unsigned long) &g_dev[2]);
DECLARE_TASKLET (tasklet3, do_tasklet, (unsigned long) &g_dev[3]);

Top Half:
...
switch (minor) {
case 0:
tasklet_schedule(&tasklet0);
break;
case 1:
tasklet_schedule(&tasklet1);
break;
case 2:
tasklet_schedule(&tasklet2);
break;
case 3:
tasklet_schedule(&tasklet3);
break;
}
...

Tasklet:
dev_t *dev = (dev_t*) arg;
...

That seems kinda kludgy, but it's the only solution I can think of.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/