From: andy.shevchenko@gmail.com
To: Martin Kurbanov <mmkurbanov@sberdevices.ru>
Cc: Mark Brown <broonie@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
linux-spi@vger.kernel.org, linux-amlogic@lists.infradead.org,
linux-kernel@vger.kernel.org, kernel@sberdevices.ru
Subject: Re: [PATCH v1 1/2] spi: amlogic-spifc-a1: implement adjust_op_size()
Date: Wed, 5 Jul 2023 13:17:21 +0300 [thread overview]
Message-ID: <ZKVDMV95gZN4oQjx@surfacebook> (raw)
In-Reply-To: <20230703094518.53755-2-mmkurbanov@sberdevices.ru>
Mon, Jul 03, 2023 at 12:45:17PM +0300, Martin Kurbanov kirjoitti:
> This enhancement eliminates the need for a loop in the
> amlogic_spifc_a1_exec_op() function and allows the SPI core to
> dynamically divide transactions into appropriately sized chunks.
...
> + if (!data_size) {
Why not positive check?
> + ret = amlogic_spifc_a1_request(spifc, false);
> + } else {
> + u32 mode = ilog2(op->data.buswidth);
>
> writel(0, spifc->base + SPIFC_A1_USER_DBUF_ADDR_REG);
>
> if (op->data.dir == SPI_MEM_DATA_IN)
> - ret = amlogic_spifc_a1_read(spifc,
> - op->data.buf.in + off,
> - block_size, dmode);
> + ret = amlogic_spifc_a1_read(spifc, op->data.buf.in,
> + data_size, mode);
> else
> - ret = amlogic_spifc_a1_write(spifc,
> - op->data.buf.out + off,
> - block_size, dmode);
> -
> - nbytes -= block_size;
> - off += block_size;
> - } while (nbytes != 0 && !ret);
> + ret = amlogic_spifc_a1_write(spifc, op->data.buf.out,
> + data_size, mode);
> + }
...
> +static int amlogic_spifc_a1_adjust_op_size(struct spi_mem *mem,
> + struct spi_mem_op *op)
> +{
> + op->data.nbytes = min_t(u32, op->data.nbytes, SPIFC_A1_BUFFER_SIZE);
I would rather use min() for strict type checking.
In this case it will require to have U/u suffix in the SPIFC_A1_BUFFER_SIZE
definition.
> + return 0;
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-07-05 10:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 9:45 [PATCH v1 0/2] spi: amlogic-spifc-a1: fixes and improvements for amlogic-spifc-a1 Martin Kurbanov
2023-07-03 9:45 ` [PATCH v1 1/2] spi: amlogic-spifc-a1: implement adjust_op_size() Martin Kurbanov
2023-07-05 10:17 ` andy.shevchenko [this message]
2023-07-03 9:45 ` [PATCH v1 2/2] spi: amlogic-spifc-a1: add support for max_speed_hz Martin Kurbanov
2023-07-05 10:18 ` andy.shevchenko
2023-07-11 22:04 ` [PATCH v1 0/2] spi: amlogic-spifc-a1: fixes and improvements for amlogic-spifc-a1 Mark Brown
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=ZKVDMV95gZN4oQjx@surfacebook \
--to=andy.shevchenko@gmail.com \
--cc=broonie@kernel.org \
--cc=kernel@sberdevices.ru \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mmkurbanov@sberdevices.ru \
--cc=neil.armstrong@linaro.org \
/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).