linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Qing Zhang <zhangqing@loongson.cn>
Cc: Rob Herring <robh+dt@kernel.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-spi@vger.kernel.org, Huacai Chen <chenhc@lemote.com>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	devicetree@vger.kernel.org, linux-mips@vger.kernel.org,
	linux-kernel@vger.kernel.org, Juxin Gao <gaojuxin@loongson.cn>
Subject: Re: [PATCH v3 1/4] spi: LS7A: Add Loongson LS7A SPI controller driver support
Date: Mon, 14 Dec 2020 17:48:22 +0000	[thread overview]
Message-ID: <20201214174822.GC4880@sirena.org.uk> (raw)
In-Reply-To: <1607925534-8312-1-git-send-email-zhangqing@loongson.cn>

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2020-12-14 17:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14  5:58 [PATCH v3 1/4] spi: LS7A: Add Loongson LS7A SPI controller driver support Qing Zhang
2020-12-14  5:58 ` [PATCH v3 2/4] spi: ls7a: Add YAML schemas Qing Zhang
2020-12-14 14:20   ` Rob Herring
2020-12-14  5:58 ` [PATCH v3 3/4] MIPS: Loongson64: DTS: Add SPI support to LS7A Qing Zhang
2020-12-14  5:58 ` [PATCH v3 4/4] MIPS: Loongson: Enable Loongson LS7A SPI in loongson3_defconfig Qing Zhang
2020-12-14 17:48 ` Mark Brown [this message]
2020-12-14 18:32 ` [PATCH v3 1/4] spi: LS7A: Add Loongson LS7A SPI controller driver support Oleksij Rempel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201214174822.GC4880@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=chenhc@lemote.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gaojuxin@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=zhangqing@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).