]> git.karo-electronics.de Git - karo-tx-linux.git/commit
greybus: rework synchronous operation completion
authorAlex Elder <elder@linaro.org>
Sat, 22 Nov 2014 01:29:20 +0000 (19:29 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Sat, 22 Nov 2014 03:39:12 +0000 (19:39 -0800)
commit10c69399043351e5c68f07bedd14fe2fdbf32cb4
tree976cdfda3115f49bbbf60fb849d0ff75b86c50a4
parent2cf72a233a5d29bee380e89d325cde422a0c6bac
greybus: rework synchronous operation completion

The only time we need a completion signaled on a request is when the
request provided no callback function.  In that case, we wait for
a completion on behalf of the caller.

If an interrupt occurs, we attempt to cancel the message that's
been sent, but we don't actually complete the operation as required.

Instead of simply waiting for the completion, put in place a
special callback function for the synchronous operation.  The
only job the callback has is to signal completion, allowing the
waiter to know it's done.

This means gb_operation_complete() will always have a non-null
callback pointer, so it becomes a simple wrapper, and we can get rid
of it and invoke the callback directly, in gb_operation_work().

Be defensive by checking for a null callback pointer, and reset
it to NULL once it's been called.

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