From: Vladimir Oltean Date: Fri, 27 Dec 2019 01:24:44 +0000 (+0200) Subject: spi: Catch improper use of PTP system timestamping API X-Git-Tag: v5.6-rc1~194^2^2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f971a2074447726ec9a3feee3648a2e157f08248;p=thirdparty%2Flinux.git 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 Link: https://lore.kernel.org/r/20191227012444.1204-1-olteanv@gmail.com Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 5e4c4532f7f32..5485ef89197cf 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) {