summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2025-02-13 14:45:04 +0300
committerWolfram Sang <wsa+renesas@sang-engineering.com>2025-02-13 18:47:21 +0300
commitc6250d0eab82da7af78e8d010360c91f33cbc242 (patch)
treec1e35ca708128a6afec1ba4b8faf8e193a3bc621
parenta64dcfb451e254085a7daee5fe51bf22959d52d3 (diff)
downloadlinux-c6250d0eab82da7af78e8d010360c91f33cbc242.tar.xz
power: ip5xxx_power: Make use of i2c_get_match_data()
Get matching data in one step by switching to use i2c_get_match_data(). Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-rw-r--r--drivers/power/supply/ip5xxx_power.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/power/supply/ip5xxx_power.c b/drivers/power/supply/ip5xxx_power.c
index c448e0ac0dfa..a293b2765771 100644
--- a/drivers/power/supply/ip5xxx_power.c
+++ b/drivers/power/supply/ip5xxx_power.c
@@ -828,10 +828,9 @@ static void ip5xxx_setup_regs(struct device *dev, struct ip5xxx *ip5xxx,
static int ip5xxx_power_probe(struct i2c_client *client)
{
- const struct ip5xxx_regfield_config *fields = &ip51xx_fields;
+ const struct ip5xxx_regfield_config *fields;
struct power_supply_config psy_cfg = {};
struct device *dev = &client->dev;
- const struct of_device_id *of_id;
struct power_supply *psy;
struct ip5xxx *ip5xxx;
@@ -843,9 +842,7 @@ static int ip5xxx_power_probe(struct i2c_client *client)
if (IS_ERR(ip5xxx->regmap))
return PTR_ERR(ip5xxx->regmap);
- of_id = i2c_of_match_device(dev->driver->of_match_table, client);
- if (of_id)
- fields = (const struct ip5xxx_regfield_config *)of_id->data;
+ fields = i2c_get_match_data(client) ?: &ip51xx_fields;
ip5xxx_setup_regs(dev, ip5xxx, fields);
psy_cfg.of_node = dev->of_node;