From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: Rob Herring <robh@kernel.org>,
Saravana Kannan <saravanak@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 5/5] regulator: fan53555: Use of_property_read_u32_default() for DT parsing
Date: Mon, 19 Jan 2026 10:02:58 +0800 [thread overview]
Message-ID: <20260119-add_dt_default-v1-5-db4787ea7a9e@nxp.com> (raw)
In-Reply-To: <20260119-add_dt_default-v1-0-db4787ea7a9e@nxp.com>
From: Peng Fan <peng.fan@nxp.com>
Simplify DT parsing of the optional "fcs,suspend-voltage-selector"
property by using of_property_read_u32_default().
If the property is not specified, default to FAN53555_VSEL_ID_0,
which matches the existing behaviour where the field was zeroed
by devm_kzalloc().
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/regulator/fan53555.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
index c282236959b1803e3cba8f4b9cc15e458f6e8436..2e2b5822fc9ed0399056326d838661cb4752f767 100644
--- a/drivers/regulator/fan53555.c
+++ b/drivers/regulator/fan53555.c
@@ -624,8 +624,6 @@ static struct fan53555_platform_data *fan53555_parse_dt(struct device *dev,
const struct regulator_desc *desc)
{
struct fan53555_platform_data *pdata;
- int ret;
- u32 tmp;
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
@@ -633,10 +631,8 @@ static struct fan53555_platform_data *fan53555_parse_dt(struct device *dev,
pdata->regulator = of_get_regulator_init_data(dev, np, desc);
- ret = of_property_read_u32(np, "fcs,suspend-voltage-selector",
- &tmp);
- if (!ret)
- pdata->sleep_vsel_id = tmp;
+ pdata->sleep_vsel_id = of_property_read_u32_default(np, "fcs,suspend-voltage-selector",
+ FAN53555_VSEL_ID_0);
return pdata;
}
--
2.37.1
prev parent reply other threads:[~2026-01-19 2:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-19 2:02 [PATCH 0/5] of: Introduce *_read_*_default helpers and convert regulator drivers Peng Fan (OSS)
2026-01-19 2:02 ` [PATCH 1/5] of: Add of_property_read_[u32,s32]_default Peng Fan (OSS)
2026-01-20 22:21 ` Rob Herring
2026-01-23 6:58 ` Peng Fan
2026-01-19 2:02 ` [PATCH 2/5] regulator: of: Use of_property_read_u32_default() Peng Fan (OSS)
2026-01-19 2:02 ` [PATCH 3/5] regulator: adp5055: use of_property_read_[u32|s32]_default() Peng Fan (OSS)
2026-01-19 2:02 ` [PATCH 4/5] regulator: max77620: Use of_property_read_u32_default() for DT parsing Peng Fan (OSS)
2026-01-19 2:02 ` Peng Fan (OSS) [this message]
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=20260119-add_dt_default-v1-5-db4787ea7a9e@nxp.com \
--to=peng.fan@oss.nxp.com \
--cc=alexisczezar.torreno@analog.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=robh@kernel.org \
--cc=saravanak@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®