Skip to content

Commit 8cb631c

Browse files
larsclausenjic23
authored andcommitted
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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 8f73a13 commit 8cb631c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+0
-58
lines changed

drivers/iio/accel/ssp_accel_sensor.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ static int ssp_accel_probe(struct platform_device *pdev)
108108
spd->type = SSP_ACCELEROMETER_SENSOR;
109109

110110
indio_dev->name = ssp_accel_device_name;
111-
indio_dev->dev.of_node = pdev->dev.of_node;
112111
indio_dev->info = &ssp_accel_iio_info;
113112
indio_dev->modes = INDIO_BUFFER_SOFTWARE;
114113
indio_dev->channels = ssp_acc_channels;

drivers/iio/adc/ab8500-gpadc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,6 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
11631163

11641164
pm_runtime_put(dev);
11651165

1166-
indio_dev->dev.of_node = np;
11671166
indio_dev->name = "ab8500-gpadc";
11681167
indio_dev->modes = INDIO_DIRECT_MODE;
11691168
indio_dev->info = &ab8500_gpadc_info;

drivers/iio/adc/ad7266.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@ static int ad7266_probe(struct spi_device *spi)
437437
spi_set_drvdata(spi, indio_dev);
438438
st->spi = spi;
439439

440-
indio_dev->dev.of_node = spi->dev.of_node;
441440
indio_dev->name = spi_get_device_id(spi)->name;
442441
indio_dev->modes = INDIO_DIRECT_MODE;
443442
indio_dev->info = &ad7266_info;

drivers/iio/adc/ad7291.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,6 @@ static int ad7291_probe(struct i2c_client *client,
502502
indio_dev->channels = ad7291_channels;
503503
indio_dev->num_channels = ARRAY_SIZE(ad7291_channels);
504504

505-
indio_dev->dev.of_node = client->dev.of_node;
506505
indio_dev->info = &ad7291_info;
507506
indio_dev->modes = INDIO_DIRECT_MODE;
508507

drivers/iio/adc/ad7298.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ static int ad7298_probe(struct spi_device *spi)
312312
st->spi = spi;
313313

314314
indio_dev->name = spi_get_device_id(spi)->name;
315-
indio_dev->dev.of_node = spi->dev.of_node;
316315
indio_dev->modes = INDIO_DIRECT_MODE;
317316
indio_dev->channels = ad7298_channels;
318317
indio_dev->num_channels = ARRAY_SIZE(ad7298_channels);

drivers/iio/adc/ad7476.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ static int ad7476_probe(struct spi_device *spi)
300300

301301
st->spi = spi;
302302

303-
indio_dev->dev.of_node = spi->dev.of_node;
304303
indio_dev->name = spi_get_device_id(spi)->name;
305304
indio_dev->modes = INDIO_DIRECT_MODE;
306305
indio_dev->channels = st->chip_info->channel;

drivers/iio/adc/ad7791.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ static int ad7791_probe(struct spi_device *spi)
425425

426426
spi_set_drvdata(spi, indio_dev);
427427

428-
indio_dev->dev.of_node = spi->dev.of_node;
429428
indio_dev->name = spi_get_device_id(spi)->name;
430429
indio_dev->modes = INDIO_DIRECT_MODE;
431430
indio_dev->channels = st->info->channels;

drivers/iio/adc/ad7793.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,6 @@ static int ad7793_probe(struct spi_device *spi)
818818

819819
spi_set_drvdata(spi, indio_dev);
820820

821-
indio_dev->dev.of_node = spi->dev.of_node;
822821
indio_dev->name = spi_get_device_id(spi)->name;
823822
indio_dev->modes = INDIO_DIRECT_MODE;
824823
indio_dev->channels = st->chip_info->channels;

drivers/iio/adc/ad7887.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ static int ad7887_probe(struct spi_device *spi)
264264
spi_set_drvdata(spi, indio_dev);
265265
st->spi = spi;
266266

267-
indio_dev->dev.of_node = spi->dev.of_node;
268267
indio_dev->name = spi_get_device_id(spi)->name;
269268
indio_dev->info = &ad7887_info;
270269
indio_dev->modes = INDIO_DIRECT_MODE;

drivers/iio/adc/ad7923.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ static int ad7923_probe(struct spi_device *spi)
315315
info = &ad7923_chip_info[spi_get_device_id(spi)->driver_data];
316316

317317
indio_dev->name = spi_get_device_id(spi)->name;
318-
indio_dev->dev.of_node = spi->dev.of_node;
319318
indio_dev->modes = INDIO_DIRECT_MODE;
320319
indio_dev->channels = info->channels;
321320
indio_dev->num_channels = info->num_channels;

0 commit comments

Comments
 (0)