From: Peng Fan <peng.fan@linux.dev>
To: Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Johan Hovold <johan@kernel.org>
Cc: linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 0/3] regmap: 2nd clean up and improve __regmap_init()
Date: Sat, 21 Nov 2026 20:44:18 +0800 [thread overview]
Message-ID: <20261121-regmap-improve-2nd-v1-0-6b5fd59451ed@nxp.com> (raw)
This is a re-post of patch 8-10 from [1] with addressing Mark's comments
to patch 8 [2]
[1] https://lore.kernel.org/all/20261113-regmap-improve-v2-0-5dfd6a89078f@nxp.com/
[2] https://lore.kernel.org/all/179510759875.116416.1025341724543668395.b4-review@b4/
This series removes the per-device regmap_bus copies used by the I2C and
SPI helpers to override max_raw_read and max_raw_write, converts the
__regmap_init() error unwinding to the scope-based cleanup API, and adds
KUnit coverage for the new init_limits callback.
The first patch replaces regmap_bus::free_on_exit with an optional
init_limits() callback. It is invoked after the bus raw I/O limits have
been copied and before the cache is initialized. The ordering matters
for maps with raw register defaults: regcache_hw_init() reads them back
from the device during initialization and chunks that transfer using
max_raw_read. Following review feedback, the callback takes the bus
context, the config and pointers to the limits instead of struct regmap,
which is private to drivers/base/regmap, so bus implementations outside
the regmap core can use it.
The second patch converts the __regmap_init() error unwinding to the
cleanup API. A dedicated release helper unwinds a partially initialized
map in the same order as the old labels. map->cache_type is now assigned
just before regcache_init() and reset if it fails, which makes
regcache_exit() safe to call from the cleanup path at any point.
The third patch adds a KUnit test that lowers the raw I/O limits from the
init_limits callback and relies on raw register defaults. The test
verifies that the cache readback is split according to the limits and
that the callback runs before regcache_init().
No functional changes.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Peng Fan (3):
regmap: drop regmap_bus::free_on_exit
regmap: use cleanup API in __regmap_init()
regmap: kunit: add test for regmap_bus::init_limits
drivers/base/regmap/regmap-i2c.c | 85 ++++++++++++++++++-----------------
drivers/base/regmap/regmap-kunit.c | 91 ++++++++++++++++++++++++++++++++++++++
drivers/base/regmap/regmap-spi.c | 66 +++++++++++----------------
drivers/base/regmap/regmap.c | 77 ++++++++++++++++----------------
include/linux/regmap.h | 10 ++++-
5 files changed, 207 insertions(+), 122 deletions(-)
---
base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726
change-id: 20261121-regmap-improve-2nd-376762e4d823
Best regards,
--
Peng Fan <peng.fan@nxp.com>
next reply other threads:[~2026-11-21 12:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 12:44 Peng Fan [this message]
2026-11-21 12:44 ` [PATCH 1/3] regmap: drop regmap_bus::free_on_exit Peng Fan
2026-11-21 12:44 ` [PATCH 2/3] regmap: use cleanup API in __regmap_init() Peng Fan
2026-11-21 12:44 ` [PATCH 3/3] regmap: kunit: add test for regmap_bus::init_limits Peng Fan
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=20261121-regmap-improve-2nd-v1-0-6b5fd59451ed@nxp.com \
--to=peng.fan@linux.dev \
--cc=broonie@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=rafael@kernel.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
all inboxes | Powered by JetHome®