diff options
author | Vladimir Oltean <olteanv@gmail.com> | 2019-12-27 03:24:44 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-12-27 22:58:09 +0000 |
commit | f971a2074447726ec9a3feee3648a2e157f08248 (patch) | |
tree | 2954c9d66f9360ce81f6da1b02f33cf9f3cf5ce9 | |
parent | f03ee2042b2dc46e3452e87324d90f147de4a944 (diff) |
spi: Catch improper use of PTP system timestamping API
We can catch whether the SPI controller has declared it can take care of
software timestamping transfers, but didn't. So do it.
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://lore.kernel.org/r/20191227012444.1204-1-olteanv@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 5e4c4532f7f3..5485ef89197c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1680,6 +1680,13 @@ void spi_finalize_current_message(struct spi_controller *ctlr) } } + if (unlikely(ctlr->ptp_sts_supported)) { + list_for_each_entry(xfer, &mesg->transfers, transfer_list) { + WARN_ON_ONCE(xfer->ptp_sts && !xfer->timestamped_pre); + WARN_ON_ONCE(xfer->ptp_sts && !xfer->timestamped_post); + } + } + spi_unmap_msg(ctlr, mesg); if (ctlr->cur_msg_prepared && ctlr->unprepare_message) { |