linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Pratyush Yadav <p.yadav@ti.com>
Cc: patrice.chotard@foss.st.com,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	linux-mtd@lists.infradead.org,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	linux-spi@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, christophe.kerello@foss.st.com
Subject: Re: [PATCH 1/3] spi: spi-mem: add automatic poll status functions
Date: Mon, 26 Apr 2021 17:51:18 +0100	[thread overview]
Message-ID: <20210426165118.GH4590@sirena.org.uk> (raw)
In-Reply-To: <20210426162610.erpt5ubeddx7paeq@ti.com>

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

On Mon, Apr 26, 2021 at 09:56:12PM +0530, Pratyush Yadav wrote:
> On 26/04/21 04:39PM, patrice.chotard@foss.st.com wrote:

> > + * spi_mem_poll_status() - Poll memory device status
> > + * @mem: SPI memory device
> > + * @op: the memory operation to execute
> > + * @mask: status bitmask to ckeck
> > + * @match: status expected value

> Technically, (status & mask) expected value. Dunno if that is obvious 
> enough to not spell out explicitly.

Is it possible there's some situation where you're waiting for some bits
to clear as well?

> > +		ret = ctlr->mem_ops->poll_status(mem, op, mask, match, timeout);

I'm not sure I like this name since it makes me think the driver is
going to poll when really it's offloaded to the hardware, but I can't
think of any better ideas either and it *is* what the hardware is going
to be doing so meh.

> I wonder if it is better to let spi-mem core take care of the timeout 
> part. On one hand it reduces code duplication on the driver side a 
> little bit. Plus it makes sure drivers don't mess anything up with bad 
> (or no) handling of the timeout. But on the other hand the interface 
> becomes a bit awkward since you'd have to pass a struct completion 
> around, and it isn't something particularly hard to get right either. 
> What do you think?

We already have the core handling other timeouts.  We don't pass around
completions but rather have an API function that the driver has to call
when the operation completes, a similar pattern might work here.  Part
of the thing with those APIs which I'm missing here is that this will
just return -EOPNOTSUPP if the driver can't do the delay in hardware, I
think it would be cleaner if this API were similar and the core dealt
with doing the delay/poll on the CPU.  That way the users don't need to
repeat the handling for the offload/non-offload cases.

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

  reply	other threads:[~2021-04-26 16:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 14:39 [PATCH 0/3] MTD: spinand: Add spi_mem_poll_status() support patrice.chotard
2021-04-26 14:39 ` [PATCH 1/3] spi: spi-mem: add automatic poll status functions patrice.chotard
2021-04-26 16:26   ` Pratyush Yadav
2021-04-26 16:51     ` Mark Brown [this message]
2021-04-26 17:39       ` Pratyush Yadav
2021-04-30 14:22       ` Patrice CHOTARD
2021-04-30 15:56         ` Mark Brown
2021-05-05  7:21           ` Patrice CHOTARD
2021-04-30 14:16     ` Patrice CHOTARD
2021-04-30 16:51   ` Boris Brezillon
2021-05-03  8:47     ` Pratyush Yadav
2021-05-03  9:11       ` Boris Brezillon
2021-05-03  9:29         ` Pratyush Yadav
2021-05-03  9:52           ` Boris Brezillon
2021-05-04  7:46             ` Pratyush Yadav
2021-05-05  7:26             ` Patrice CHOTARD
2021-04-30 16:52   ` Boris Brezillon
2021-04-26 14:39 ` [PATCH 2/3] mtd: spinand: use the spi-mem poll status APIs patrice.chotard
2021-04-26 14:39 ` [PATCH 3/3] spi: stm32-qspi: add automatic poll status feature patrice.chotard
2021-04-30 16:53   ` Boris Brezillon

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=20210426165118.GH4590@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=boris.brezillon@collabora.com \
    --cc=christophe.kerello@foss.st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=p.yadav@ti.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=vigneshr@ti.com \
    /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).