Skip to content

Commit 46537a8

Browse files
robherringbroonie
authored andcommitted
regulator: da9121: Use i2c_get_match_data()
Use preferred i2c_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent a8b4962 commit 46537a8

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

drivers/regulator/da9121-regulator.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//
1414
// Copyright (C) 2020 Dialog Semiconductor
1515

16-
#include <linux/of_device.h>
16+
#include <linux/of.h>
1717
#include <linux/of_gpio.h>
1818
#include <linux/gpio/consumer.h>
1919
#include <linux/regulator/of_regulator.h>
@@ -1117,17 +1117,6 @@ static const struct of_device_id da9121_dt_ids[] = {
11171117
};
11181118
MODULE_DEVICE_TABLE(of, da9121_dt_ids);
11191119

1120-
static inline int da9121_of_get_id(struct device *dev)
1121-
{
1122-
const struct of_device_id *id = of_match_device(da9121_dt_ids, dev);
1123-
1124-
if (!id) {
1125-
dev_err(dev, "%s: Failed\n", __func__);
1126-
return -EINVAL;
1127-
}
1128-
return (uintptr_t)id->data;
1129-
}
1130-
11311120
static int da9121_i2c_probe(struct i2c_client *i2c)
11321121
{
11331122
struct da9121 *chip;
@@ -1141,7 +1130,7 @@ static int da9121_i2c_probe(struct i2c_client *i2c)
11411130
}
11421131

11431132
chip->pdata = i2c->dev.platform_data;
1144-
chip->subvariant_id = da9121_of_get_id(&i2c->dev);
1133+
chip->subvariant_id = (enum da9121_subvariant)i2c_get_match_data(i2c);
11451134

11461135
ret = da9121_assign_chip_model(i2c, chip);
11471136
if (ret < 0)

0 commit comments

Comments
 (0)