Linux work queues are meant to be kernel level threads with process context. I was trying to use it as an alternative to kthread which has no specific process context. But h
By default the work function is called with work struck as parameter. Inside the thread the data element of the structure can easily be obtained. Also a Gnurou, to get access of more data, the work struct can be put inside a implementation specific structure and using the container of macro inside the thread all the data can be accessed.
A simple description about workqueue
worqueue are interrupt handling bottom half mechanishm, where a part of work is given to a kernel thread to execute later with preemtion on an interrupts enable. A percpu thread events/n is created by kernel , threads can also be created by drivers code.A structure is used to identify the thread, an important parameter inside the structure is the name field.It also contains a per cpu structure which in turn contains the waitqueue head on which the thread waits and a link list to add the structure that defines the work i.e. the function and the data .The worker thread gets that structure as the input parameter.The thread runs and wait on the waitqueue for someone to wakeup the thread. A work structure is created defining the function . When an workqueue is schedule, the structure is added to the tail of the link list and the worker thread is woken up. On waking up, the worker thread runs through the link list defined in the per cpu structure and start executing the functions defined with the work structure as parameter. After executing it removes the entry from the link list.