Skip to contentSkip to conversation

iio: cleanup some new instances of manual parent setting.

PATCH In review Jonathan Cameron 3 participants 15 messages Apr 26, 2021 – May 3, 2021

Subsystems (6)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

cover iio: cleanup some new instances of manual parent setting.

From: Jonathan Cameron <[email protected]>

It seems I still haven't trained my eyes to spot these.

I think they have all been introduced since
iio_device_alloc() and friends started setting this
8525df47b3d1e ("iio: core: fix/re-introduce back parent assignment") 78289b4a58b58 ("iio: core: pass parent device as parameter during allocation")

Anyhow, all seem fairly obvious to me, but maybe I missed something so please take a look.

Jonathan Cameron (8):
iio: accel: bmi088: Drop manual assignment of iio_dev.dev.parent
iio: dac: ad5766: Drop duplicate setting of iio_dev.dev.parent
iio: adc: mp2629: Drop duplicate setting iio_dev.dev.parent
iio: adc: mt6360: Drop duplicate setting of iio_dev.dev.parent
iio: adc: ti-ads131e08: Drop duplicate setting of iio_dev.dev.parent
iio: humidity: hdc2010: Drop duplicate setting of iio_dev.dev.parent
iio: position: hid-sensor-custom-intel-hinge: Drop duplicate parent
setting.
iio: common: scmi_sensors: Drop duplicate setting of
iio_dev.dev.parent

 drivers/iio/accel/bmi088-accel-core.c                | 1 -
 drivers/iio/adc/mp2629_adc.c                         | 1 -
 drivers/iio/adc/mt6360-adc.c                         | 1 -
 drivers/iio/adc/ti-ads131e08.c                       | 1 -
 drivers/iio/common/scmi_sensors/scmi_iio.c           | 1 -
 drivers/iio/dac/ad5766.c                             | 1 -
 drivers/iio/humidity/hdc2010.c                       | 1 -
 drivers/iio/position/hid-sensor-custom-intel-hinge.c | 1 -
 8 files changed, 8 deletions(-)
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 1/8 iio: accel: bmi088: Drop manual assignment of iio_dev.dev.parent

From: Jonathan Cameron <[email protected]>

The core already set this to the same value in devm_iio_device_alloc()

---
 drivers/iio/accel/bmi088-accel-core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/accel/bmi088-accel-core.c +0 -1
index 12d00658e46f..61aaaf48c040 100644
@@ -496,7 +496,6 @@ int bmi088_accel_core_probe(struct device *dev, struct regmap *regmap,
 	if (ret)
 		return ret;
 
-	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;
Signature · 1 line
2.31.1
author maintainer
#2 lore raw

PATCH 2/8 iio: dac: ad5766: Drop duplicate setting of iio_dev.dev.parent

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This is set to the same value in devm_iio_device_alloc() so no need to do it again.

---
 drivers/iio/dac/ad5766.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/dac/ad5766.c +0 -1
index 79837a4b3a41..b0f180d46394 100644
@@ -597,7 +597,6 @@ static int ad5766_probe(struct spi_device *spi)
 	indio_dev->channels = st->chip_info->channels;
 	indio_dev->num_channels = st->chip_info->num_channels;
 	indio_dev->info = &ad5766_info;
-	indio_dev->dev.parent = &spi->dev;
 	indio_dev->dev.of_node = spi->dev.of_node;
 	indio_dev->name = spi_get_device_id(spi)->name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
Signature · 1 line
2.31.1
#3 lore raw

Re: [PATCH 2/8] iio: dac: ad5766: Drop duplicate setting of iio_dev.dev.parent

Quoted 17 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This is set to the same value in devm_iio_device_alloc() so no need to do it again.

---
 drivers/iio/dac/ad5766.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/dac/ad5766.c +0 -0
index 79837a4b3a41..b0f180d46394 100644

drivers/iio/dac/ad5766.c static int ad5766_probe(struct spi_device *spi) · line 600

Quoted 5 lines
drivers/iio/dac/ad5766.c +0 -1
@@ -597,7 +597,6 @@ static int ad5766_probe(struct spi_device *spi)
        indio_dev->channels = st->chip_info->channels;
        indio_dev->num_channels = st->chip_info->num_channels;
        indio_dev->info = &ad5766_info;
-       indio_dev->dev.parent = &spi->dev;
        indio_dev->dev.of_node = spi->dev.of_node;

Unrelated to this series.
This looks like it could do without the of_node assignment as well.

I probably should have noticed this earlier.

Quoted 5 lines
drivers/iio/dac/ad5766.c +0 -1
        indio_dev->name = spi_get_device_id(spi)->name;
        indio_dev->modes = INDIO_DIRECT_MODE;
--

2.31.1

author maintainer
#4 lore raw

Re: [PATCH 2/8] iio: dac: ad5766: Drop duplicate setting of iio_dev.dev.parent

Quoted 27 lines · On Tue, 27 Apr 2021 10:26:31 +0300 Alexandru Ardelean <[email protected]>…
Quoted 17 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This is set to the same value in devm_iio_device_alloc() so no need to do it again.

---
 drivers/iio/dac/ad5766.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/dac/ad5766.c +0 -0
index 79837a4b3a41..b0f180d46394 100644

drivers/iio/dac/ad5766.c static int ad5766_probe(struct spi_device *spi) · line 600

Quoted 5 lines
drivers/iio/dac/ad5766.c +0 -1
@@ -597,7 +597,6 @@ static int ad5766_probe(struct spi_device *spi)
        indio_dev->channels = st->chip_info->channels;
        indio_dev->num_channels = st->chip_info->num_channels;
        indio_dev->info = &ad5766_info;
-       indio_dev->dev.parent = &spi->dev;
        indio_dev->dev.of_node = spi->dev.of_node;  

Unrelated to this series.
This looks like it could do without the of_node assignment as well.

Quoted 1 line

I probably should have noticed this earlier.

Good point. Rather than having a separate patch I'll pull that in here whilst applying if no one shouts.

Thanks,

Jonathan

Quoted 6 lines
Quoted 6 lines
drivers/iio/dac/ad5766.c +0 -1
        indio_dev->name = spi_get_device_id(spi)->name;
        indio_dev->modes = INDIO_DIRECT_MODE;
--

2.31.1

author maintainer
#5 lore raw

PATCH 3/8 iio: adc: mp2629: Drop duplicate setting iio_dev.dev.parent

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This is already set to the same value in devm_iio_device_alloc()

---
 drivers/iio/adc/mp2629_adc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/mp2629_adc.c +0 -1
index 331a9a728217..aca084f1e78a 100644
@@ -144,7 +144,6 @@ static int mp2629_adc_probe(struct platform_device *pdev)
 	}
 
 	indio_dev->name = "mp2629-adc";
-	indio_dev->dev.parent = dev;
 	indio_dev->channels = mp2629_channels;
 	indio_dev->num_channels = ARRAY_SIZE(mp2629_channels);
 	indio_dev->modes = INDIO_DIRECT_MODE;
Signature · 1 line
2.31.1
author maintainer
#6 lore raw

PATCH 4/8 iio: adc: mt6360: Drop duplicate setting of iio_dev.dev.parent

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Already set to the same value in devm_iio_device_alloc()

---
 drivers/iio/adc/mt6360-adc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/mt6360-adc.c +0 -1
index 6b39a139ce28..07c0e6768391 100644
@@ -337,7 +337,6 @@ static int mt6360_adc_probe(struct platform_device *pdev)
 	}
 
 	indio_dev->name = dev_name(&pdev->dev);
-	indio_dev->dev.parent = &pdev->dev;
 	indio_dev->info = &mt6360_adc_iio_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = mt6360_adc_channels;
Signature · 1 line
2.31.1
#7 lore raw

Re: [PATCH 4/8] iio: adc: mt6360: Drop duplicate setting of iio_dev.dev.parent

Quoted 16 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Already set to the same value in devm_iio_device_alloc()

---
 drivers/iio/adc/mt6360-adc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/mt6360-adc.c +0 -0
index 6b39a139ce28..07c0e6768391 100644

drivers/iio/adc/mt6360-adc.c static int mt6360_adc_probe(struct platform_device *pdev) · line 339

Quoted 3 lines
drivers/iio/adc/mt6360-adc.c +0 -0
@@ -337,7 +337,6 @@ static int mt6360_adc_probe(struct platform_device *pdev)
        }
 
        indio_dev->name = dev_name(&pdev->dev);

unrelated to this series, this dev_name(&pdev->dev) looks a bit weird; this should resolve to the driver name AFAICT; which is "mt6360-adc" it feels a bit off with respect to ABI; but maybe it's too late to change it?

Quoted 7 lines
drivers/iio/adc/mt6360-adc.c +0 -2
-       indio_dev->dev.parent = &pdev->dev;
        indio_dev->info = &mt6360_adc_iio_info;
        indio_dev->modes = INDIO_DIRECT_MODE;
        indio_dev->channels = mt6360_adc_channels;
--

2.31.1

#8 lore raw

Re: [PATCH 4/8] iio: adc: mt6360: Drop duplicate setting of iio_dev.dev.parent

Quoted 19 lines · On Tue, 27 Apr 2021 10:25:05 +0300 Alexandru Ardelean <[email protected]>…
Quoted 18 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Already set to the same value in devm_iio_device_alloc()

---
 drivers/iio/adc/mt6360-adc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/mt6360-adc.c +0 -0
index 6b39a139ce28..07c0e6768391 100644
@@ -337,7 +337,6 @@ static int mt6360_adc_probe(struct platform_device *pdev)
        }
 
Quoted 5 lines

drivers/iio/adc/mt6360-adc.c static int mt6360_adc_probe(struct platform_device *pdev) · line 339

Quoted 1 line
drivers/iio/adc/mt6360-adc.c +0 -0
        indio_dev->name = dev_name(&pdev->dev);  

unrelated to this series, this dev_name(&pdev->dev) looks a bit weird; this should resolve to the driver name AFAICT; which is "mt6360-adc" it feels a bit off with respect to ABI; but maybe it's too late to change it?

Yup. We have some historical ones of these unfortunately when I wasn't paying attention properly. They are ABI for those parts now so we can't fix them without significant risk of breaking someones platform.

Jonathan

Quoted 8 lines
Quoted 8 lines
drivers/iio/adc/mt6360-adc.c +0 -2
-       indio_dev->dev.parent = &pdev->dev;
        indio_dev->info = &mt6360_adc_iio_info;
        indio_dev->modes = INDIO_DIRECT_MODE;
        indio_dev->channels = mt6360_adc_channels;
--

2.31.1

author maintainer
#9 lore raw

PATCH 5/8 iio: adc: ti-ads131e08: Drop duplicate setting of iio_dev.dev.parent

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Already set to same value in devm_iio_device_alloc()

---
 drivers/iio/adc/ti-ads131e08.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/ti-ads131e08.c +0 -1
index 5dcf1e9294d7..d220eef5c0df 100644
@@ -824,7 +824,6 @@ static int ads131e08_probe(struct spi_device *spi)
 		return ret;
 
 	indio_dev->name = st->info->name;
-	indio_dev->dev.parent = &spi->dev;
 	indio_dev->info = &ads131e08_iio_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
Signature · 1 line
2.31.1
author maintainer
#10 lore raw

PATCH 6/8 iio: humidity: hdc2010: Drop duplicate setting of iio_dev.dev.parent

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Already set to same value in devm_iio_device_alloc()

Cc Eugene Zaikonnikov <[email protected]>
---
 drivers/iio/humidity/hdc2010.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/humidity/hdc2010.c +0 -1
index 83f5b9f60780..1381df46187c 100644
@@ -272,7 +272,6 @@ static int hdc2010_probe(struct i2c_client *client,
 	data->client = client;
 	mutex_init(&data->lock);
 
-	indio_dev->dev.parent = &client->dev;
 	/*
 	 * As DEVICE ID register does not differentiate between
 	 * HDC2010 and HDC2080, we have the name hardcoded
Signature · 1 line
2.31.1
author maintainer
#11 lore raw

PATCH 7/8 iio: position: hid-sensor-custom-intel-hinge: Drop duplicate parent setting.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

iio_dev.dev.parent is already set to the same value in devm_iio_device_alloc()

---
 drivers/iio/position/hid-sensor-custom-intel-hinge.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/position/hid-sensor-custom-intel-hinge.c +0 -1
index fd77e7ee87f3..738b5f4626ce 100644
@@ -303,7 +303,6 @@ static int hid_hinge_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	indio_dev->dev.parent = &pdev->dev;
 	indio_dev->info = &hinge_info;
 	indio_dev->name = "hinge";
 	indio_dev->modes = INDIO_DIRECT_MODE;
Signature · 1 line
2.31.1
author maintainer
#12 lore raw

PATCH 8/8 iio: common: scmi_sensors: Drop duplicate setting of iio_dev.dev.parent

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This is already set to the same value in devm_iio_device_alloc()

---
 drivers/iio/common/scmi_sensors/scmi_iio.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/common/scmi_sensors/scmi_iio.c +0 -1
index 63e4cec9de5e..16f0526ff01a 100644
@@ -544,7 +544,6 @@ static struct iio_dev *scmi_alloc_iiodev(struct device *dev,
 		return ERR_PTR(-ENOMEM);
 
 	iiodev->modes = INDIO_DIRECT_MODE;
-	iiodev->dev.parent = dev;
 	sensor = iio_priv(iiodev);
 	sensor->handle = handle;
 	sensor->sensor_info = sensor_info;
Signature · 1 line
2.31.1
Reviewed-by on the v1 series
#13 lore raw
In reply to Jonathan Cameron
Quoted 5 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

It seems I still haven't trained my eyes to spot these.

Quoted 7 lines

I think they have all been introduced since
iio_device_alloc() and friends started setting this
8525df47b3d1e ("iio: core: fix/re-introduce back parent assignment") 78289b4a58b58 ("iio: core: pass parent device as parameter during allocation")

Anyhow, all seem fairly obvious to me, but maybe I missed something so please take a look.

I've added 2 comments that are unrelated [directly] to this series.

Quoted 26 lines

Jonathan Cameron (8):
iio: accel: bmi088: Drop manual assignment of iio_dev.dev.parent
iio: dac: ad5766: Drop duplicate setting of iio_dev.dev.parent
iio: adc: mp2629: Drop duplicate setting iio_dev.dev.parent
iio: adc: mt6360: Drop duplicate setting of iio_dev.dev.parent
iio: adc: ti-ads131e08: Drop duplicate setting of iio_dev.dev.parent
iio: humidity: hdc2010: Drop duplicate setting of iio_dev.dev.parent
iio: position: hid-sensor-custom-intel-hinge: Drop duplicate parent
setting.
iio: common: scmi_sensors: Drop duplicate setting of
iio_dev.dev.parent

 drivers/iio/accel/bmi088-accel-core.c                | 1 -
 drivers/iio/adc/mp2629_adc.c                         | 1 -
 drivers/iio/adc/mt6360-adc.c                         | 1 -
 drivers/iio/adc/ti-ads131e08.c                       | 1 -
 drivers/iio/common/scmi_sensors/scmi_iio.c           | 1 -
 drivers/iio/dac/ad5766.c                             | 1 -
 drivers/iio/humidity/hdc2010.c                       | 1 -
 drivers/iio/position/hid-sensor-custom-intel-hinge.c | 1 -
 8 files changed, 8 deletions(-)

--
2.31.1

author maintainer
#14 lore raw
Quoted 11 lines · On Tue, 27 Apr 2021 10:27:44 +0300 Alexandru Ardelean <[email protected]>…
Quoted 10 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

It seems I still haven't trained my eyes to spot these.

I think they have all been introduced since
iio_device_alloc() and friends started setting this
8525df47b3d1e ("iio: core: fix/re-introduce back parent assignment") 78289b4a58b58 ("iio: core: pass parent device as parameter during allocation")

Quoted 6 lines
Quoted 2 lines

Anyhow, all seem fairly obvious to me, but maybe I missed something so please take a look.

I've added 2 comments that are unrelated [directly] to this series.

Thanks for checking these. I've added the of_node dropping bit to the patch you pointed that out in.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to poke at it and see if we missed anything!

Thanks,

Jonathan

Quoted 27 lines
Quoted 27 lines

Jonathan Cameron (8):
iio: accel: bmi088: Drop manual assignment of iio_dev.dev.parent
iio: dac: ad5766: Drop duplicate setting of iio_dev.dev.parent
iio: adc: mp2629: Drop duplicate setting iio_dev.dev.parent
iio: adc: mt6360: Drop duplicate setting of iio_dev.dev.parent
iio: adc: ti-ads131e08: Drop duplicate setting of iio_dev.dev.parent
iio: humidity: hdc2010: Drop duplicate setting of iio_dev.dev.parent
iio: position: hid-sensor-custom-intel-hinge: Drop duplicate parent
setting.
iio: common: scmi_sensors: Drop duplicate setting of
iio_dev.dev.parent

 drivers/iio/accel/bmi088-accel-core.c                | 1 -
 drivers/iio/adc/mp2629_adc.c                         | 1 -
 drivers/iio/adc/mt6360-adc.c                         | 1 -
 drivers/iio/adc/ti-ads131e08.c                       | 1 -
 drivers/iio/common/scmi_sensors/scmi_iio.c           | 1 -
 drivers/iio/dac/ad5766.c                             | 1 -
 drivers/iio/humidity/hdc2010.c                       | 1 -
 drivers/iio/position/hid-sensor-custom-intel-hinge.c | 1 -
 8 files changed, 8 deletions(-)

--
2.31.1