Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: rockchip_saradc: Use of_device_get_match_data

Use of_device_get_match_data() to simplify the code.

Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20230603185340.13838-5-shreeya.patel@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Shreeya Patel and committed by
Jonathan Cameron
47902344 97ad10bb

+4 -4
+4 -4
drivers/iio/adc/rockchip_saradc.c
··· 415 415 416 416 static int rockchip_saradc_probe(struct platform_device *pdev) 417 417 { 418 + const struct rockchip_saradc_data *match_data; 418 419 struct rockchip_saradc *info = NULL; 419 420 struct device_node *np = pdev->dev.of_node; 420 421 struct iio_dev *indio_dev = NULL; 421 - const struct of_device_id *match; 422 422 int ret; 423 423 int irq; 424 424 ··· 432 432 } 433 433 info = iio_priv(indio_dev); 434 434 435 - match = of_match_device(rockchip_saradc_match, &pdev->dev); 436 - if (!match) { 435 + match_data = of_device_get_match_data(&pdev->dev); 436 + if (!match_data) { 437 437 dev_err(&pdev->dev, "failed to match device\n"); 438 438 return -ENODEV; 439 439 } 440 440 441 - info->data = match->data; 441 + info->data = match_data; 442 442 443 443 /* Sanity check for possible later IP variants with more channels */ 444 444 if (info->data->num_channels > SARADC_MAX_CHANNELS) {