diff mbox series

[1/3] iio: adc: rockchip_saradc: Use of_device_get_match_data to simplify code

Message ID 20211019100013.27312-2-tangbin@cmss.chinamobile.com (mailing list archive)
State Changes Requested
Headers show
Series iio: Use of_device_get_match_data to clean code | expand

Commit Message

Tang Bin Oct. 19, 2021, 10 a.m. UTC
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@cmss.chinamobile.com>
---
 drivers/iio/adc/rockchip_saradc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index f3eb8d2e5..e221e7aaa 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -304,7 +304,6 @@  static int rockchip_saradc_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	struct iio_dev *indio_dev = NULL;
 	struct resource	*mem;
-	const struct of_device_id *match;
 	int ret;
 	int irq;
 
@@ -318,14 +317,12 @@  static int rockchip_saradc_probe(struct platform_device *pdev)
 	}
 	info = iio_priv(indio_dev);
 
-	match = of_match_device(rockchip_saradc_match, &pdev->dev);
-	if (!match) {
+	info->data = of_device_get_match_data(&pdev->dev);
+	if (!info->data) {
 		dev_err(&pdev->dev, "failed to match device\n");
 		return -ENODEV;
 	}
 
-	info->data = match->data;
-
 	/* Sanity check for possible later IP variants with more channels */
 	if (info->data->num_channels > SARADC_MAX_CHANNELS) {
 		dev_err(&pdev->dev, "max channels exceeded");