public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Guodong Xu <guodong@riscstar.com>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Yixun Lan <dlan@kernel.org>,
	Alex Elder <elder@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	linux-spi@vger.kernel.org, devicetree@vger.kernel.org,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org, Alex Elder <elder@riscstar.com>
Subject: Re: [PATCH v9 2/3] spi: spacemit: introduce SpacemiT K1 SPI controller driver
Date: Tue, 28 Apr 2026 09:17:35 +0900	[thread overview]
Message-ID: <ae_8n0I_ORDLib1y@sirena.co.uk> (raw)
In-Reply-To: <20260427-spi-spacemit-k1-v9-2-ff753b551302@riscstar.com>

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

On Mon, Apr 27, 2026 at 10:01:28PM -0400, Guodong Xu wrote:

> +static int k1_spi_transfer_one(struct spi_controller *host,
> +			       struct spi_device *spi,
> +			       struct spi_transfer *transfer)
> +{

> +	/* Record how many words the len bytes represent */
> +	count = transfer->len / drv_data->bytes;
> +	drv_data->rx_resid = count;
> +	drv_data->tx_resid = count;

This is setting up _resid with a number of words.

> +static void k1_spi_write_word(struct k1_spi_driver_data *drv_data)
> +{
> +	struct spi_transfer *transfer = drv_data->transfer;
> +	u32 bytes = drv_data->bytes;
> +	u32 val;
> +
> +	if (transfer->tx_buf) {
> +		const void *buf;
> +
> +		buf = transfer->tx_buf + (transfer->len - drv_data->tx_resid);

This is using _resid as a byte count.  It'll be fine for 8 bits per word
(which is by far the most common thing).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2026-04-28  0:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28  2:01 [PATCH v9 0/3] spi: support the SpacemiT K1 SPI controller Guodong Xu
2026-04-28  2:01 ` [PATCH v9 1/3] spi: dt-bindings: add SpacemiT K1 SPI support Guodong Xu
2026-04-28  2:01 ` [PATCH v9 2/3] spi: spacemit: introduce SpacemiT K1 SPI controller driver Guodong Xu
2026-04-28  0:17   ` Mark Brown [this message]
2026-04-28  2:01 ` [PATCH v9 3/3] riscv: dts: spacemit: define a SPI controller node Guodong Xu

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=ae_8n0I_ORDLib1y@sirena.co.uk \
    --to=broonie@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@kernel.org \
    --cc=elder@kernel.org \
    --cc=elder@riscstar.com \
    --cc=guodong@riscstar.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    /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