Skip to content

Commit

Permalink
regulator: fan53555: Use of_device_get_match_data() to simplify probe
Browse files Browse the repository at this point in the history
if fan53555_regulator_probe() is called and the "client->dev.of_node"
isn't NULL, it means OF registered a device with a valid compatible
string, so match cannot be NULL.

Use of_device_get_match_data() to retrieve the drvdata pointer.  No
functional change intended.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Jisheng Zhang authored and Mark Brown committed Jul 20, 2017
1 parent 5771a8c commit d110e3e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions drivers/regulator/fan53555.c
Original file line number Diff line number Diff line change
@@ -407,14 +407,8 @@ static int fan53555_regulator_probe(struct i2c_client *client,

di->regulator = pdata->regulator;
if (client->dev.of_node) {
const struct of_device_id *match;

match = of_match_device(of_match_ptr(fan53555_dt_ids),
&client->dev);
if (!match)
return -ENODEV;

di->vendor = (unsigned long) match->data;
di->vendor =
(unsigned long)of_device_get_match_data(&client->dev);
} else {
/* if no ramp constraint set, get the pdata ramp_delay */
if (!di->regulator->constraints.ramp_delay) {

0 comments on commit d110e3e

Please sign in to comment.