Skip to content

Commit d3be832

Browse files
commodojic23
authored andcommitted
iio: remove explicit IIO device parent assignment
This patch applies the semantic patch: @@ expression I, P, SP; @@ I = devm_iio_device_alloc(P, SP); ... - I->dev.parent = P; It updates 302 files and does 307 deletions. This semantic patch also removes some comments like '/* Establish that the iio_dev is a child of the i2c device */' But this is is only done in case where the block is left empty. The patch does not seem to cover all cases. It looks like in some cases a different variable is used in some cases to assign the parent, but it points to the same reference. In other cases, the block covered by ... may be just too big to be covered by the semantic patch. However, this looks pretty good as well, as it does cover a big bulk of the drivers that should remove the parent assignment. Signed-off-by: Alexandru Ardelean <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent f5d0179 commit d3be832

File tree

302 files changed

+0
-307
lines changed

Some content is hidden

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

302 files changed

+0
-307
lines changed

drivers/counter/104-quad-8.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,6 @@ static int quad8_probe(struct device *dev, unsigned int id)
15381538
indio_dev->num_channels = ARRAY_SIZE(quad8_channels);
15391539
indio_dev->channels = quad8_channels;
15401540
indio_dev->name = dev_name(dev);
1541-
indio_dev->dev.parent = dev;
15421541

15431542
/* Initialize Counter device and driver data */
15441543
quad8iio = iio_priv(indio_dev);

drivers/counter/stm32-lptimer-cnt.c

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

649649
/* Initialize IIO device */
650650
indio_dev->name = dev_name(&pdev->dev);
651-
indio_dev->dev.parent = &pdev->dev;
652651
indio_dev->dev.of_node = pdev->dev.of_node;
653652
indio_dev->info = &stm32_lptim_cnt_iio_info;
654653
if (ddata->has_encoder)

drivers/iio/accel/adis16201.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ static int adis16201_probe(struct spi_device *spi)
271271
spi_set_drvdata(spi, indio_dev);
272272

273273
indio_dev->name = spi->dev.driver->name;
274-
indio_dev->dev.parent = &spi->dev;
275274
indio_dev->info = &adis16201_info;
276275

277276
indio_dev->channels = adis16201_channels;

drivers/iio/accel/adis16209.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ static int adis16209_probe(struct spi_device *spi)
282282
spi_set_drvdata(spi, indio_dev);
283283

284284
indio_dev->name = spi->dev.driver->name;
285-
indio_dev->dev.parent = &spi->dev;
286285
indio_dev->info = &adis16209_info;
287286
indio_dev->channels = adis16209_channels;
288287
indio_dev->num_channels = ARRAY_SIZE(adis16209_channels);

drivers/iio/accel/adxl345_core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap,
246246
return ret;
247247
}
248248

249-
indio_dev->dev.parent = dev;
250249
indio_dev->name = name;
251250
indio_dev->info = &adxl345_info;
252251
indio_dev->modes = INDIO_DIRECT_MODE;

drivers/iio/accel/adxl372.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,6 @@ int adxl372_probe(struct device *dev, struct regmap *regmap,
938938
indio_dev->channels = adxl372_channels;
939939
indio_dev->num_channels = ARRAY_SIZE(adxl372_channels);
940940
indio_dev->available_scan_masks = adxl372_channel_masks;
941-
indio_dev->dev.parent = dev;
942941
indio_dev->name = name;
943942
indio_dev->info = &adxl372_info;
944943
indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;

drivers/iio/accel/bma180.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,6 @@ static int bma180_probe(struct i2c_client *client,
10381038
goto err_chip_disable;
10391039

10401040
mutex_init(&data->mutex);
1041-
indio_dev->dev.parent = dev;
10421041
indio_dev->channels = data->part_info->channels;
10431042
indio_dev->num_channels = data->part_info->num_channels;
10441043
indio_dev->name = id->name;

drivers/iio/accel/bma220_spi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ static int bma220_probe(struct spi_device *spi)
237237
spi_set_drvdata(spi, indio_dev);
238238
mutex_init(&data->lock);
239239

240-
indio_dev->dev.parent = &spi->dev;
241240
indio_dev->info = &bma220_info;
242241
indio_dev->name = BMA220_DEVICE_NAME;
243242
indio_dev->modes = INDIO_DIRECT_MODE;

drivers/iio/accel/bma400_core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,6 @@ int bma400_probe(struct device *dev, struct regmap *regmap, const char *name)
816816
return ret;
817817

818818
mutex_init(&data->mutex);
819-
indio_dev->dev.parent = dev;
820819
indio_dev->name = name;
821820
indio_dev->info = &bma400_info;
822821
indio_dev->channels = bma400_channels;

drivers/iio/accel/bmc150-accel-core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,6 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
15741574

15751575
mutex_init(&data->mutex);
15761576

1577-
indio_dev->dev.parent = dev;
15781577
indio_dev->channels = data->chip_info->channels;
15791578
indio_dev->num_channels = data->chip_info->num_channels;
15801579
indio_dev->name = name ? name : data->chip_info->name;

0 commit comments

Comments
 (0)