]> git.baikalelectronics.ru Git - kernel.git/commit
soundwire: cadence: Drain the RX FIFO after an IO timeout
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Fri, 2 Dec 2022 16:18:12 +0000 (16:18 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 12:55:40 +0000 (13:55 +0100)
commitcc8d0aa823540b63427f033afbae82b959598f82
tree1beb958e330a54260765ef4226f292b0ea66d265
parent83310372b982f88f84f90490c1f5bb47b3519237
soundwire: cadence: Drain the RX FIFO after an IO timeout

[ Upstream commit 2ef49b1598721ac3fb081d161bb4e7f1ea707b8e ]

If wait_for_completion_timeout() times-out in _cdns_xfer_msg() it
is possible that something could have been written to the RX FIFO.
In this case, we should drain the RX FIFO so that anything in it
doesn't carry over and mess up the next transfer.

Obviously, if we got to this state something went wrong, and we
don't really know the state of everything. The cleanup in this
situation cannot be bullet-proof but we should attempt to avoid
breaking future transaction, if only to reduce the amount of
error noise when debugging the failure from a kernel log.

Note that this patch only implements the draining for blocking
(non-deferred) transfers. The deferred API doesn't have any proper
handling of error conditions and would need some re-design before
implementing cleanup. That is a task for a separate patch...

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20221202161812.4186897-4-rf@opensource.cirrus.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soundwire/cadence_master.c