[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201214174822.GC4880@sirena.org.uk>
Date: Mon, 14 Dec 2020 17:48:22 +0000
From: Mark Brown <broonie@...nel.org>
To: Qing Zhang <zhangqing@...ngson.cn>
Cc: Rob Herring <robh+dt@...nel.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
linux-spi@...r.kernel.org, Huacai Chen <chenhc@...ote.com>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
devicetree@...r.kernel.org, linux-mips@...r.kernel.org,
linux-kernel@...r.kernel.org, Juxin Gao <gaojuxin@...ngson.cn>
Subject: Re: [PATCH v3 1/4] spi: LS7A: Add Loongson LS7A SPI controller
driver support
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.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists