1

spi: Introduce internal spi_xfer_is_dma_mapped() helper

There are few drivers that use the same pattern to check if the transfer
is DMA mapped or not. Provide a helper.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Link: https://lore.kernel.org/r/20240531194723.1761567-2-andriy.shevchenko@linux.intel.com
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Andy Shevchenko 2024-05-31 22:42:33 +03:00 committed by Mark Brown
parent d4ea1d504d
commit 0535cf64e4
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -40,4 +40,12 @@ static inline void spi_unmap_buf(struct spi_controller *ctlr,
} }
#endif /* CONFIG_HAS_DMA */ #endif /* CONFIG_HAS_DMA */
static inline bool spi_xfer_is_dma_mapped(struct spi_controller *ctlr,
struct spi_device *spi,
struct spi_transfer *xfer)
{
return ctlr->can_dma && ctlr->can_dma(ctlr, spi, xfer) &&
ctlr->cur_msg_mapped;
}
#endif /* __LINUX_SPI_INTERNALS_H */ #endif /* __LINUX_SPI_INTERNALS_H */