greybus: operation: add support for short responses
commit7e43e337a524eb5ceab2cda9bbf882c35074bcc2
authorJohan Hovold <johan@hovoldconsulting.com>
Thu, 25 Feb 2016 13:40:24 +0000 (25 14:40 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 26 Feb 2016 00:26:58 +0000 (25 16:26 -0800)
tree48eb5541f488eec96ce4481d95ffd5dc0180afd7
parent34804efb0c25d189bd9aa6e495a3bf5d778a0299
greybus: operation: add support for short responses

Add support for operations with short responses.

So far we have assumed that the initiator of an operation always knows
the exact size of the expected response. This is however not always the
case and we've worked around this limitation in a couple of places by,
for example, first requesting the size of a resource before fetching the
actual data.

To avoid such workarounds and simplify our protocols, add a
short-response flag that can be set when allocating an operation. When
this flag is set on an operation, core will accept a response that is
shorter than the size of the (pre-allocated) response payload buffer.

For now, we update the response-message payload_size field to reflect
the actual length of the response received.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/operation.c
drivers/staging/greybus/operation.h