Re: How to set work_struct data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Thu, Apr 21, 2011 at 4:56 PM, Haojian Zhuang <haojian.zhuang@xxxxxxxxx> wrote:
On Thu, Apr 21, 2011 at 6:22 PM, Pankaj B <xpankajbx@xxxxxxxxx> 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!



_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux