Commit 364a399b authored by Biju Das's avatar Biju Das Committed by Mark Brown

regulator: fan53555: Simplify probe()

Simplify probe() by replacing of_device_get_match_data() and ID lookup for
retrieving match data by i2c_get_match_data().

While at it, use dev_fwnode() API instead of 'client->dev.of_node'.
Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230828164746.102992-1-biju.das.jz@bp.renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0bb80ecc
...@@ -659,7 +659,6 @@ MODULE_DEVICE_TABLE(of, fan53555_dt_ids); ...@@ -659,7 +659,6 @@ MODULE_DEVICE_TABLE(of, fan53555_dt_ids);
static int fan53555_regulator_probe(struct i2c_client *client) static int fan53555_regulator_probe(struct i2c_client *client)
{ {
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct device_node *np = client->dev.of_node; struct device_node *np = client->dev.of_node;
struct fan53555_device_info *di; struct fan53555_device_info *di;
struct fan53555_platform_data *pdata; struct fan53555_platform_data *pdata;
...@@ -682,10 +681,8 @@ static int fan53555_regulator_probe(struct i2c_client *client) ...@@ -682,10 +681,8 @@ static int fan53555_regulator_probe(struct i2c_client *client)
"Platform data not found!\n"); "Platform data not found!\n");
di->regulator = pdata->regulator; di->regulator = pdata->regulator;
if (client->dev.of_node) { di->vendor = (uintptr_t)i2c_get_match_data(client);
di->vendor = if (!dev_fwnode(&client->dev)) {
(unsigned long)of_device_get_match_data(&client->dev);
} else {
/* if no ramp constraint set, get the pdata ramp_delay */ /* if no ramp constraint set, get the pdata ramp_delay */
if (!di->regulator->constraints.ramp_delay) { if (!di->regulator->constraints.ramp_delay) {
if (pdata->slew_rate >= ARRAY_SIZE(slew_rates)) if (pdata->slew_rate >= ARRAY_SIZE(slew_rates))
...@@ -695,8 +692,6 @@ static int fan53555_regulator_probe(struct i2c_client *client) ...@@ -695,8 +692,6 @@ static int fan53555_regulator_probe(struct i2c_client *client)
di->regulator->constraints.ramp_delay di->regulator->constraints.ramp_delay
= slew_rates[pdata->slew_rate]; = slew_rates[pdata->slew_rate];
} }
di->vendor = id->driver_data;
} }
regmap = devm_regmap_init_i2c(client, &fan53555_regmap_config); regmap = devm_regmap_init_i2c(client, &fan53555_regmap_config);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment