Find the answer to your Linux question:
Results 1 to 2 of 2
Hi I am making a Linux driver module. I am making my own work queue to submit tasks to. What I want to ask is that when I declare a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2012
    Posts
    1

    Work Queues in Drivers


    Hi
    I am making a Linux driver module. I am making my own work queue to submit tasks to.

    What I want to ask is that when I declare a workqueue_struct as regular a variable it gives the following error:

    Declaration:
    struct kt_dev {
    int id;
    struct cdev chardevice;
    spinlock_t spinl;
    struct workqueue_struct workq;
    };

    error: field workq has incomplete type

    Apparently workqueue_struct is only allowing pointer declaraitons. So the following has no problem:

    struct kt_dev {
    int id;
    struct cdev chardevice;
    spinlock_t spinl;
    struct workqueue_struct *workq;
    };

    Why is this so?
    Thanks
    Trishabh

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,529
    That's because you are not including the header file with the actual struct workqueue_struct definition. The pointer is an opaque value, so it can be set by some other bit of code that does know about the structure and its size, members, etc.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •