[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211019100013.27312-4-tangbin@cmss.chinamobile.com>
Date: Tue, 19 Oct 2021 18:00:13 +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 3/3] iio: adc: twl6030-gpadc: 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/twl6030-gpadc.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
index c6416ad79..0859f3f7d 100644
--- a/drivers/iio/adc/twl6030-gpadc.c
+++ b/drivers/iio/adc/twl6030-gpadc.c
@@ -867,17 +867,14 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct twl6030_gpadc_data *gpadc;
const struct twl6030_gpadc_platform_data *pdata;
- const struct of_device_id *match;
struct iio_dev *indio_dev;
int irq;
int ret;
- match = of_match_device(of_twl6030_match_tbl, dev);
- if (!match)
+ pdata = of_device_get_match_data(dev);
+ if (!pdata)
return -EINVAL;
- pdata = match->data;
-
indio_dev = devm_iio_device_alloc(dev, sizeof(*gpadc));
if (!indio_dev)
return -ENOMEM;
--
2.20.1.windows.1
Powered by blists - more mailing lists