* How to set work_struct data
@ 2011-04-21 10:22 Pankaj B
2011-04-21 11:26 ` Haojian Zhuang
0 siblings, 1 reply; 3+ messages in thread
From: Pankaj B @ 2011-04-21 10:22 UTC (permalink / raw)
To: kernelnewbies
Hi,
Current INIT_WORK() macro takes just work_struct pointer and function
pointer.
In previous kernels there used to be a third parameter for data.
Is there a proper way to set data in work_struct?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110421/23ea6b3b/attachment.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* How to set work_struct data
2011-04-21 10:22 How to set work_struct data Pankaj B
@ 2011-04-21 11:26 ` Haojian Zhuang
2011-04-21 11:47 ` Pankaj B
0 siblings, 1 reply; 3+ messages in thread
From: Haojian Zhuang @ 2011-04-21 11:26 UTC (permalink / raw)
To: kernelnewbies
On Thu, Apr 21, 2011 at 6:22 PM, Pankaj B <xpankajbx@gmail.com> wrote:
> Hi,
> Current INIT_WORK() macro takes just work_struct pointer and function
> pointer.
> In previous kernels there used to be a third parameter for data.
> Is there a proper way to set data in work_struct?
>
Embed the work_struct into your structure. Then use container_of() to get the
structure in work function. So you can add anything into your structure.
> Thanks
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* How to set work_struct data
2011-04-21 11:26 ` Haojian Zhuang
@ 2011-04-21 11:47 ` Pankaj B
0 siblings, 0 replies; 3+ messages in thread
From: Pankaj B @ 2011-04-21 11:47 UTC (permalink / raw)
To: kernelnewbies
On Thu, Apr 21, 2011 at 4:56 PM, Haojian Zhuang <haojian.zhuang@gmail.com>wrote:
> On Thu, Apr 21, 2011 at 6:22 PM, Pankaj B <xpankajbx@gmail.com> wrote:
> > Hi,
> > Current INIT_WORK() macro takes just work_struct pointer and function
> > pointer.
> > In previous kernels there used to be a third parameter for data.
> > Is there a proper way to set data in work_struct?
> >
> Embed the work_struct into your structure. Then use container_of() to get
> the
> structure in work function. So you can add anything into your structure.
>
Good solution! Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110421/17a6deb4/attachment.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-21 11:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-21 10:22 How to set work_struct data Pankaj B
2011-04-21 11:26 ` Haojian Zhuang
2011-04-21 11:47 ` Pankaj B
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).