First we declare our Tasklet using DECLARE_TASKLET(name, function, data):
void do_tasklet(unsigned long);As you see name is the name of our Tasklet, function is the function that will called to treat the tasklet, data is what we bill passed to this function (unsigned long).
DECLARE_TASKLET(my_tasklet, do_tasklet, 0);
Now to schedule our Tasklet we do:
tasklet_schedule(&my_tasklet);
If we want to use Workqueue:
#include <linux/workqueue.h>
static struct work_struct my_wq;
INIT_WORK(&my_wq, (void (*)(void *)) do_tasklet, NULL);
...
schedule_work(&my_wq);
No comments:
Post a Comment