summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/sun4i-gpadc-iio.c
diff options
context:
space:
mode:
authorCorentin Labbe <clabbe.montjoie@gmail.com>2017-10-20 07:37:29 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2017-10-21 18:48:00 +0100
commit0d87a4aa376983a205b3920dc7a9b15d74110be9 (patch)
tree5f16dc8e0249e6f392aca2c9260231eb37930675 /drivers/iio/adc/sun4i-gpadc-iio.c
parent724330a9d61aa61ee20f4895302124490a452629 (diff)
downloadlwn-0d87a4aa376983a205b3920dc7a9b15d74110be9.tar.gz
lwn-0d87a4aa376983a205b3920dc7a9b15d74110be9.zip
iio: adc: sun4i-gpadc: use of_device_get_match_data
The usage of of_device_get_match_data reduce the code size a bit. Furthermore, it prevents an improbable dereference when of_match_device() return NULL. Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/sun4i-gpadc-iio.c')
-rw-r--r--drivers/iio/adc/sun4i-gpadc-iio.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index c4e70f1cad79..04d7147e0110 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -501,17 +501,15 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
struct iio_dev *indio_dev)
{
struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
- const struct of_device_id *of_dev;
struct resource *mem;
void __iomem *base;
int ret;
- of_dev = of_match_device(sun4i_gpadc_of_id, &pdev->dev);
- if (!of_dev)
+ info->data = of_device_get_match_data(&pdev->dev);
+ if (!info->data)
return -ENODEV;
info->no_irq = true;
- info->data = (struct gpadc_data *)of_dev->data;
indio_dev->num_channels = ARRAY_SIZE(sun8i_a33_gpadc_channels);
indio_dev->channels = sun8i_a33_gpadc_channels;