On Wed, Jul 10, 2019 at 2:54 PM Ye Li <[email protected]> wrote: > > When slave drivers don't set the max_read_size, the spi-mem should directly > use data.nbytes and not limit to any size. But current logic will limit to > the max_write_size. > > Signed-off-by: Ye Li <[email protected]> > --- > drivers/spi/spi-mem.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c > index b86eee7..be440fe 100644 > --- a/drivers/spi/spi-mem.c > +++ b/drivers/spi/spi-mem.c > @@ -423,12 +423,14 @@ int spi_mem_adjust_op_size(struct spi_slave *slave, > struct spi_mem_op *op) > if (slave->max_write_size && len > slave->max_write_size) > return -EINVAL; > > - if (op->data.dir == SPI_MEM_DATA_IN && slave->max_read_size) > - op->data.nbytes = min(op->data.nbytes, > + if (op->data.dir == SPI_MEM_DATA_IN) { > + if (slave->max_read_size) > + op->data.nbytes = min(op->data.nbytes, > slave->max_read_size); > - else if (slave->max_write_size) > + } else if (slave->max_write_size) { > op->data.nbytes = min(op->data.nbytes, > slave->max_write_size - len); > + }
Reviewed-by: Jagan Teki <[email protected]> _______________________________________________ U-Boot mailing list [email protected] https://lists.denx.de/listinfo/u-boot

