[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20260119-add_dt_default-v1-5-db4787ea7a9e@nxp.com>
Date: Mon, 19 Jan 2026 10:02:58 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Alexis Czezar Torreno <alexisczezar.torreno@...log.com>
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Peng Fan <peng.fan@....com>
Subject: [PATCH 5/5] regulator: fan53555: Use
of_property_read_u32_default() for DT parsing
From: Peng Fan <peng.fan@....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@....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
Powered by blists - more mailing lists