spi: spi-mem: add spi_mem_dtr_supports_op()
authorPratyush Yadav <p.yadav@ti.com>
Fri, 25 Jun 2021 19:17:06 +0000 (00:47 +0530)
committerJagan Teki <jagan@amarulasolutions.com>
Mon, 28 Jun 2021 06:26:06 +0000 (11:56 +0530)
commit5752d6ae8daacbd2678cbf9a96627dd9c83f215c
treea91f07905ab81cdb786a4450bdf827c12aaf6209
parent2299076e34f8cd5682b1fe20bcc0395f2466bcc6
spi: spi-mem: add spi_mem_dtr_supports_op()

spi_mem_default_supports_op() rejects DTR ops by default to ensure that
the controller drivers that haven't been updated with DTR support
continue to reject them. It also makes sure that controllers that don't
support DTR mode at all (which is most of them at the moment) also
reject them.

This means that controller drivers that want to support DTR mode can't
use spi_mem_default_supports_op(). Driver authors have to roll their own
supports_op() function and mimic the buswidth checks. Or even worse,
driver authors might skip it completely or get it wrong.

Add spi_mem_dtr_supports_op(). It provides a basic sanity check for DTR
ops and performs the buswidth requirement check. Move the logic for
checking buswidth in spi_mem_default_supports_op() to a separate
function so the logic is not repeated twice.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
drivers/spi/spi-mem.c
include/spi-mem.h