Skip to content

Commit c6250d0

Browse files
andy-shevWolfram Sang
authored andcommitted
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 <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Vladimir Zapolskiy <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent a64dcfb commit c6250d0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/power/supply/ip5xxx_power.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -828,10 +828,9 @@ static void ip5xxx_setup_regs(struct device *dev, struct ip5xxx *ip5xxx,
828828

829829
static int ip5xxx_power_probe(struct i2c_client *client)
830830
{
831-
const struct ip5xxx_regfield_config *fields = &ip51xx_fields;
831+
const struct ip5xxx_regfield_config *fields;
832832
struct power_supply_config psy_cfg = {};
833833
struct device *dev = &client->dev;
834-
const struct of_device_id *of_id;
835834
struct power_supply *psy;
836835
struct ip5xxx *ip5xxx;
837836

@@ -843,9 +842,7 @@ static int ip5xxx_power_probe(struct i2c_client *client)
843842
if (IS_ERR(ip5xxx->regmap))
844843
return PTR_ERR(ip5xxx->regmap);
845844

846-
of_id = i2c_of_match_device(dev->driver->of_match_table, client);
847-
if (of_id)
848-
fields = (const struct ip5xxx_regfield_config *)of_id->data;
845+
fields = i2c_get_match_data(client) ?: &ip51xx_fields;
849846
ip5xxx_setup_regs(dev, ip5xxx, fields);
850847

851848
psy_cfg.of_node = dev->of_node;

0 commit comments

Comments
 (0)