diff options
author | Lars-Peter Clausen | 2020-06-13 14:17:15 +0200 |
---|---|---|
committer | Jonathan Cameron | 2020-06-14 14:20:08 +0100 |
commit | 8cb631ccbb1952b6422917f2ed16f760d84a762e (patch) | |
tree | 9c011a2d3a44612c997f7b52e66547e35f359356 /drivers/iio/dac | |
parent | 8f73a13f74571941c2ad6d04c65b52d39cbdf90b (diff) |
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/dac')
-rw-r--r-- | drivers/iio/dac/ds4424.c | 1 | ||||
-rw-r--r-- | drivers/iio/dac/ti-dac5571.c | 1 | ||||
-rw-r--r-- | drivers/iio/dac/ti-dac7311.c | 1 | ||||
-rw-r--r-- | drivers/iio/dac/vf610_dac.c | 1 |
4 files changed, 0 insertions, 4 deletions
diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c index 86eec0df1174..79527fbc250a 100644 --- a/drivers/iio/dac/ds4424.c +++ b/drivers/iio/dac/ds4424.c @@ -230,7 +230,6 @@ static int ds4424_probe(struct i2c_client *client, i2c_set_clientdata(client, indio_dev); data->client = client; indio_dev->name = id->name; - indio_dev->dev.of_node = client->dev.of_node; data->vcc_reg = devm_regulator_get(&client->dev, "vcc"); if (IS_ERR(data->vcc_reg)) { diff --git a/drivers/iio/dac/ti-dac5571.c b/drivers/iio/dac/ti-dac5571.c index 502552716e1e..f08c0a859ad4 100644 --- a/drivers/iio/dac/ti-dac5571.c +++ b/drivers/iio/dac/ti-dac5571.c @@ -321,7 +321,6 @@ static int dac5571_probe(struct i2c_client *client, i2c_set_clientdata(client, indio_dev); data->client = client; - indio_dev->dev.of_node = client->dev.of_node; indio_dev->info = &dac5571_info; indio_dev->name = id->name; indio_dev->modes = INDIO_DIRECT_MODE; diff --git a/drivers/iio/dac/ti-dac7311.c b/drivers/iio/dac/ti-dac7311.c index d20cee33daba..a5ff6131009b 100644 --- a/drivers/iio/dac/ti-dac7311.c +++ b/drivers/iio/dac/ti-dac7311.c @@ -251,7 +251,6 @@ static int ti_dac_probe(struct spi_device *spi) spi->bits_per_word = 16; spi_setup(spi); - indio_dev->dev.of_node = spi->dev.of_node; indio_dev->info = &ti_dac_info; indio_dev->name = spi_get_device_id(spi)->name; indio_dev->modes = INDIO_DIRECT_MODE; diff --git a/drivers/iio/dac/vf610_dac.c b/drivers/iio/dac/vf610_dac.c index 3787582d5340..636b4009f763 100644 --- a/drivers/iio/dac/vf610_dac.c +++ b/drivers/iio/dac/vf610_dac.c @@ -199,7 +199,6 @@ static int vf610_dac_probe(struct platform_device *pdev) platform_set_drvdata(pdev, indio_dev); indio_dev->name = dev_name(&pdev->dev); - indio_dev->dev.of_node = pdev->dev.of_node; indio_dev->info = &vf610_dac_iio_info; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = vf610_dac_iio_channels; |