diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2020-06-13 15:17:15 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2020-06-14 16:20:08 +0300 |
commit | 8cb631ccbb1952b6422917f2ed16f760d84a762e (patch) | |
tree | 9c011a2d3a44612c997f7b52e66547e35f359356 /drivers/iio/adc/sun4i-gpadc-iio.c | |
parent | 8f73a13f74571941c2ad6d04c65b52d39cbdf90b (diff) | |
download | linux-8cb631ccbb1952b6422917f2ed16f760d84a762e.tar.xz |
iio: Remove superfluous of_node assignments
If a driver does not assign an of_node to a IIO device to IIO core will
automatically assign the of_node of the parent device. This automatic
assignment is done in the iio_device_register() function.
There is a fair amount of drivers that currently manually assign the
of_node of the IIO device. All but 4 of them can make use of the automatic
assignment though.
The exceptions are:
* mxs-lradc-adc: Which uses the of_node of the parent of the parent.
* stm32-dfsdm-adc, stm32-adc and stm32-dac: Which reference the of_node
assigned to the IIO device before iio_device_register() is called.
All other drivers are updated to use automatic assignment. This reduces
the amount of boilerplate code involved in setting up the IIO device.
The patch has mostly been auto-generated with the following semantic patch
// <smpl>
@exists@
expression indio_dev;
expression parent;
@@
indio_dev = \(devm_iio_device_alloc\|iio_device_alloc\)(&parent, ...)
...
-indio_dev->dev.of_node = parent.of_node;
@exists@
expression indio_dev;
expression parent;
@@
indio_dev = \(devm_iio_device_alloc\|iio_device_alloc\)(parent, ...)
...
-indio_dev->dev.of_node = parent->of_node;
// </smpl>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@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.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index 06b02f5b1721..99b43f28e879 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -619,7 +619,6 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) info->indio_dev = indio_dev; init_completion(&info->completion); indio_dev->name = dev_name(&pdev->dev); - indio_dev->dev.of_node = pdev->dev.of_node; indio_dev->info = &sun4i_gpadc_iio_info; indio_dev->modes = INDIO_DIRECT_MODE; |