iio: Fix missing parent device initalization
Subsystems (2)
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
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
@@ -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
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.
Signed-off-by Lars-Peter Clausen <[email protected]>---
drivers/iio/adc/stx104.c| 1 +1 file changed, 1 insertion(+)drivers/iio/adc/stx104.c +1
-0@@ -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
Jonathan Cameron
maintainerRe: [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.
Signed-off-by Lars-Peter Clausen <[email protected]>
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@@ -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
PATCH 2/8 iio: quad-8: Set parent device
In reply to Lars-Peter ClausenInitialize 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
@@ -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
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.
Signed-off-by Lars-Peter Clausen <[email protected]>---
drivers/iio/counter/104-quad-8.c| 1 +1 file changed, 1 insertion(+)drivers/iio/counter/104-quad-8.c +1
-0@@ -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
PATCH 3/8 iio: cio-dac: Set parent device
In reply to Lars-Peter ClausenInitialize 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
@@ -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
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.
Signed-off-by Lars-Peter Clausen <[email protected]>---
drivers/iio/dac/cio-dac.c| 1 +1 file changed, 1 insertion(+)drivers/iio/dac/cio-dac.c +1
-0@@ -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
Jonathan Cameron
maintainerRe: [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.
Signed-off-by Lars-Peter Clausen <[email protected]>---
drivers/iio/dac/cio-dac.c| 1 +1 file changed, 1 insertion(+)drivers/iio/dac/cio-dac.c +1
-0@@ -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
-0priv =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
PATCH 4/8 iio: max30100: Set parent device
In reply to Lars-Peter ClausenInitialize 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
@@ -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
Jonathan Cameron
maintainerRe: [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.
Signed-off-by Lars-Peter Clausen <[email protected]>
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@@ -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;
PATCH 5/8 iio: max30102: Set parent device
In reply to Lars-Peter ClausenInitialize 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
@@ -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
Jonathan Cameron
maintainerRe: [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.
Signed-off-by Lars-Peter Clausen <[email protected]>
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@@ -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;
PATCH 6/8 iio: lmp91000: Set parent device
In reply to Lars-Peter ClausenInitialize 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
@@ -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
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.
Signed-off-by Lars-Peter Clausen <[email protected]>
Quoted 19 lines
--- drivers/iio/potentiostat/lmp91000.c | 1 + 1 file changed, 1 insertion(+)drivers/iio/potentiostat/lmp91000.c +1
-1@@ -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
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.
Signed-off-by Lars-Peter Clausen <[email protected]>Reviewed-by Matt Ranostay <[email protected]>
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@@ -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
PATCH 7/8 iio: pulsedlight-lidar-lite-v2: Set parent device
In reply to Lars-Peter ClausenInitialize 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
@@ -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
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.
Signed-off-by Lars-Peter Clausen <[email protected]>
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@@ -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
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.
Signed-off-by Lars-Peter Clausen <[email protected]>Reviewed-by Matt Ranostay <[email protected]>
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@@ -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
PATCH 8/8 iio: maxim_thermocouple: Set parent device
In reply to Lars-Peter ClausenInitialize 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
@@ -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
Jonathan Cameron
maintainerRe: [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.
Signed-off-by Lars-Peter Clausen <[email protected]>
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@@ -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;