On Mon, Dec 14, 2020 at 01:58:51PM +0800, Qing Zhang wrote: > +static int ls7a_spi_do_transfer(struct ls7a_spi *ls7a_spi, > + struct spi_device *spi, > + struct spi_transfer *t) This does a lot of configuration, as far as I can see only the clock rate can actually vary per transfer though? The mode configuration looks like it should be moved to prepare instead, the divider settings can be done with a read/modify/write. It's also not clear to me why spcr and sper are being stored in the driver data, we never read the values outside of this function. > +static int ls7a_spi_transfer_one(struct spi_master *master, > + struct spi_device *spi, > + struct spi_transfer *t) > +{ > + struct ls7a_spi *ls7a_spi; > + int status; > + > + ls7a_spi = spi_master_get_devdata(master); > + > + status = ls7a_spi_do_transfer(ls7a_spi, spi, t); > + if (status < 0) > + return status; > + > + ls7a_spi_write_read(spi, t); This is kind of confusing - _do_transfer() doesn't actually do the transfer so far as I can see, write_read() does the transfer? Probably both functions should be renamed, or even just inlined here - it's really configuring the clocks and transferring the data. Otherwise this looks good.
Attachment:
signature.asc
Description: PGP signature