All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Matti Vaittinen <mazziesaccount@gmail.com>,
	Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: Matti Vaittinen <mazziesaccount@gmail.com>,
	Lee Jones <lee@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] mfd: bd718x7: Use regmap_reg_range()
Date: Mon, 27 Oct 2025 14:12:06 +0200	[thread overview]
Message-ID: <aP9hlpRO-0vmEHBZ@mva-rohm> (raw)

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

Initializing the regmap_ranges using direct assignment to the range_min
and range_max members is a slightly verbose. In general we can make it a
tad cleaner when using the regmap_reg_range() macro.

The rohm-bd718x7.c is doing this open-coded initialization. It's not
really bad as there is only one range defined, but it is still worth
converting it to use the regmap_reg_range() so no-one uses it as a bad
example.

Additionally, the regmap_access_table expects a pointer to an array of
ranges. This is a tad more obvious when we use an array with single
range, instead of claiming a pointer to a range struct being a single
element array.

Use regmap_reg_range() when initializing the regmap_range structure and
use a real one-element array instead of a pointer to a struct.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
---
 drivers/mfd/rohm-bd718x7.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/rohm-bd718x7.c b/drivers/mfd/rohm-bd718x7.c
index 25e494a93d48..ff714fd4f54d 100644
--- a/drivers/mfd/rohm-bd718x7.c
+++ b/drivers/mfd/rohm-bd718x7.c
@@ -72,14 +72,13 @@ static const struct regmap_irq_chip bd718xx_irq_chip = {
 	.init_ack_masked = true,
 };
 
-static const struct regmap_range pmic_status_range = {
-	.range_min = BD718XX_REG_IRQ,
-	.range_max = BD718XX_REG_POW_STATE,
+static const struct regmap_range pmic_status_range[] = {
+	regmap_reg_range(BD718XX_REG_IRQ, BD718XX_REG_POW_STATE),
 };
 
 static const struct regmap_access_table volatile_regs = {
-	.yes_ranges = &pmic_status_range,
-	.n_yes_ranges = 1,
+	.yes_ranges = &pmic_status_range[0],
+	.n_yes_ranges = ARRAY_SIZE(pmic_status_range),
 };
 
 static const struct regmap_config bd718xx_regmap_config = {
-- 
2.51.0


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

             reply	other threads:[~2025-10-27 12:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 12:12 Matti Vaittinen [this message]
2025-11-06 16:02 ` (subset) [PATCH] mfd: bd718x7: Use regmap_reg_range() 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=aP9hlpRO-0vmEHBZ@mva-rohm \
    --to=mazziesaccount@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.