[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20211019100013.27312-3-tangbin@cmss.chinamobile.com>
Date: Tue, 19 Oct 2021 18:00:12 +0800
From: Tang Bin <tangbin@...s.chinamobile.com>
To: jic23@...nel.org, lars@...afoo.de, heiko@...ech.de
Cc: linux-iio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org, linux-kernel@...r.kernel.org,
Tang Bin <tangbin@...s.chinamobile.com>
Subject: [PATCH 2/3] iio: adc: max9611: Use of_device_get_match_data to simplify code
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@...s.chinamobile.com>
---
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
Powered by blists - more mailing lists