iio: Remove superfluous of_node assignments
authorLars-Peter Clausen <lars@metafoo.de>
Sat, 13 Jun 2020 12:17:15 +0000 (14:17 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 14 Jun 2020 13:20:08 +0000 (14:20 +0100)
commit8cb631ccbb1952b6422917f2ed16f760d84a762e
tree9c011a2d3a44612c997f7b52e66547e35f359356
parent8f73a13f74571941c2ad6d04c65b52d39cbdf90b
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>
57 files changed:
drivers/iio/accel/ssp_accel_sensor.c
drivers/iio/adc/ab8500-gpadc.c
drivers/iio/adc/ad7266.c
drivers/iio/adc/ad7291.c
drivers/iio/adc/ad7298.c
drivers/iio/adc/ad7476.c
drivers/iio/adc/ad7791.c
drivers/iio/adc/ad7793.c
drivers/iio/adc/ad7887.c
drivers/iio/adc/ad7923.c
drivers/iio/adc/ad7949.c
drivers/iio/adc/ad799x.c
drivers/iio/adc/axp20x_adc.c
drivers/iio/adc/bcm_iproc_adc.c
drivers/iio/adc/cpcap-adc.c
drivers/iio/adc/da9150-gpadc.c
drivers/iio/adc/envelope-detector.c
drivers/iio/adc/exynos_adc.c
drivers/iio/adc/hi8435.c
drivers/iio/adc/ina2xx-adc.c
drivers/iio/adc/lp8788_adc.c
drivers/iio/adc/max1027.c
drivers/iio/adc/max11100.c
drivers/iio/adc/max1363.c
drivers/iio/adc/max9611.c
drivers/iio/adc/mcp320x.c
drivers/iio/adc/mcp3422.c
drivers/iio/adc/mcp3911.c
drivers/iio/adc/meson_saradc.c
drivers/iio/adc/nau7802.c
drivers/iio/adc/qcom-pm8xxx-xoadc.c
drivers/iio/adc/qcom-spmi-adc5.c
drivers/iio/adc/qcom-spmi-iadc.c
drivers/iio/adc/qcom-spmi-vadc.c
drivers/iio/adc/rcar-gyroadc.c
drivers/iio/adc/rockchip_saradc.c
drivers/iio/adc/sd_adc_modulator.c
drivers/iio/adc/sun4i-gpadc-iio.c
drivers/iio/adc/ti-adc081c.c
drivers/iio/adc/ti-adc0832.c
drivers/iio/adc/ti-adc084s021.c
drivers/iio/adc/ti-adc128s052.c
drivers/iio/adc/ti-adc161s626.c
drivers/iio/adc/ti-ads1015.c
drivers/iio/adc/ti-ads124s08.c
drivers/iio/adc/ti-ads8344.c
drivers/iio/adc/ti-ads8688.c
drivers/iio/adc/twl4030-madc.c
drivers/iio/adc/vf610_adc.c
drivers/iio/adc/xilinx-xadc-core.c
drivers/iio/dac/ds4424.c
drivers/iio/dac/ti-dac5571.c
drivers/iio/dac/ti-dac7311.c
drivers/iio/dac/vf610_dac.c
drivers/iio/pressure/dlhl60d.c
drivers/iio/temperature/max31856.c
drivers/iio/trigger/stm32-timer-trigger.c