Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1692585

[PATCH] regulator: fan53555: Use of_device_get_match_data() to simplify probe

From Jisheng Zhang <jszhang@marvell.com>
Newsgroups linux.kernel
Subject [PATCH] regulator: fan53555: Use of_device_get_match_data() to simplify probe
Date 2017-07-20 10:50 +0200
Message-ID <u5fjJ-4Py-31@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/regulator/fan53555.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
index 60f431831582..6b1c0e4672a2 100644
--- a/drivers/regulator/fan53555.c
+++ b/drivers/regulator/fan53555.c
@@ -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) {
-- 
2.13.3

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] regulator: fan53555: Use of_device_get_match_data() to simplify probe Jisheng Zhang <jszhang@marvell.com> - 2017-07-20 10:50 +0200
  Applied "regulator: fan53555: Use of_device_get_match_data() to simplify probe" to the regulator tree Mark Brown <broonie@kernel.org> - 2017-07-20 14:30 +0200

csiph-web