From: Lee Jones <lee@kernel.org>
To: Ming Yu <a0282524688@gmail.com>
Cc: Ming Yu <tmyu0@nuvoton.com>, Andi Shyti <andi.shyti@kernel.org>,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH v6 6/7] mfd: nct6694: Introduce regmap-based transport abstraction
Date: Wed, 12 Aug 2026 13:12:30 +0100 [thread overview]
Message-ID: <20260812121230.GP1072730@google.com> (raw)
In-Reply-To: <CAOoeyxXgqfts9ytFEYLe=jCpBkPaPwrzwTBQX3oTsTME90CEBw@mail.gmail.com>
On Mon, 10 Aug 2026, Ming Yu wrote:
> Hi Lee,
>
> Thank you for your reviewing.
>
> Lee Jones <lee@kernel.org> 於 2026年7月9日週四 下午5:28寫道:
> >
> ...
> > > +/*
> > > + * A few firmware commands (e.g. the I2C "deliver") transmit a request and
> > > + * read the reply back in a single transaction. Model this as a regmap read of
> > > + * a SET register: @buf carries the request on entry and holds the reply on
> > > + * return, so the firmware exchange stays a single message as before.
> > > + */
> > > +static inline int nct6694_write_read_msg(struct nct6694 *nct6694,
> > > + const struct nct6694_cmd_header *cmd_hd,
> > > + void *buf)
> > > +{
> > > + return regmap_bulk_read(nct6694->regmap,
> > > + nct6694_cmd_to_reg(cmd_hd, NCT6694_HCTRL_SET),
> > > + buf, le16_to_cpu(cmd_hd->len));
> > > +}
> >
> > [Severity: Medium]
> > Are we misusing the regmap API by passing an input payload through
> > regmap_bulk_read() in nct6694_write_read_msg()?
> >
> > The driver handles command exchanges by modeling them as a regmap_bulk_read()
> > of a SET register, passing the request payload inside the buf parameter.
> > However, the regmap API strictly defines this as an output buffer.
> >
> > This currently works because regmap bypasses bounce buffers and cache for this
> > specific configuration. Any future changes in the regmap subsystem, such as
> > initializing output buffers, enabling a regmap cache, or adding bounce buffers
> > for DMA alignment, will silently discard the outgoing request payload.
> >
>
> On the write_read finding: it's safe as-is (REGCACHE_NONE, val_bits 8,
> so val_buf passes straight to bus->read), but I agree the read
> semantics are bent for this one request/response command.
>
> Would you prefer I keep nct6694_write_read_msg() and document the
> in/out contract, plus a note that this regmap must never enable
> caching, so everything stays behind regmap as you asked in v5?
>
> Or would you rather I add a thin transport helper just for the
> "deliver" command? That reintroduces the ops-style you pushed back on
> in v5, so I didn't want to go that way without checking first.
Please don't re-introduce the driver-level "transport layer".
Yes, if you fully understand it, document it. If you know of a better
way to handle it that is within the bounds of Regmap, then please do
that.
--
Lee Jones
next prev parent reply other threads:[~2026-08-12 12:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 3:50 [PATCH v6 0/7] mfd: nct6694: Refactor transport layer and add HIF (eSPI) support a0282524688
2026-07-01 3:50 ` [PATCH v6 1/7] mfd: nct6694: Move module type macros to shared header a0282524688
2026-07-01 3:50 ` [PATCH v6 2/7] mfd: nct6694: Refactor USB-specific data into nct6694_usb_data a0282524688
2026-07-01 3:50 ` [PATCH v6 3/7] mfd: nct6694: Rename USB transport functions with _usb_ prefix a0282524688
2026-07-01 3:50 ` [PATCH v6 4/7] mfd: nct6694: Rename driver to nct6694-usb and update Kconfig a0282524688
2026-07-01 3:50 ` [PATCH v6 5/7] mfd: nct6694: Extract core device management into a separate module a0282524688
2026-07-01 3:50 ` [PATCH v6 6/7] mfd: nct6694: Introduce regmap-based transport abstraction a0282524688
2026-07-09 9:27 ` Lee Jones
2026-08-10 5:23 ` Ming Yu
2026-08-12 12:12 ` Lee Jones [this message]
2026-07-01 3:50 ` [PATCH v6 7/7] mfd: nct6694: Add Host Interface (HIF) eSPI transport driver a0282524688
2026-07-02 19:08 ` Julian Braha
2026-07-09 9:27 ` Lee Jones
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=20260812121230.GP1072730@google.com \
--to=lee@kernel.org \
--cc=a0282524688@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tmyu0@nuvoton.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).