Skip to contentSkip to conversation

iio: Fix missing parent device initalization

PATCH Applied Lars-Peter Clausen 4 participants 21 messages Feb 11, 2017 – Feb 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover iio: Fix missing parent device initalization

Add parent device initialization to drivers that are currently missing it. Setting the parent device makes sure that the IIO device shows up at the right level in the device hierachy.

The following coccinelle semantic patch was used to find the offending drivers:
// <smpl>
@r1@
identifier indio_dev;
position p;
@@
indio_dev->dev.parent = ...;
...
(
iio_device_register@p(indio_dev)
|
devm_iio_device_register@p(..., indio_dev)
)

@@
position p != r1.p;
identifier indio_dev;
@@
(
*iio_device_register@p(indio_dev)
|
*devm_iio_device_register@p(..., indio_dev)
)
// </smpl>

- Lars

Lars-Peter Clausen (8):
iio: stx104: Set parent device
iio: quad-8: Set parent device
iio: cio-dac: Set parent device
iio: max30100: Set parent device
iio: max30102: Set parent device
iio: lmp91000: Set parent device
iio: pulsedlight-lidar-lite-v2: Set parent device
iio: maxim_thermocouple: Set parent device

 drivers/iio/adc/stx104.c                          | 1 +
 drivers/iio/counter/104-quad-8.c                  | 1 +
 drivers/iio/dac/cio-dac.c                         | 1 +
 drivers/iio/health/max30100.c                     | 1 +
 drivers/iio/health/max30102.c                     | 1 +
 drivers/iio/potentiostat/lmp91000.c               | 1 +
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 +
 drivers/iio/temperature/maxim_thermocouple.c      | 1 +
 8 files changed, 8 insertions(+)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/8 iio: stx104: Set parent device

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
 drivers/iio/adc/stx104.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/adc/stx104.c +1 -0
index be2de48..2df84fa5 100644
@@ -318,6 +318,7 @@ static int stx104_probe(struct device *dev, unsigned int id)
 	}
 
 	indio_dev->name = dev_name(dev);
+	indio_dev->dev.parent = dev;
 
 	priv = iio_priv(indio_dev);
 	priv->base = base[id];
Signature · 1 line
2.1.4
Acked-by on v1 1/8
#2 lore raw

Re: [PATCH 1/8] iio: stx104: Set parent device

Quoted 24 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
drivers/iio/adc/stx104.c | 1 +

1 file changed, 1 insertion(+)
drivers/iio/adc/stx104.c +1 -0
index be2de48..2df84fa5 100644
@@ -318,6 +318,7 @@ static int stx104_probe(struct device *dev, unsigned int id)
 	}
 
 	indio_dev->name = dev_name(dev);
+	indio_dev->dev.parent = dev;
 
 	priv = iio_priv(indio_dev);
 	priv->base = base[id];
Signature · 1 line
2.1.4
maintainer
#3 lore raw

Re: [PATCH 1/8] iio: stx104: Set parent device

Quoted 6 lines · William Breathitt Gray
Quoted 5 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

Hmm. Took me a few moments to decide whether to push these as fixes or not. In the end I concluded that they have always been broken, so whilst they are clearly a fix we want in, the probably don't need to be rushed in or applied to old kernels. For drivers that were in this cycle, I may push them out as straight forward fixes however.

If anyone disagrees then shout quickly!

Applied to the togreg branch of iio.git and pushed out as testing.

Quoted 22 lines
Quoted 19 lines

---
drivers/iio/adc/stx104.c | 1 +

1 file changed, 1 insertion(+)
drivers/iio/adc/stx104.c +1 -0
index be2de48..2df84fa5 100644
@@ -318,6 +318,7 @@ static int stx104_probe(struct device *dev, unsigned int id)
 	}
 
 	indio_dev->name = dev_name(dev);
+	indio_dev->dev.parent = dev;
 
 	priv = iio_priv(indio_dev);
 	priv->base = base[id];
Signature · 1 line
2.1.4
#4 lore raw

PATCH 2/8 iio: quad-8: Set parent device

In reply to Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
 drivers/iio/counter/104-quad-8.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/counter/104-quad-8.c +1 -0
index a5913e9..e381ca6 100644
@@ -551,6 +551,7 @@ 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;
 
 	priv = iio_priv(indio_dev);
 	priv->base = base[id];
Signature · 1 line
2.1.4
Acked-by on v1 2/8
#5 lore raw

Re: [PATCH 2/8] iio: quad-8: Set parent device

Quoted 24 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
drivers/iio/counter/104-quad-8.c | 1 +

1 file changed, 1 insertion(+)
drivers/iio/counter/104-quad-8.c +1 -0
index a5913e9..e381ca6 100644
@@ -551,6 +551,7 @@ 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;
 
 	priv = iio_priv(indio_dev);
 	priv->base = base[id];
Signature · 1 line
2.1.4
#6 lore raw

PATCH 3/8 iio: cio-dac: Set parent device

In reply to Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
 drivers/iio/dac/cio-dac.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/dac/cio-dac.c +1 -0
index 5a743e2..a046422 100644
@@ -119,6 +119,7 @@ static int cio_dac_probe(struct device *dev, unsigned int id)
 	indio_dev->channels = cio_dac_channels;
 	indio_dev->num_channels = CIO_DAC_NUM_CHAN;
 	indio_dev->name = dev_name(dev);
+	indio_dev->dev.parent = dev;
 
 	priv = iio_priv(indio_dev);
 	priv->base = base[id];
Signature · 1 line
2.1.4
Acked-by on v1 3/8
#7 lore raw

Re: [PATCH 3/8] iio: cio-dac: Set parent device

Quoted 24 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
drivers/iio/dac/cio-dac.c | 1 +

1 file changed, 1 insertion(+)
drivers/iio/dac/cio-dac.c +1 -0
index 5a743e2..a046422 100644
@@ -119,6 +119,7 @@ static int cio_dac_probe(struct device *dev, unsigned int id)
 	indio_dev->channels = cio_dac_channels;
 	indio_dev->num_channels = CIO_DAC_NUM_CHAN;
 	indio_dev->name = dev_name(dev);
+	indio_dev->dev.parent = dev;
 
 	priv = iio_priv(indio_dev);
 	priv->base = base[id];
Signature · 1 line
2.1.4
maintainer
#8 lore raw

Re: [PATCH 3/8] iio: cio-dac: Set parent device

Quoted 20 lines · William Breathitt Gray
Quoted 19 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
drivers/iio/dac/cio-dac.c | 1 +

1 file changed, 1 insertion(+)
drivers/iio/dac/cio-dac.c +1 -0
index 5a743e2..a046422 100644
@@ -119,6 +119,7 @@ static int cio_dac_probe(struct device *dev, unsigned int id)
 	indio_dev->channels = cio_dac_channels;
 	indio_dev->num_channels = CIO_DAC_NUM_CHAN;
 	indio_dev->name = dev_name(dev);
+	indio_dev->dev.parent = dev;
 
Quoted 8 lines
Quoted 5 lines
drivers/iio/dac/cio-dac.c +0 -0
 	priv = iio_priv(indio_dev);
 	priv->base = base[id];
Signature · 1 line
2.1.4

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with.

Thanks,

Jonathan

#9 lore raw

PATCH 4/8 iio: max30100: Set parent device

In reply to Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
 drivers/iio/health/max30100.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/health/max30100.c +1 -0
index 9648c69..10b3e0d 100644
@@ -449,6 +449,7 @@ static int max30100_probe(struct i2c_client *client,
 	indio_dev->available_scan_masks = max30100_scan_masks;
 	indio_dev->modes = (INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE);
 	indio_dev->setup_ops = &max30100_buffer_setup_ops;
+	indio_dev->dev.parent = &client->dev;
 
 	data = iio_priv(indio_dev);
 	data->indio_dev = indio_dev;
Signature · 1 line
2.1.4
maintainer
#10 lore raw

Re: [PATCH 4/8] iio: max30100: Set parent device

Quoted 5 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 17 lines
---
 drivers/iio/health/max30100.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/health/max30100.c +1 -0
index 9648c69..10b3e0d 100644
@@ -449,6 +449,7 @@ static int max30100_probe(struct i2c_client *client,
 	indio_dev->available_scan_masks = max30100_scan_masks;
 	indio_dev->modes = (INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE);
 	indio_dev->setup_ops = &max30100_buffer_setup_ops;
+	indio_dev->dev.parent = &client->dev;
 
 	data = iio_priv(indio_dev);
 	data->indio_dev = indio_dev;
#11 lore raw

PATCH 5/8 iio: max30102: Set parent device

In reply to Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
 drivers/iio/health/max30102.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/health/max30102.c +1 -0
index 377518c..839b875 100644
@@ -410,6 +410,7 @@ static int max30102_probe(struct i2c_client *client,
 	indio_dev->available_scan_masks = max30102_scan_masks;
 	indio_dev->modes = (INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE);
 	indio_dev->setup_ops = &max30102_buffer_setup_ops;
+	indio_dev->dev.parent = &client->dev;
 
 	data = iio_priv(indio_dev);
 	data->indio_dev = indio_dev;
Signature · 1 line
2.1.4
maintainer
#12 lore raw

Re: [PATCH 5/8] iio: max30102: Set parent device

Quoted 5 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 17 lines
---
 drivers/iio/health/max30102.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/health/max30102.c +1 -0
index 377518c..839b875 100644
@@ -410,6 +410,7 @@ static int max30102_probe(struct i2c_client *client,
 	indio_dev->available_scan_masks = max30102_scan_masks;
 	indio_dev->modes = (INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE);
 	indio_dev->setup_ops = &max30102_buffer_setup_ops;
+	indio_dev->dev.parent = &client->dev;
 
 	data = iio_priv(indio_dev);
 	data->indio_dev = indio_dev;
#13 lore raw

PATCH 6/8 iio: lmp91000: Set parent device

In reply to Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
 drivers/iio/potentiostat/lmp91000.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/potentiostat/lmp91000.c +1 -0
index e227143..afa8de3 100644
@@ -325,6 +325,7 @@ static int lmp91000_probe(struct i2c_client *client,
 	indio_dev->channels = lmp91000_channels;
 	indio_dev->num_channels = ARRAY_SIZE(lmp91000_channels);
 	indio_dev->name = LMP91000_DRV_NAME;
+	indio_dev->dev.parent = &client->dev;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	i2c_set_clientdata(client, indio_dev);
 
Signature · 1 line
2.1.4
Reviewed-by on v1 6/8
#14 lore raw

Re: [PATCH 6/8] iio: lmp91000: Set parent device

Quoted 5 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

Quoted 19 lines
---
 drivers/iio/potentiostat/lmp91000.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/potentiostat/lmp91000.c +1 -1
index e227143..afa8de3 100644
@@ -325,6 +325,7 @@ static int lmp91000_probe(struct i2c_client *client,
        indio_dev->channels = lmp91000_channels;
        indio_dev->num_channels = ARRAY_SIZE(lmp91000_channels);
        indio_dev->name = LMP91000_DRV_NAME;
+       indio_dev->dev.parent = &client->dev;
        indio_dev->modes = INDIO_DIRECT_MODE;
        i2c_set_clientdata(client, indio_dev);
 
--

2.1.4

maintainer Applied
#15 lore raw

Re: [PATCH 6/8] iio: lmp91000: Set parent device

Quoted 8 lines · Matt Ranostay
Quoted 5 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

Applied.

Quoted 25 lines
Quoted 18 lines
---
 drivers/iio/potentiostat/lmp91000.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/potentiostat/lmp91000.c +1 -1
index e227143..afa8de3 100644
@@ -325,6 +325,7 @@ static int lmp91000_probe(struct i2c_client *client,
        indio_dev->channels = lmp91000_channels;
        indio_dev->num_channels = ARRAY_SIZE(lmp91000_channels);
        indio_dev->name = LMP91000_DRV_NAME;
+       indio_dev->dev.parent = &client->dev;
        indio_dev->modes = INDIO_DIRECT_MODE;
        i2c_set_clientdata(client, indio_dev);
 
--
Quoted 2 lines

2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

PATCH 7/8 iio: pulsedlight-lidar-lite-v2: Set parent device

In reply to Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +1 -0
index 20c16a0..36c1ddc 100644
@@ -278,6 +278,7 @@ static int lidar_probe(struct i2c_client *client,
 	indio_dev->name = LIDAR_DRV_NAME;
 	indio_dev->channels = lidar_channels;
 	indio_dev->num_channels = ARRAY_SIZE(lidar_channels);
+	indio_dev->dev.parent = &client->dev;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
 	i2c_set_clientdata(client, indio_dev);
Signature · 1 line
2.1.4
Reviewed-by on v1 7/8
#17 lore raw

Re: [PATCH 7/8] iio: pulsedlight-lidar-lite-v2: Set parent device

Quoted 5 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

Quoted 19 lines
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +1 -1
index 20c16a0..36c1ddc 100644
@@ -278,6 +278,7 @@ static int lidar_probe(struct i2c_client *client,
        indio_dev->name = LIDAR_DRV_NAME;
        indio_dev->channels = lidar_channels;
        indio_dev->num_channels = ARRAY_SIZE(lidar_channels);
+       indio_dev->dev.parent = &client->dev;
        indio_dev->modes = INDIO_DIRECT_MODE;
 
        i2c_set_clientdata(client, indio_dev);
--

2.1.4

maintainer Applied
#18 lore raw

Re: [PATCH 7/8] iio: pulsedlight-lidar-lite-v2: Set parent device

Quoted 8 lines · Matt Ranostay
Quoted 5 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

Applied.

Quoted 25 lines
Quoted 18 lines
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +1 -1
index 20c16a0..36c1ddc 100644
@@ -278,6 +278,7 @@ static int lidar_probe(struct i2c_client *client,
        indio_dev->name = LIDAR_DRV_NAME;
        indio_dev->channels = lidar_channels;
        indio_dev->num_channels = ARRAY_SIZE(lidar_channels);
+       indio_dev->dev.parent = &client->dev;
        indio_dev->modes = INDIO_DIRECT_MODE;
 
        i2c_set_clientdata(client, indio_dev);
--
Quoted 2 lines

2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#19 lore raw

PATCH 8/8 iio: maxim_thermocouple: Set parent device

In reply to Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

---
 drivers/iio/temperature/maxim_thermocouple.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/temperature/maxim_thermocouple.c +1 -0
index f962f31..5572142 100644
@@ -231,6 +231,7 @@ static int maxim_thermocouple_probe(struct spi_device *spi)
 	indio_dev->available_scan_masks = chip->scan_masks;
 	indio_dev->num_channels = chip->num_channels;
 	indio_dev->modes = INDIO_DIRECT_MODE;
+	indio_dev->dev.parent = &spi->dev;
 
 	data = iio_priv(indio_dev);
 	data->spi = spi;
Signature · 1 line
2.1.4
maintainer
#20 lore raw

Re: [PATCH 8/8] iio: maxim_thermocouple: Set parent device

Quoted 5 lines · Lars-Peter Clausen

Initialize the parent of the IIO device to the device that registered it. This makes sure that the IIO device appears the right level in the device hierarchy.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks for cleaning these up Lars,

Jonathan

Quoted 17 lines
---
 drivers/iio/temperature/maxim_thermocouple.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/temperature/maxim_thermocouple.c +1 -0
index f962f31..5572142 100644
@@ -231,6 +231,7 @@ static int maxim_thermocouple_probe(struct spi_device *spi)
 	indio_dev->available_scan_masks = chip->scan_masks;
 	indio_dev->num_channels = chip->num_channels;
 	indio_dev->modes = INDIO_DIRECT_MODE;
+	indio_dev->dev.parent = &spi->dev;
 
 	data = iio_priv(indio_dev);
 	data->spi = spi;