usb: gadget: f_ipc: Re-initialize completion on every read/write

When the driver is waiting for the completion of a queued
read/write request and some system interrupt is triggered, then
the request is dequeued and the core gadget driver calls the
request completion handler as a part of dequeue which increments
the completion's 'done' count to 1.
Next, when a new request is queued, its completion is immediately
done because the wait_for_completion bails out if 'done' count is
non-zero while the request is still queued with the hardware. So
the transfer fails with EALREADY error.
Fix this by re-initializing the completion before new read/write
request is queued. This assigns 0 value to 'done' field of the
completion and normal functionality resumes.

Change-Id: If51a1e4784c69377d296127356b17f8fbf0bc81e
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
1 file changed