Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

regulator: fan53555: Simplify probe()

Simplify probe() by replacing of_device_get_match_data() and ID lookup for
retrieving match data by i2c_get_match_data().

While at it, use dev_fwnode() API instead of 'client->dev.of_node'.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230828164746.102992-1-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Biju Das and committed by
Mark Brown
364a399b 0bb80ecc

+2 -7
+2 -7
drivers/regulator/fan53555.c
··· 659 659 660 660 static int fan53555_regulator_probe(struct i2c_client *client) 661 661 { 662 - const struct i2c_device_id *id = i2c_client_get_device_id(client); 663 662 struct device_node *np = client->dev.of_node; 664 663 struct fan53555_device_info *di; 665 664 struct fan53555_platform_data *pdata; ··· 681 682 "Platform data not found!\n"); 682 683 683 684 di->regulator = pdata->regulator; 684 - if (client->dev.of_node) { 685 - di->vendor = 686 - (unsigned long)of_device_get_match_data(&client->dev); 687 - } else { 685 + di->vendor = (uintptr_t)i2c_get_match_data(client); 686 + if (!dev_fwnode(&client->dev)) { 688 687 /* if no ramp constraint set, get the pdata ramp_delay */ 689 688 if (!di->regulator->constraints.ramp_delay) { 690 689 if (pdata->slew_rate >= ARRAY_SIZE(slew_rates)) ··· 692 695 di->regulator->constraints.ramp_delay 693 696 = slew_rates[pdata->slew_rate]; 694 697 } 695 - 696 - di->vendor = id->driver_data; 697 698 } 698 699 699 700 regmap = devm_regmap_init_i2c(client, &fan53555_regmap_config);