@@ -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");
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(-)