iio: core: move @id from struct iio_dev to struct iio_dev_opaque
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 <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20210426174911.397061-2-jic23@kernel.org
This commit is contained in:
parent
e6cc8f2b76
commit
15ea2878bf
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -169,6 +169,20 @@ static const char * const iio_chan_info_postfix[] = {
|
|||
[IIO_CHAN_INFO_THERMOCOUPLE_TYPE] = "thermocouple_type",
|
||||
[IIO_CHAN_INFO_CALIBAMBIENT] = "calibambient",
|
||||
};
|
||||
/**
|
||||
* iio_device_id() - query the unique ID for the device
|
||||
* @indio_dev: Device structure whose ID is being queried
|
||||
*
|
||||
* The IIO device ID is a unique index used for example for the naming
|
||||
* of the character device /dev/iio\:device[ID]
|
||||
*/
|
||||
int iio_device_id(struct iio_dev *indio_dev)
|
||||
{
|
||||
struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
|
||||
|
||||
return iio_dev_opaque->id;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(iio_device_id);
|
||||
|
||||
/**
|
||||
* iio_sysfs_match_string_with_gaps - matches given string in an array with gaps
|
||||
|
@ -1588,7 +1602,7 @@ static void iio_dev_release(struct device *device)
|
|||
|
||||
iio_device_detach_buffers(indio_dev);
|
||||
|
||||
ida_simple_remove(&iio_ida, indio_dev->id);
|
||||
ida_simple_remove(&iio_ida, iio_dev_opaque->id);
|
||||
kfree(iio_dev_opaque);
|
||||
}
|
||||
|
||||
|
@ -1631,14 +1645,14 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
|
|||
mutex_init(&indio_dev->info_exist_lock);
|
||||
INIT_LIST_HEAD(&iio_dev_opaque->channel_attr_list);
|
||||
|
||||
indio_dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL);
|
||||
if (indio_dev->id < 0) {
|
||||
iio_dev_opaque->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL);
|
||||
if (iio_dev_opaque->id < 0) {
|
||||
/* cannot use a dev_err as the name isn't available */
|
||||
pr_err("failed to get device id\n");
|
||||
kfree(iio_dev_opaque);
|
||||
return NULL;
|
||||
}
|
||||
dev_set_name(&indio_dev->dev, "iio:device%d", indio_dev->id);
|
||||
dev_set_name(&indio_dev->dev, "iio:device%d", iio_dev_opaque->id);
|
||||
INIT_LIST_HEAD(&iio_dev_opaque->buffer_list);
|
||||
INIT_LIST_HEAD(&iio_dev_opaque->ioctl_handlers);
|
||||
|
||||
|
@ -1891,7 +1905,7 @@ int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
|
|||
cdev_init(&indio_dev->chrdev, &iio_event_fileops);
|
||||
|
||||
if (iio_dev_opaque->attached_buffers_cnt || iio_dev_opaque->event_interface) {
|
||||
indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), indio_dev->id);
|
||||
indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), iio_dev_opaque->id);
|
||||
indio_dev->chrdev.owner = this_mod;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ int iio_triggered_event_setup(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_event == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -204,7 +204,8 @@ static int acpi_als_add(struct acpi_device *device)
|
|||
indio_dev->channels = acpi_als_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(acpi_als_channels);
|
||||
|
||||
als->trig = devm_iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name, indio_dev->id);
|
||||
als->trig = devm_iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name,
|
||||
iio_device_id(indio_dev));
|
||||
if (!als->trig)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -985,7 +985,7 @@ static int rpr0521_probe(struct i2c_client *client,
|
|||
/* Trigger0 producer setup */
|
||||
data->drdy_trigger0 = devm_iio_trigger_alloc(
|
||||
indio_dev->dev.parent,
|
||||
"%s-dev%d", indio_dev->name, indio_dev->id);
|
||||
"%s-dev%d", indio_dev->name, iio_device_id(indio_dev));
|
||||
if (!data->drdy_trigger0) {
|
||||
ret = -ENOMEM;
|
||||
goto err_pm_disable;
|
||||
|
|
|
@ -1243,7 +1243,7 @@ static int si1145_probe_trigger(struct iio_dev *indio_dev)
|
|||
int ret;
|
||||
|
||||
trig = devm_iio_trigger_alloc(&client->dev,
|
||||
"%s-dev%d", indio_dev->name, indio_dev->id);
|
||||
"%s-dev%d", indio_dev->name, iio_device_id(indio_dev));
|
||||
if (!trig)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -998,7 +998,8 @@ static int vcnl4010_probe_trigger(struct iio_dev *indio_dev)
|
|||
struct iio_trigger *trigger;
|
||||
|
||||
trigger = devm_iio_trigger_alloc(&client->dev, "%s-dev%d",
|
||||
indio_dev->name, indio_dev->id);
|
||||
indio_dev->name,
|
||||
iio_device_id(indio_dev));
|
||||
if (!trigger)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ static int vcnl4035_probe_trigger(struct iio_dev *indio_dev)
|
|||
|
||||
data->drdy_trigger0 = devm_iio_trigger_alloc(
|
||||
indio_dev->dev.parent,
|
||||
"%s-dev%d", indio_dev->name, indio_dev->id);
|
||||
"%s-dev%d", indio_dev->name, iio_device_id(indio_dev));
|
||||
if (!data->drdy_trigger0)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -915,7 +915,7 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap,
|
|||
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) {
|
||||
ret = -ENOMEM;
|
||||
dev_err(dev, "iio trigger alloc failed\n");
|
||||
|
|
|
@ -575,7 +575,7 @@ int rm3100_common_probe(struct device *dev, struct regmap *regmap, int irq)
|
|||
|
||||
data->drdy_trig = devm_iio_trigger_alloc(dev, "%s-drdy%d",
|
||||
indio_dev->name,
|
||||
indio_dev->id);
|
||||
iio_device_id(indio_dev));
|
||||
if (!data->drdy_trig)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -323,7 +323,8 @@ static int lmp91000_probe(struct i2c_client *client,
|
|||
}
|
||||
|
||||
data->trig = devm_iio_trigger_alloc(dev, "%s-mux%d",
|
||||
indio_dev->name, indio_dev->id);
|
||||
indio_dev->name,
|
||||
iio_device_id(indio_dev));
|
||||
if (!data->trig) {
|
||||
dev_err(dev, "cannot allocate iio trigger.\n");
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -1408,7 +1408,8 @@ static int zpa2326_init_managed_trigger(struct device *parent,
|
|||
return 0;
|
||||
|
||||
trigger = devm_iio_trigger_alloc(parent, "%s-dev%d",
|
||||
indio_dev->name, indio_dev->id);
|
||||
indio_dev->name,
|
||||
iio_device_id(indio_dev));
|
||||
if (!trigger)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -404,7 +404,8 @@ static int as3935_probe(struct spi_device *spi)
|
|||
indio_dev->info = &as3935_info;
|
||||
|
||||
trig = devm_iio_trigger_alloc(dev, "%s-dev%d",
|
||||
indio_dev->name, indio_dev->id);
|
||||
indio_dev->name,
|
||||
iio_device_id(indio_dev));
|
||||
|
||||
if (!trig)
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -1473,7 +1473,7 @@ static int sx9310_probe(struct i2c_client *client)
|
|||
|
||||
data->trig = devm_iio_trigger_alloc(dev, "%s-dev%d",
|
||||
indio_dev->name,
|
||||
indio_dev->id);
|
||||
iio_device_id(indio_dev));
|
||||
if (!data->trig)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -946,7 +946,7 @@ static int sx9500_probe(struct i2c_client *client,
|
|||
return ret;
|
||||
|
||||
data->trig = devm_iio_trigger_alloc(&client->dev,
|
||||
"%s-dev%d", indio_dev->name, indio_dev->id);
|
||||
"%s-dev%d", indio_dev->name, iio_device_id(indio_dev));
|
||||
if (!data->trig)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
/**
|
||||
* struct iio_dev_opaque - industrial I/O device opaque information
|
||||
* @indio_dev: public industrial I/O device information
|
||||
* @id: used to identify device internally
|
||||
* @event_interface: event chrdevs associated with interrupt lines
|
||||
* @attached_buffers: array of buffers statically attached by the driver
|
||||
* @attached_buffers_cnt: number of buffers in the array of statically attached buffers
|
||||
|
@ -26,6 +27,7 @@
|
|||
*/
|
||||
struct iio_dev_opaque {
|
||||
struct iio_dev indio_dev;
|
||||
int id;
|
||||
struct iio_event_interface *event_interface;
|
||||
struct iio_buffer **attached_buffers;
|
||||
unsigned int attached_buffers_cnt;
|
||||
|
|
|
@ -488,7 +488,6 @@ struct iio_buffer_setup_ops {
|
|||
|
||||
/**
|
||||
* struct iio_dev - industrial I/O device
|
||||
* @id: [INTERN] used to identify device internally
|
||||
* @driver_module: [INTERN] used to make it harder to undercut users
|
||||
* @modes: [DRIVER] operating modes supported by device
|
||||
* @currentmode: [DRIVER] current operating mode
|
||||
|
@ -523,7 +522,6 @@ struct iio_buffer_setup_ops {
|
|||
* **MUST** be accessed **ONLY** via iio_priv() helper
|
||||
*/
|
||||
struct iio_dev {
|
||||
int id;
|
||||
struct module *driver_module;
|
||||
|
||||
int modes;
|
||||
|
@ -559,6 +557,8 @@ struct iio_dev {
|
|||
void *priv;
|
||||
};
|
||||
|
||||
int iio_device_id(struct iio_dev *indio_dev);
|
||||
|
||||
const struct iio_chan_spec
|
||||
*iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue