Skip to content

Commit a8b4962

Browse files
robherringbroonie
authored andcommitted
regulator: Drop unnecessary of_match_device() calls
If probe is reached, we've already matched the device and in the case of DT matching, the struct device_node pointer will be set. Therefore, there is no need to call of_match_device() in probe. Signed-off-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 1096f9f commit a8b4962

File tree

3 files changed

+2
-30
lines changed

3 files changed

+2
-30
lines changed

drivers/regulator/da9210-regulator.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <linux/irq.h>
1111
#include <linux/regulator/driver.h>
1212
#include <linux/regulator/machine.h>
13-
#include <linux/of_device.h>
13+
#include <linux/of.h>
1414
#include <linux/regulator/of_regulator.h>
1515
#include <linux/regmap.h>
1616

@@ -135,16 +135,6 @@ static int da9210_i2c_probe(struct i2c_client *i2c)
135135
struct regulator_dev *rdev = NULL;
136136
struct regulator_config config = { };
137137
int error;
138-
const struct of_device_id *match;
139-
140-
if (i2c->dev.of_node && !pdata) {
141-
match = of_match_device(of_match_ptr(da9210_dt_ids),
142-
&i2c->dev);
143-
if (!match) {
144-
dev_err(&i2c->dev, "Error: No device match found\n");
145-
return -ENODEV;
146-
}
147-
}
148138

149139
chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL);
150140
if (!chip)

drivers/regulator/max1586.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <linux/regulator/driver.h>
1212
#include <linux/slab.h>
1313
#include <linux/regulator/max1586.h>
14-
#include <linux/of_device.h>
14+
#include <linux/of.h>
1515
#include <linux/regulator/of_regulator.h>
1616

1717
#define MAX1586_V3_MAX_VSEL 31
@@ -213,16 +213,9 @@ static int max1586_pmic_probe(struct i2c_client *client)
213213
struct regulator_config config = { };
214214
struct max1586_data *max1586;
215215
int i, id, ret;
216-
const struct of_device_id *match;
217216

218217
pdata = dev_get_platdata(&client->dev);
219218
if (client->dev.of_node && !pdata) {
220-
match = of_match_device(of_match_ptr(max1586_of_match),
221-
&client->dev);
222-
if (!match) {
223-
dev_err(&client->dev, "Error: No device match found\n");
224-
return -ENODEV;
225-
}
226219
ret = of_get_max1586_platform_data(&client->dev, &pdata_of);
227220
if (ret < 0)
228221
return ret;

drivers/regulator/tps51632-regulator.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/kernel.h>
1717
#include <linux/module.h>
1818
#include <linux/of.h>
19-
#include <linux/of_device.h>
2019
#include <linux/platform_device.h>
2120
#include <linux/regmap.h>
2221
#include <linux/regulator/driver.h>
@@ -255,16 +254,6 @@ static int tps51632_probe(struct i2c_client *client)
255254
int ret;
256255
struct regulator_config config = { };
257256

258-
if (client->dev.of_node) {
259-
const struct of_device_id *match;
260-
match = of_match_device(of_match_ptr(tps51632_of_match),
261-
&client->dev);
262-
if (!match) {
263-
dev_err(&client->dev, "Error: No device match found\n");
264-
return -ENODEV;
265-
}
266-
}
267-
268257
tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
269258
if (!tps)
270259
return -ENOMEM;

0 commit comments

Comments
 (0)