]> www.infradead.org Git - users/jedix/linux-maple.git/commit
fpga: microchip-spi: rewrite status polling in a time measurable way
authorIvan Bornyakov <i.bornyakov@metrotek.ru>
Fri, 30 Dec 2022 09:29:21 +0000 (12:29 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:34 +0000 (09:33 +0100)
commitc169890b5f7b2e47a472d30ba7004168c187bb71
tree25acb10bc3297de276afb7d2c916f2eb8c9889d3
parente9ed12b8c7f7a9c587a0243a29d89d2674e85e0e
fpga: microchip-spi: rewrite status polling in a time measurable way

[ Upstream commit 88e705697e801299a13ecaf2ba54599964fe711c ]

Original busy loop with retries count in mpf_poll_status() is not too
reliable, as it takes different times on different systems. Replace it
with read_poll_timeout() macro.

While at it, fix polling stop condition to met function's original
intention declared in the comment. The issue with original polling stop
condition is that it stops if any of mask bits is set, while intention
was to stop if all mask bits is set. This was not noticible because only
MPF_STATUS_READY is passed as mask argument and it is BIT(1).

Fixes: 5f8d4a900830 ("fpga: microchip-spi: add Microchip MPF FPGA manager")
Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20221230092922.18822-3-i.bornyakov@metrotek.ru
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/fpga/microchip-spi.c