SPI: API By its features, SPI doesn't properly fit read()/write() You must always read back as many bytes as you wrote You may setup a socket interface For any outcoing packet you receive an incoming one Still, some devices (e.g. flash) work half duplex You can write and avoid reading back the empty reply You can read without filling a write buffer So my choice is using this function as main engine: int spi_xfer(struct spi_dev *dev, enum spi_flags flags, const struct spi_ibuf *ibuf, struct spi_obuf *obuf); This works both for SPI master and SPI slave And either of ibuf and obuf can be NULL