spi: Add spi_is_bpw_supported()
Lets client drivers check and potentially handle issues. -----BEGIN PGP SIGNATURE----- iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlywZUgTHGJyb29uaWVA a2VybmVsLm9yZwAKCRAk1otyXVSH0PKpB/4sOGEFYIfSuIUYVIhx72T0kuCIrJoN 9xyS1wj9XQvxoyYeOLTD1jIehHdscVd80PhgWhs3+g1nGr+jrTCqeDB2clCjN/w6 7K1RNHbNscTjyzcuY+B2GNN2ubiILvs+aQAu/qDBWdd+wnHSy17zYbyA3IWXxFdA rT0utFmonKAZaNT8Tn0/QCfcWKq0Q35H7MQ2sMMjICqaoJ9A0OQJnh/5OjQEyFqP F/iRmIBCDfOD7TYcJUcq8cOPTINXTukQiOaZ4zD+TMSS27QxjgKe28Ktj8fMKTeo DKgWXjfHiVBBlJNQkFXl2VFCF7jk7Zd47MnjrXwNJfzHfVt/iSS0dOa+ =9ABs -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlzXjiETHGJyb29uaWVA a2VybmVsLm9yZwAKCRAk1otyXVSH0Gp0B/0WXjExlWObRCn0jLBYlQ8hofBOy54h PA5Du8bUD3uXTiDFH1mTThAfROumSX/eIIKijvoIIppK4hRENibsF8dpBg1QTmCE B7r2EOdXAzn29FSiMzZLY00H2PaRck5EjpDAGqHB6sOgHNtbGVwc2yYzcS5cwKKL 8Dq+5uC1cBEMITHf+B1i375Ltk4OVYgr0GtyzAH6p2yTzf0YntC1pFCMTrcQJvge pvYplTXhydub11sd8gbpdxb+hxkiZd3MXR0NaUhqvExJroo9CQe22Recn0387Pu2 jS3ekzbUVaQ59WHkBxAjX/JDziVCXaDa0wQfOXUa1H40OllLst4n6tBl =tqff -----END PGP SIGNATURE----- Merge tag 'spi-bpw-is-supported' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-5.3 spi: Add spi_is_bpw_supported() Lets client drivers check and potentially handle issues.
This commit is contained in:
commit
e727d4cbc7
|
@ -1005,6 +1005,26 @@ spi_max_transfer_size(struct spi_device *spi)
|
|||
return min(tr_max, msg_max);
|
||||
}
|
||||
|
||||
/**
|
||||
* spi_is_bpw_supported - Check if bits per word is supported
|
||||
* @spi: SPI device
|
||||
* @bpw: Bits per word
|
||||
*
|
||||
* This function checks to see if the SPI controller supports @bpw.
|
||||
*
|
||||
* Returns:
|
||||
* True if @bpw is supported, false otherwise.
|
||||
*/
|
||||
static inline bool spi_is_bpw_supported(struct spi_device *spi, u32 bpw)
|
||||
{
|
||||
u32 bpw_mask = spi->master->bits_per_word_mask;
|
||||
|
||||
if (bpw == 8 || (bpw <= 32 && bpw_mask & SPI_BPW_MASK(bpw)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/* SPI transfer replacement methods which make use of spi_res */
|
||||
|
|
Loading…
Reference in New Issue