I try to programm a Event-Workqueue, but I meet some problems.
I use a Linux 2.6.36 Kernel. And the DECLARE_WORK function changed from 3 parameters to 2.
The question is, the old declaration was
DECLARE_WORK (struct work_struct name, void (*func)(void *), void *data);
And the new one is
DECLARE_WORK (struct work_struct name, void (*func)(void *));
I think the void *data pointer was to give the func parameters. Is that right?
And how can I do that with the new version of DECLARE_WORK?
Thanks for the help
Peter
DECLARE_WORKis primarily for static work items, where no instance data is needed. You wantINIT_WORK. Use this to initialize awork_structthat is a member of another structure (of your choosing), then usecontainer_ofin the callback to get the pointer to the containing structure. Thiscontainer_ofpattern is extremely common in the Linux kernel, so it’s a good idea to get familiar with it!You can see an example of this with
wl1271_netstack_work– take a look at the initialization point and the callback.