staging:iio: Add ability to allocate private data space to iio_allocate_device
Suggested by Arnd Bergmann. Note this will break ALL drivers that are out of mainline. The fix is trivial change of iio_allocate_device() -> iio_allocate_device(0) Sorry if this causes issues for any one! V2: Include new drivers in the update Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
b428173316
commit
6f7c8ee585
|
@ -8,7 +8,7 @@ The crucial structure for device drivers in iio is iio_dev.
|
|||
|
||||
First allocate one using:
|
||||
|
||||
struct iio_dev *indio_dev = iio_allocate_device();
|
||||
struct iio_dev *indio_dev = iio_allocate_device(0);
|
||||
|
||||
Then fill in the following:
|
||||
|
||||
|
|
|
@ -539,7 +539,7 @@ static int __devinit adis16201_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -448,7 +448,7 @@ static int __devinit adis16203_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -493,7 +493,7 @@ static int __devinit adis16204_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -488,7 +488,7 @@ static int __devinit adis16209_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -572,7 +572,7 @@ static int __devinit adis16220_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -485,7 +485,7 @@ static int __devinit adis16240_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -329,7 +329,7 @@ static int __devinit kxsd9_probe(struct spi_device *spi)
|
|||
|
||||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -805,7 +805,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->help.indio_dev = iio_allocate_device();
|
||||
st->help.indio_dev = iio_allocate_device(0);
|
||||
if (st->help.indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -1339,7 +1339,7 @@ static int __devinit __sca3000_probe(struct spi_device *spi,
|
|||
mutex_init(&st->lock);
|
||||
st->info = &sca3000_spi_chip_info_tbl[variant];
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_rx;
|
||||
|
|
|
@ -778,7 +778,7 @@ static int __devinit ad7150_probe(struct i2c_client *client,
|
|||
chip->client = client;
|
||||
chip->name = id->name;
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (chip->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_chip;
|
||||
|
|
|
@ -533,7 +533,7 @@ static int __devinit ad7152_probe(struct i2c_client *client,
|
|||
chip->client = client;
|
||||
chip->name = id->name;
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (chip->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_chip;
|
||||
|
|
|
@ -926,7 +926,7 @@ static int __devinit ad7291_probe(struct i2c_client *client,
|
|||
chip->name = id->name;
|
||||
chip->command = AD7291_NOISE_DELAY | AD7291_T_SENSE_MASK;
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (chip->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_chip;
|
||||
|
|
|
@ -173,7 +173,7 @@ static int __devinit ad7298_probe(struct spi_device *spi)
|
|||
atomic_set(&st->protect_ring, 0);
|
||||
st->spi = spi;
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -229,7 +229,7 @@ static int __devinit ad7314_probe(struct spi_device *spi_dev)
|
|||
chip->spi_dev = spi_dev;
|
||||
chip->name = spi_dev->modalias;
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (chip->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_chip;
|
||||
|
|
|
@ -184,7 +184,7 @@ static int __devinit ad7476_probe(struct spi_device *spi)
|
|||
atomic_set(&st->protect_ring, 0);
|
||||
st->spi = spi;
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -447,7 +447,7 @@ struct ad7606_state *ad7606_probe(struct device *dev, int irq,
|
|||
|
||||
atomic_set(&st->protect_ring, 0);
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -635,7 +635,7 @@ static int __devinit ad774x_probe(struct i2c_client *client,
|
|||
chip->client = client;
|
||||
chip->name = id->name;
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (chip->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_chip;
|
||||
|
|
|
@ -221,7 +221,7 @@ static int __devinit ad7780_probe(struct spi_device *spi)
|
|||
spi_set_drvdata(spi, st);
|
||||
st->spi = spi;
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -418,7 +418,7 @@ static int __devinit ad7816_probe(struct spi_device *spi_dev)
|
|||
}
|
||||
gpio_direction_input(chip->busy_pin);
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (chip->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_gpio;
|
||||
|
|
|
@ -153,7 +153,7 @@ static int __devinit ad7887_probe(struct spi_device *spi)
|
|||
atomic_set(&st->protect_ring, 0);
|
||||
st->spi = spi;
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -801,7 +801,7 @@ static int __devinit ad799x_probe(struct i2c_client *client,
|
|||
}
|
||||
st->client = client;
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -794,7 +794,7 @@ static int __devinit adt7310_probe(struct spi_device *spi_dev)
|
|||
chip->spi_dev = spi_dev;
|
||||
chip->name = spi_dev->modalias;
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (chip->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_chip;
|
||||
|
|
|
@ -764,7 +764,7 @@ static int __devinit adt7410_probe(struct i2c_client *client,
|
|||
chip->client = client;
|
||||
chip->name = id->name;
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (chip->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_chip;
|
||||
|
|
|
@ -614,7 +614,7 @@ static int __devinit adt75_probe(struct i2c_client *client,
|
|||
chip->client = client;
|
||||
chip->name = id->name;
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (chip->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_chip;
|
||||
|
|
|
@ -1695,7 +1695,7 @@ static int __devinit max1363_probe(struct i2c_client *client,
|
|||
}
|
||||
st->client = client;
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -2299,7 +2299,7 @@ int __devinit adt7316_probe(struct device *dev, struct adt7316_bus *bus,
|
|||
if ((chip->id & ID_FAMILY_MASK) == ID_ADT75XX)
|
||||
chip->int_mask |= ADT7516_AIN_INT_MASK;
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (chip->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_chip;
|
||||
|
|
|
@ -373,7 +373,7 @@ static int __devinit ad5446_probe(struct spi_device *spi)
|
|||
|
||||
st->spi = spi;
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -321,7 +321,7 @@ static int __devinit ad5504_probe(struct spi_device *spi)
|
|||
dev_warn(&spi->dev, "reference voltage unspecified\n");
|
||||
|
||||
st->spi = spi;
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -260,7 +260,7 @@ static int __devinit ad5624r_probe(struct spi_device *spi)
|
|||
st->vref_mv = st->chip_info->int_vref_mv;
|
||||
|
||||
st->us = spi;
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -326,7 +326,7 @@ static int __devinit ad5791_probe(struct spi_device *spi)
|
|||
st->pwr_down = true;
|
||||
|
||||
st->spi = spi;
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg_neg;
|
||||
|
|
|
@ -206,7 +206,7 @@ static int max517_probe(struct i2c_client *client,
|
|||
|
||||
data->client = client;
|
||||
|
||||
data->indio_dev = iio_allocate_device();
|
||||
data->indio_dev = iio_allocate_device(0);
|
||||
if (data->indio_dev == NULL) {
|
||||
err = -ENOMEM;
|
||||
goto exit_free_data;
|
||||
|
|
|
@ -102,7 +102,7 @@ static int __devinit ad5930_probe(struct spi_device *spi)
|
|||
mutex_init(&st->lock);
|
||||
st->sdev = spi;
|
||||
|
||||
st->idev = iio_allocate_device();
|
||||
st->idev = iio_allocate_device(0);
|
||||
if (st->idev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
|
@ -236,7 +236,7 @@ static int __devinit ad9832_probe(struct spi_device *spi)
|
|||
spi_set_drvdata(spi, st);
|
||||
st->spi = spi;
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -349,7 +349,7 @@ static int __devinit ad9834_probe(struct spi_device *spi)
|
|||
st->spi = spi;
|
||||
st->devid = spi_get_device_id(spi)->driver_data;
|
||||
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_disable_reg;
|
||||
|
|
|
@ -88,7 +88,7 @@ static int __devinit ad9850_probe(struct spi_device *spi)
|
|||
mutex_init(&st->lock);
|
||||
st->sdev = spi;
|
||||
|
||||
st->idev = iio_allocate_device();
|
||||
st->idev = iio_allocate_device(0);
|
||||
if (st->idev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
|
@ -237,7 +237,7 @@ static int __devinit ad9852_probe(struct spi_device *spi)
|
|||
mutex_init(&st->lock);
|
||||
st->sdev = spi;
|
||||
|
||||
st->idev = iio_allocate_device();
|
||||
st->idev = iio_allocate_device(0);
|
||||
if (st->idev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
|
@ -372,7 +372,7 @@ static int __devinit ad9910_probe(struct spi_device *spi)
|
|||
mutex_init(&st->lock);
|
||||
st->sdev = spi;
|
||||
|
||||
st->idev = iio_allocate_device();
|
||||
st->idev = iio_allocate_device(0);
|
||||
if (st->idev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
|
@ -181,7 +181,7 @@ static int __devinit ad9951_probe(struct spi_device *spi)
|
|||
mutex_init(&st->lock);
|
||||
st->sdev = spi;
|
||||
|
||||
st->idev = iio_allocate_device();
|
||||
st->idev = iio_allocate_device(0);
|
||||
if (st->idev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
|
@ -147,7 +147,7 @@ static int __devinit adis16060_r_probe(struct spi_device *spi)
|
|||
st->us_r = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
|
@ -140,7 +140,7 @@ static int __devinit adis16080_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
|
@ -191,7 +191,7 @@ static int __devinit adis16130_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
|
@ -596,7 +596,7 @@ static int __devinit adis16260_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -369,7 +369,7 @@ static int __devinit adxrs450_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -264,10 +264,25 @@ static inline void *iio_dev_get_devdata(struct iio_dev *d)
|
|||
return d->dev_data;
|
||||
}
|
||||
|
||||
|
||||
/* Can we make this smaller? */
|
||||
#define IIO_ALIGN L1_CACHE_BYTES
|
||||
/**
|
||||
* iio_allocate_device() - allocate an iio_dev from a driver
|
||||
* @sizeof_priv: Space to allocate for private structure.
|
||||
**/
|
||||
struct iio_dev *iio_allocate_device(void);
|
||||
struct iio_dev *iio_allocate_device(int sizeof_priv);
|
||||
|
||||
static inline void *iio_priv(const struct iio_dev *dev)
|
||||
{
|
||||
return (char *)dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
|
||||
}
|
||||
|
||||
static inline struct iio_dev *iio_priv_to_dev(void *priv)
|
||||
{
|
||||
return (struct iio_dev *)((char *)priv -
|
||||
ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
|
||||
}
|
||||
|
||||
/**
|
||||
* iio_free_device() - free an iio_dev from a driver
|
||||
|
|
|
@ -628,7 +628,7 @@ static int __devinit adis16300_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -617,7 +617,7 @@ static int __devinit adis16350_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -622,7 +622,7 @@ static int __devinit adis16400_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -720,9 +720,20 @@ static struct device_type iio_dev_type = {
|
|||
.release = iio_dev_release,
|
||||
};
|
||||
|
||||
struct iio_dev *iio_allocate_device(void)
|
||||
struct iio_dev *iio_allocate_device(int sizeof_priv)
|
||||
{
|
||||
struct iio_dev *dev = kzalloc(sizeof *dev, GFP_KERNEL);
|
||||
struct iio_dev *dev;
|
||||
size_t alloc_size;
|
||||
|
||||
alloc_size = sizeof(struct iio_dev);
|
||||
if (sizeof_priv) {
|
||||
alloc_size = ALIGN(alloc_size, IIO_ALIGN);
|
||||
alloc_size += sizeof_priv;
|
||||
}
|
||||
/* ensure 32-byte alignment of whole construct ? */
|
||||
alloc_size += IIO_ALIGN - 1;
|
||||
|
||||
dev = kzalloc(alloc_size, GFP_KERNEL);
|
||||
|
||||
if (dev) {
|
||||
dev->dev.type = &iio_dev_type;
|
||||
|
|
|
@ -492,7 +492,7 @@ static int __devinit isl29018_probe(struct i2c_client *client,
|
|||
if (err)
|
||||
goto exit_free;
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (!chip->indio_dev) {
|
||||
dev_err(&client->dev, "iio allocation fails\n");
|
||||
goto exit_free;
|
||||
|
|
|
@ -857,7 +857,7 @@ static int __devinit tsl2563_probe(struct i2c_client *client,
|
|||
|
||||
dev_info(&client->dev, "model %d, rev. %d\n", id >> 4, id & 0x0f);
|
||||
|
||||
chip->indio_dev = iio_allocate_device();
|
||||
chip->indio_dev = iio_allocate_device(0);
|
||||
if (!chip->indio_dev)
|
||||
goto fail1;
|
||||
chip->indio_dev->attrs = &tsl2563_group;
|
||||
|
|
|
@ -847,7 +847,7 @@ static int __devinit taos_probe(struct i2c_client *clientp,
|
|||
goto fail1;
|
||||
}
|
||||
|
||||
chip->iio_dev = iio_allocate_device();
|
||||
chip->iio_dev = iio_allocate_device(0);
|
||||
if (!chip->iio_dev) {
|
||||
ret = -ENOMEM;
|
||||
dev_err(&clientp->dev, "iio allocation failed\n");
|
||||
|
|
|
@ -526,7 +526,7 @@ static int ak8975_probe(struct i2c_client *client,
|
|||
}
|
||||
|
||||
/* Register with IIO */
|
||||
data->indio_dev = iio_allocate_device();
|
||||
data->indio_dev = iio_allocate_device(0);
|
||||
if (data->indio_dev == NULL) {
|
||||
err = -ENOMEM;
|
||||
goto exit_gpio;
|
||||
|
|
|
@ -552,7 +552,7 @@ static int hmc5843_probe(struct i2c_client *client,
|
|||
/* Initialize the HMC5843 chip */
|
||||
hmc5843_init_client(client);
|
||||
|
||||
data->indio_dev = iio_allocate_device();
|
||||
data->indio_dev = iio_allocate_device(0);
|
||||
if (!data->indio_dev) {
|
||||
err = -ENOMEM;
|
||||
goto exit_free1;
|
||||
|
|
|
@ -532,7 +532,7 @@ static int __devinit ade7753_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -557,7 +557,7 @@ static int __devinit ade7754_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -737,7 +737,7 @@ static int __devinit ade7758_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -478,7 +478,7 @@ static int __devinit ade7759_probe(struct spi_device *spi)
|
|||
st->us = spi;
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -568,7 +568,7 @@ int ade7854_probe(struct ade7854_state *st, struct device *dev)
|
|||
}
|
||||
mutex_init(&st->buf_lock);
|
||||
/* setup the industrialio driver allocated elements */
|
||||
st->indio_dev = iio_allocate_device();
|
||||
st->indio_dev = iio_allocate_device(0);
|
||||
if (st->indio_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_tx;
|
||||
|
|
|
@ -240,7 +240,7 @@ static int __devinit ad2s120x_probe(struct spi_device *spi)
|
|||
st->sample = pins[0];
|
||||
st->rdvel = pins[1];
|
||||
|
||||
st->idev = iio_allocate_device();
|
||||
st->idev = iio_allocate_device(0);
|
||||
if (st->idev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
|
@ -800,7 +800,7 @@ static int __devinit ad2s1210_probe(struct spi_device *spi)
|
|||
st->res0 = pins[3];
|
||||
st->res1 = pins[4];
|
||||
|
||||
st->idev = iio_allocate_device();
|
||||
st->idev = iio_allocate_device(0);
|
||||
if (st->idev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
|
@ -90,7 +90,7 @@ static int __devinit ad2s90_probe(struct spi_device *spi)
|
|||
mutex_init(&st->lock);
|
||||
st->sdev = spi;
|
||||
|
||||
st->idev = iio_allocate_device();
|
||||
st->idev = iio_allocate_device(0);
|
||||
if (st->idev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto error_free_st;
|
||||
|
|
Loading…
Reference in New Issue