[PATCH v2 2/3] iio: pressure: bmp280: Use i2c_get_match_data

From: Angel Iglesias
Date: Sun Aug 13 2023 - 15:05:04 EST


Replaces device_get_match_data() and fallback match_id logic by new
unified helper function i2c_get_match_data().

Signed-off-by: Angel Iglesias <ang.iglesiasg@xxxxxxxxx>

diff --git a/drivers/iio/pressure/bmp280-i2c.c b/drivers/iio/pressure/bmp280-i2c.c
index 693eb1975fdc..34e3bc758493 100644
--- a/drivers/iio/pressure/bmp280-i2c.c
+++ b/drivers/iio/pressure/bmp280-i2c.c
@@ -11,9 +11,7 @@ static int bmp280_i2c_probe(struct i2c_client *client)
const struct bmp280_chip_info *chip_info;
struct regmap *regmap;

- chip_info = device_get_match_data(&client->dev);
- if (!chip_info)
- chip_info = (const struct bmp280_chip_info *) id->driver_data;
+ chip_info = i2c_get_match_data(client);

regmap = devm_regmap_init_i2c(client, chip_info->regmap_config);
if (IS_ERR(regmap)) {
--
2.41.0