Skip to content

Commit

Permalink
iio: core: move @id from struct iio_dev to struct iio_dev_opaque
Browse files Browse the repository at this point in the history
Continuing from Alexandru Ardelean's introduction of the split between
driver modifiable fields and those that should only be set by the core.

This could have been done in two steps to make the actual move after
introducing iio_device_id() but there seemed limited point to that
given how mechanical the majority of the patch is.

Includes fixup from Alex for missing mxs-lradc-adc conversion.

Signed-off-by: Jonathan Cameron <[email protected]>
Reviewed-by: Alexandru Ardelean <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
jic23 committed May 17, 2021
1 parent e6cc8f2 commit 15ea287
Show file tree
Hide file tree
Showing 51 changed files with 89 additions and 60 deletions.
4 changes: 2 additions & 2 deletions drivers/iio/accel/adxl372.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,14 +1223,14 @@ int adxl372_probe(struct device *dev, struct regmap *regmap,
st->dready_trig = devm_iio_trigger_alloc(dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (st->dready_trig == NULL)
return -ENOMEM;

st->peak_datardy_trig = devm_iio_trigger_alloc(dev,
"%s-dev%d-peak",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!st->peak_datardy_trig)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/accel/bma180.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ static int bma180_probe(struct i2c_client *client,

if (client->irq > 0) {
data->trig = iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!data->trig) {
ret = -ENOMEM;
goto err_chip_disable;
Expand Down
4 changes: 2 additions & 2 deletions drivers/iio/accel/bmc150-accel-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1470,9 +1470,9 @@ static int bmc150_accel_triggers_setup(struct iio_dev *indio_dev,
struct bmc150_accel_trigger *t = &data->triggers[i];

t->indio_trig = devm_iio_trigger_alloc(dev,
bmc150_accel_triggers[i].name,
bmc150_accel_triggers[i].name,
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!t->indio_trig) {
ret = -ENOMEM;
break;
Expand Down
4 changes: 2 additions & 2 deletions drivers/iio/accel/kxcjk-1013.c
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
data->dready_trig = devm_iio_trigger_alloc(&client->dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!data->dready_trig) {
ret = -ENOMEM;
goto err_poweroff;
Expand All @@ -1413,7 +1413,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
data->motion_trig = devm_iio_trigger_alloc(&client->dev,
"%s-any-motion-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!data->motion_trig) {
ret = -ENOMEM;
goto err_poweroff;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/accel/mma8452.c
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ static int mma8452_trigger_setup(struct iio_dev *indio_dev)

trig = devm_iio_trigger_alloc(&data->client->dev, "%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!trig)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/accel/mxc4005.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ static int mxc4005_probe(struct i2c_client *client,
data->dready_trig = devm_iio_trigger_alloc(&client->dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!data->dready_trig)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/accel/stk8312.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ static int stk8312_probe(struct i2c_client *client,
data->dready_trig = devm_iio_trigger_alloc(&client->dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!data->dready_trig) {
ret = -ENOMEM;
goto err_power_off;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/accel/stk8ba50.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ static int stk8ba50_probe(struct i2c_client *client,
data->dready_trig = devm_iio_trigger_alloc(&client->dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!data->dready_trig) {
ret = -ENOMEM;
goto err_power_off;
Expand Down
3 changes: 2 additions & 1 deletion drivers/iio/adc/ad7606.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
}

st->trig = devm_iio_trigger_alloc(dev, "%s-dev%d",
indio_dev->name, indio_dev->id);
indio_dev->name,
iio_device_id(indio_dev));
if (!st->trig)
return -ENOMEM;

Expand Down
3 changes: 2 additions & 1 deletion drivers/iio/adc/ad7766.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ static int ad7766_probe(struct spi_device *spi)

if (spi->irq > 0) {
ad7766->trig = devm_iio_trigger_alloc(&spi->dev, "%s-dev%d",
indio_dev->name, indio_dev->id);
indio_dev->name,
iio_device_id(indio_dev));
if (!ad7766->trig)
return -ENOMEM;

Expand Down
3 changes: 2 additions & 1 deletion drivers/iio/adc/ad7768-1.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,8 @@ static int ad7768_probe(struct spi_device *spi)
}

st->trig = devm_iio_trigger_alloc(&spi->dev, "%s-dev%d",
indio_dev->name, indio_dev->id);
indio_dev->name,
iio_device_id(indio_dev));
if (!st->trig)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/ad_sigma_delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ static int ad_sd_probe_trigger(struct iio_dev *indio_dev)

sigma_delta->trig = iio_trigger_alloc(&sigma_delta->spi->dev,
"%s-dev%d", indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (sigma_delta->trig == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/at91-sama5d2_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ static struct iio_trigger *at91_adc_allocate_trigger(struct iio_dev *indio,
int ret;

trig = devm_iio_trigger_alloc(&indio->dev, "%s-dev%d-%s", indio->name,
indio->id, trigger_name);
iio_device_id(indio), trigger_name);
if (!trig)
return NULL;

Expand Down
4 changes: 2 additions & 2 deletions drivers/iio/adc/at91_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ static int at91_adc_get_trigger_value_by_name(struct iio_dev *idev,
char *name = kasprintf(GFP_KERNEL,
"%s-dev%d-%s",
idev->name,
idev->id,
iio_device_id(idev),
triggers[i].name);
if (!name)
return -ENOMEM;
Expand Down Expand Up @@ -626,7 +626,7 @@ static struct iio_trigger *at91_adc_allocate_trigger(struct iio_dev *idev,
int ret;

trig = iio_trigger_alloc(idev->dev.parent, "%s-dev%d-%s", idev->name,
idev->id, trigger->name);
iio_device_id(idev), trigger->name);
if (trig == NULL)
return NULL;

Expand Down
3 changes: 2 additions & 1 deletion drivers/iio/adc/dln2-adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ static int dln2_adc_probe(struct platform_device *pdev)
indio_dev->setup_ops = &dln2_adc_buffer_setup_ops;

dln2->trig = devm_iio_trigger_alloc(dev, "%s-dev%d",
indio_dev->name, indio_dev->id);
indio_dev->name,
iio_device_id(indio_dev));
if (!dln2->trig) {
dev_err(dev, "failed to allocate trigger\n");
return -ENOMEM;
Expand Down
3 changes: 2 additions & 1 deletion drivers/iio/adc/ina2xx-adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,8 @@ static int ina2xx_buffer_enable(struct iio_dev *indio_dev)
chip->allow_async_readout);

task = kthread_create(ina2xx_capture_thread, (void *)indio_dev,
"%s:%d-%uus", indio_dev->name, indio_dev->id,
"%s:%d-%uus", indio_dev->name,
iio_device_id(indio_dev),
sampling_us);
if (IS_ERR(task))
return PTR_ERR(task);
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/mxs-lradc-adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ static int mxs_lradc_adc_trigger_init(struct iio_dev *iio)
struct mxs_lradc_adc *adc = iio_priv(iio);

trig = devm_iio_trigger_alloc(&iio->dev, "%s-dev%i", iio->name,
iio->id);
iio_device_id(iio));
if (!trig)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/ti-ads131e08.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ static int ads131e08_probe(struct spi_device *spi)
}

st->trig = devm_iio_trigger_alloc(&spi->dev, "%s-dev%d",
indio_dev->name, indio_dev->id);
indio_dev->name, iio_device_id(indio_dev));
if (!st->trig) {
dev_err(&spi->dev, "failed to allocate IIO trigger\n");
return -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/xilinx-xadc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ static struct iio_trigger *xadc_alloc_trigger(struct iio_dev *indio_dev,
int ret;

trig = devm_iio_trigger_alloc(dev, "%s%d-%s", indio_dev->name,
indio_dev->id, name);
iio_device_id(indio_dev), name);
if (trig == NULL)
return ERR_PTR(-ENOMEM);

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/buffer/industrialio-triggered-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev,
indio_dev,
"%s_consumer%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_kfifo_free;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/chemical/atlas-sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ static int atlas_probe(struct i2c_client *client,
indio_dev->modes = INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE;

trig = devm_iio_trigger_alloc(&client->dev, "%s-dev%d",
indio_dev->name, indio_dev->id);
indio_dev->name, iio_device_id(indio_dev));

if (!trig)
return -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/chemical/ccs811.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ static int ccs811_probe(struct i2c_client *client,
data->drdy_trig = devm_iio_trigger_alloc(&client->dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!data->drdy_trig) {
ret = -ENOMEM;
goto err_poweroff;
Expand Down
3 changes: 2 additions & 1 deletion drivers/iio/chemical/scd30_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ static int scd30_setup_trigger(struct iio_dev *indio_dev)
struct iio_trigger *trig;
int ret;

trig = devm_iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name, indio_dev->id);
trig = devm_iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name,
iio_device_id(indio_dev));
if (!trig) {
dev_err(dev, "failed to allocate trigger\n");
return -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/common/hid-sensors/hid-sensor-trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name,
}

trig = iio_trigger_alloc(indio_dev->dev.parent,
"%s-dev%d", name, indio_dev->id);
"%s-dev%d", name, iio_device_id(indio_dev));
if (trig == NULL) {
dev_err(&indio_dev->dev, "Trigger Allocate Failed\n");
ret = -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/gyro/adxrs290.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ static int adxrs290_probe_trigger(struct iio_dev *indio_dev)

st->dready_trig = devm_iio_trigger_alloc(&st->spi->dev, "%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!st->dready_trig)
return -ENOMEM;

Expand Down
4 changes: 2 additions & 2 deletions drivers/iio/gyro/bmg160_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1137,14 +1137,14 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
data->dready_trig = devm_iio_trigger_alloc(dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!data->dready_trig)
return -ENOMEM;

data->motion_trig = devm_iio_trigger_alloc(dev,
"%s-any-motion-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!data->motion_trig)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/gyro/fxas21002c_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ static int fxas21002c_trigger_probe(struct fxas21002c_data *data)

data->dready_trig = devm_iio_trigger_alloc(dev, "%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!data->dready_trig)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/gyro/itg3200_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int itg3200_probe_trigger(struct iio_dev *indio_dev)
struct itg3200 *st = iio_priv(indio_dev);

st->trig = iio_trigger_alloc(&st->i2c->dev, "%s-dev%d", indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!st->trig)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/gyro/mpu3050-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ static int mpu3050_trigger_probe(struct iio_dev *indio_dev, int irq)
mpu3050->trig = devm_iio_trigger_alloc(&indio_dev->dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!mpu3050->trig)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/health/afe4403.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ static int afe4403_probe(struct spi_device *spi)
afe->trig = devm_iio_trigger_alloc(afe->dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!afe->trig) {
dev_err(afe->dev, "Unable to allocate IIO trigger\n");
ret = -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/health/afe4404.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ static int afe4404_probe(struct i2c_client *client,
afe->trig = devm_iio_trigger_alloc(afe->dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!afe->trig) {
dev_err(afe->dev, "Unable to allocate IIO trigger\n");
ret = -ENOMEM;
Expand Down
3 changes: 2 additions & 1 deletion drivers/iio/imu/adis_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ int devm_adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
int ret;

adis->trig = devm_iio_trigger_alloc(&adis->spi->dev, "%s-dev%d",
indio_dev->name, indio_dev->id);
indio_dev->name,
iio_device_id(indio_dev));
if (!adis->trig)
return -ENOMEM;

Expand Down
3 changes: 2 additions & 1 deletion drivers/iio/imu/bmi160/bmi160_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,8 @@ int bmi160_probe_trigger(struct iio_dev *indio_dev, int irq, u32 irq_type)
int ret;

data->trig = devm_iio_trigger_alloc(&indio_dev->dev, "%s-dev%d",
indio_dev->name, indio_dev->id);
indio_dev->name,
iio_device_id(indio_dev));

if (data->trig == NULL)
return -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev, int irq_type)
st->trig = devm_iio_trigger_alloc(&indio_dev->dev,
"%s-dev%d",
indio_dev->name,
indio_dev->id);
iio_device_id(indio_dev));
if (!st->trig)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/imu/kmx61.c
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ static struct iio_trigger *kmx61_trigger_setup(struct kmx61_data *data,
"%s-%s-dev%d",
indio_dev->name,
tag,
indio_dev->id);
iio_device_id(indio_dev));
if (!trig)
return ERR_PTR(-ENOMEM);

Expand Down
Loading

0 comments on commit 15ea287

Please sign in to comment.