mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
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 <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
f5d017938e
commit
d3be83244c
@@ -1538,7 +1538,6 @@ static int quad8_probe(struct device *dev, unsigned int id)
|
||||
indio_dev->num_channels = ARRAY_SIZE(quad8_channels);
|
||||
indio_dev->channels = quad8_channels;
|
||||
indio_dev->name = dev_name(dev);
|
||||
indio_dev->dev.parent = dev;
|
||||
|
||||
/* Initialize Counter device and driver data */
|
||||
quad8iio = iio_priv(indio_dev);
|
||||
|
||||
@@ -648,7 +648,6 @@ static int stm32_lptim_cnt_probe(struct platform_device *pdev)
|
||||
|
||||
/* Initialize IIO device */
|
||||
indio_dev->name = dev_name(&pdev->dev);
|
||||
indio_dev->dev.parent = &pdev->dev;
|
||||
indio_dev->dev.of_node = pdev->dev.of_node;
|
||||
indio_dev->info = &stm32_lptim_cnt_iio_info;
|
||||
if (ddata->has_encoder)
|
||||
|
||||
@@ -271,7 +271,6 @@ static int adis16201_probe(struct spi_device *spi)
|
||||
spi_set_drvdata(spi, indio_dev);
|
||||
|
||||
indio_dev->name = spi->dev.driver->name;
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->info = &adis16201_info;
|
||||
|
||||
indio_dev->channels = adis16201_channels;
|
||||
|
||||
@@ -282,7 +282,6 @@ static int adis16209_probe(struct spi_device *spi)
|
||||
spi_set_drvdata(spi, indio_dev);
|
||||
|
||||
indio_dev->name = spi->dev.driver->name;
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->info = &adis16209_info;
|
||||
indio_dev->channels = adis16209_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(adis16209_channels);
|
||||
|
||||
@@ -246,7 +246,6 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap,
|
||||
return ret;
|
||||
}
|
||||
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->name = name;
|
||||
indio_dev->info = &adxl345_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
@@ -938,7 +938,6 @@ int adxl372_probe(struct device *dev, struct regmap *regmap,
|
||||
indio_dev->channels = adxl372_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(adxl372_channels);
|
||||
indio_dev->available_scan_masks = adxl372_channel_masks;
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->name = name;
|
||||
indio_dev->info = &adxl372_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;
|
||||
|
||||
@@ -1038,7 +1038,6 @@ static int bma180_probe(struct i2c_client *client,
|
||||
goto err_chip_disable;
|
||||
|
||||
mutex_init(&data->mutex);
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->channels = data->part_info->channels;
|
||||
indio_dev->num_channels = data->part_info->num_channels;
|
||||
indio_dev->name = id->name;
|
||||
|
||||
@@ -237,7 +237,6 @@ static int bma220_probe(struct spi_device *spi)
|
||||
spi_set_drvdata(spi, indio_dev);
|
||||
mutex_init(&data->lock);
|
||||
|
||||
indio_dev->dev.parent = &spi->dev;
|
||||
indio_dev->info = &bma220_info;
|
||||
indio_dev->name = BMA220_DEVICE_NAME;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
@@ -816,7 +816,6 @@ int bma400_probe(struct device *dev, struct regmap *regmap, const char *name)
|
||||
return ret;
|
||||
|
||||
mutex_init(&data->mutex);
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->name = name;
|
||||
indio_dev->info = &bma400_info;
|
||||
indio_dev->channels = bma400_channels;
|
||||
|
||||
@@ -1574,7 +1574,6 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
|
||||
|
||||
mutex_init(&data->mutex);
|
||||
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->channels = data->chip_info->channels;
|
||||
indio_dev->num_channels = data->chip_info->num_channels;
|
||||
indio_dev->name = name ? name : data->chip_info->name;
|
||||
|
||||
@@ -120,7 +120,6 @@ static int da280_probe(struct i2c_client *client,
|
||||
data->client = client;
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->info = &da280_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = da280_channels;
|
||||
|
||||
@@ -231,7 +231,6 @@ static int da311_probe(struct i2c_client *client,
|
||||
data->client = client;
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->info = &da311_info;
|
||||
indio_dev->name = "da311";
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
@@ -161,7 +161,6 @@ static int dmard06_probe(struct i2c_client *client,
|
||||
dmard06->chip_id = ret;
|
||||
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->name = DMARD06_DRV_NAME;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = dmard06_channels;
|
||||
|
||||
@@ -116,7 +116,6 @@ static int dmard09_probe(struct i2c_client *client,
|
||||
}
|
||||
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->name = DMARD09_DRV_NAME;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = dmard09_channels;
|
||||
|
||||
@@ -196,7 +196,6 @@ static int dmard10_probe(struct i2c_client *client,
|
||||
data->client = client;
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->info = &dmard10_info;
|
||||
indio_dev->name = "dmard10";
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
@@ -384,7 +384,6 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
|
||||
goto error_free_dev_mem;
|
||||
}
|
||||
|
||||
indio_dev->dev.parent = &pdev->dev;
|
||||
indio_dev->info = &accel_3d_info;
|
||||
indio_dev->name = name;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
@@ -411,7 +411,6 @@ int kxsd9_common_probe(struct device *dev,
|
||||
indio_dev->channels = kxsd9_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(kxsd9_channels);
|
||||
indio_dev->name = name;
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->info = &kxsd9_info;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->available_scan_masks = kxsd9_scan_masks;
|
||||
|
||||
@@ -132,7 +132,6 @@ static int mc3230_probe(struct i2c_client *client,
|
||||
data->client = client;
|
||||
i2c_set_clientdata(client, indio_dev);
|
||||
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->info = &mc3230_info;
|
||||
indio_dev->name = "mc3230";
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
@@ -260,7 +260,6 @@ int mma7455_core_probe(struct device *dev, struct regmap *regmap,
|
||||
|
||||
indio_dev->info = &mma7455_info;
|
||||
indio_dev->name = name;
|
||||
indio_dev->dev.parent = dev;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->channels = mma7455_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(mma7455_channels);
|
||||
|
||||
@@ -188,7 +188,6 @@ static int mma7660_probe(struct i2c_client *client,
|
||||
mutex_init(&data->lock);
|
||||
data->mode = MMA7660_MODE_STANDBY;
|
||||
|
||||
indio_dev->dev.parent = &client->dev;
|
||||
indio_dev->info = &mma7660_info;
|
||||
indio_dev->name = MMA7660_DRIVER_NAME;
|
||||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user