greybus: fix battery_operation()
authorAlex Elder <elder@linaro.org>
Wed, 19 Nov 2014 22:29:14 +0000 (16:29 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Thu, 20 Nov 2014 00:45:29 +0000 (16:45 -0800)
commit0bbfe04cd945df79c52924284b2242508fef4e47
tree13951f9ca64436813f86d8e111032999f93d535c
parent8abf4148030d42825d4f76f4a3cf734dbc2bcd2b
greybus: fix battery_operation()

This patch fixes some problems with the battery protocol driver.

First, when gb_operation_create() is called, it creates buffers of
the requested sizes to hold the operation request and response
messages.  There is therefore no reason to allocate a local response
buffer.  By the time the (synchronous) gb_operation_request_send()
call returns, the operation response buffer will have been filled in.

(In addition, the content of local_response was not being filled
before its contents were used...)

Next, all the message structures are misnamed.  The structures that
are defined are all the content of operation response messages (not
request messages).  So this changes all the types names to properly
reflect their role.

All the local variables using these types are similarly renamed.

I added a new type, gb_generic_battery_response, to be used for
casting the fake_response used in battery_operation().

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