[PATCH 2/3] iio: adc: max9611: Use of_device_get_match_data to simplify code

From: Tang Bin
Date: Tue Oct 19 2021 - 06:10:14 EST


Retrieve OF match data, it's better and cleaner to use
'of_device_get_match_data' over 'of_match_device'.

Signed-off-by: Tang Bin <tangbin@xxxxxxxxxxxxxxxxxxxx>
---
drivers/iio/adc/max9611.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c
index 052ab23f1..4e754c072 100644
--- a/drivers/iio/adc/max9611.c
+++ b/drivers/iio/adc/max9611.c
@@ -514,8 +514,6 @@ static int max9611_probe(struct i2c_client *client,
{
const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
const struct device_node *of_node = client->dev.of_node;
- const struct of_device_id *of_id =
- of_match_device(max9611_of_table, &client->dev);
struct max9611_dev *max9611;
struct iio_dev *indio_dev;
unsigned int of_shunt;
@@ -545,7 +543,7 @@ static int max9611_probe(struct i2c_client *client,
if (ret)
return ret;

- indio_dev->name = of_id->data;
+ indio_dev->name = of_device_get_match_data(&client->dev);
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &indio_info;
indio_dev->channels = max9611_channels;
--
2.20.1.windows.1