spi: Make support for regular transfers optional when ->mem_ops != NULL
authorBoris Brezillon <boris.brezillon@bootlin.com>
Thu, 26 Apr 2018 16:18:15 +0000 (18:18 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 11 May 2018 02:33:15 +0000 (11:33 +0900)
commitb5932f5c68e5fbe74fb7a27b4d0faf919e1e1642
treeca5457a85c7597e715a21c9446c4aee24c0a4174
parentc36ff266dc82f4ae797a6f3513c6ffa344f7f1c7
spi: Make support for regular transfers optional when ->mem_ops != NULL

Some SPI/QuadSPI controllers only expose a high-level SPI memory
interface, thus preventing any regular SPI transfers from being done.

In that case, SPI controller drivers can leave all ->transfer_xxx()
hooks empty and only implement the spi_mem_ops interface.

Adjust the core to allow such situations:
- extend spi_controller_check_ops() to accept situations where all
  ->transfer_xxx() pointers are NULL only if ->mem_ops != NULL
- make sure we do not initialize the SPI message queue if
  ctlr->transfer_one and ctlr->transfer_one_message are missing
- return -ENOTSUPP if someone tries to do a regular SPI transfer on
  a controller that does not support it

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@exceet.de>
Tested-by: Frieder Schrempf <frieder.schrempf@exceet.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c