greybus: embed workqueue structure in struct gbuf
authorAlex Elder <elder@linaro.org>
Tue, 23 Sep 2014 17:46:36 +0000 (12:46 -0500)
committerGreg Kroah-Hartman <greg@kroah.com>
Wed, 24 Sep 2014 03:58:00 +0000 (20:58 -0700)
commit2e353685bf0e523505695f8339316b0536474ea4
tree51aca2d5cb4edbcf0d6aef0c1cf9d577f93dbeb3
parent217b870e99ce68b868db08f4257c6f463abddd0c
greybus: embed workqueue structure in struct gbuf

A Greybus buffer containing outbound data is submitted to to the
underlying driver to be sent over a CPort.  Sending that data could
be deferred, so the submit operation completes asynchronously.  When
the send is done, a callback occurs, and the buffer is "completed",
and the buffer's completion routine is called.  The buffer is then
freed.

If data arrives on the CPort, greybus_cport_in_data() is called
to allocate a Greybus buffer and copy the received data into it.
Once that's done the buffer is completed, again allowing the
buffer's completion routine to finish any final tasks before
freeing the buffer.

We use a workqueue to schedule calling the buffer's completion
function.  This patch does two things related to the work queue:
    - Renames the work queue "gbuf_workqueue" so its name more
      directly describes its purpose
    - Moves the work_struct needed for scheduling completions
      into the struct greybuf.  Previously a separate type
      was used, and dynamically allocated *at interrupt time*
      to hold this work_struct.  We can now do away with that.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/gbuf.c
drivers/staging/greybus/greybus.h