2010-06-12 14:53:38     Work Queue Question

Document created by Aaronwu Employee on Aug 22, 2013
Version 1Show Document
  • View in full screen mode

2010-06-12 14:53:38     Work Queue Question

David Kasper (UNITED STATES)

Message: 90285   

 

I believe the online tutorial (  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:work_queues) is out of date regarding work queues as INIT_WORK() below now requires 2 arguments.  Does anybody know how a pointer can be passed-in using the new scheme.

 

Thanks,

 

David Kasper

 

  #include   <linux/workqueue.h>                          

       struct work_struct work;                               

 

       INIT_WORK(&work, delete_my_item, (void *)item )

       schedule_work(&work);                                  

 

  ...                                                     

 

  void delete_my_item( void * item)              

  {                                                      

       vfree(item);                                         

  }     

 

QuoteReplyEditDelete

 

 

2010-06-12 22:05:56     Re: Work Queue Question

Mike Frysinger (UNITED STATES)

Message: 90286   

 

embed the work struct in a larger structure and then use container_of() to get access to it

 

see drivers/net/irda/bfin_sir.c as an example, or drivers/rtc/rtc-dev.c

QuoteReplyEditDelete

Attachments

    Outcomes