]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
staging:iio: Add ability to allocate private data space to iio_allocate_device
authorJonathan Cameron <jic23@cam.ac.uk>
Fri, 15 Apr 2011 17:55:56 +0000 (18:55 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 26 Apr 2011 00:23:09 +0000 (17:23 -0700)
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>
62 files changed:
drivers/staging/iio/Documentation/device.txt
drivers/staging/iio/accel/adis16201_core.c
drivers/staging/iio/accel/adis16203_core.c
drivers/staging/iio/accel/adis16204_core.c
drivers/staging/iio/accel/adis16209_core.c
drivers/staging/iio/accel/adis16220_core.c
drivers/staging/iio/accel/adis16240_core.c
drivers/staging/iio/accel/kxsd9.c
drivers/staging/iio/accel/lis3l02dq_core.c
drivers/staging/iio/accel/sca3000_core.c
drivers/staging/iio/adc/ad7150.c
drivers/staging/iio/adc/ad7152.c
drivers/staging/iio/adc/ad7291.c
drivers/staging/iio/adc/ad7298_core.c
drivers/staging/iio/adc/ad7314.c
drivers/staging/iio/adc/ad7476_core.c
drivers/staging/iio/adc/ad7606_core.c
drivers/staging/iio/adc/ad7745.c
drivers/staging/iio/adc/ad7780.c
drivers/staging/iio/adc/ad7816.c
drivers/staging/iio/adc/ad7887_core.c
drivers/staging/iio/adc/ad799x_core.c
drivers/staging/iio/adc/adt7310.c
drivers/staging/iio/adc/adt7410.c
drivers/staging/iio/adc/adt75.c
drivers/staging/iio/adc/max1363_core.c
drivers/staging/iio/addac/adt7316.c
drivers/staging/iio/dac/ad5446.c
drivers/staging/iio/dac/ad5504.c
drivers/staging/iio/dac/ad5624r_spi.c
drivers/staging/iio/dac/ad5791.c
drivers/staging/iio/dac/max517.c
drivers/staging/iio/dds/ad5930.c
drivers/staging/iio/dds/ad9832.c
drivers/staging/iio/dds/ad9834.c
drivers/staging/iio/dds/ad9850.c
drivers/staging/iio/dds/ad9852.c
drivers/staging/iio/dds/ad9910.c
drivers/staging/iio/dds/ad9951.c
drivers/staging/iio/gyro/adis16060_core.c
drivers/staging/iio/gyro/adis16080_core.c
drivers/staging/iio/gyro/adis16130_core.c
drivers/staging/iio/gyro/adis16260_core.c
drivers/staging/iio/gyro/adxrs450_core.c
drivers/staging/iio/iio.h
drivers/staging/iio/imu/adis16300_core.c
drivers/staging/iio/imu/adis16350_core.c
drivers/staging/iio/imu/adis16400_core.c
drivers/staging/iio/industrialio-core.c
drivers/staging/iio/light/isl29018.c
drivers/staging/iio/light/tsl2563.c
drivers/staging/iio/light/tsl2583.c
drivers/staging/iio/magnetometer/ak8975.c
drivers/staging/iio/magnetometer/hmc5843.c
drivers/staging/iio/meter/ade7753.c
drivers/staging/iio/meter/ade7754.c
drivers/staging/iio/meter/ade7758_core.c
drivers/staging/iio/meter/ade7759.c
drivers/staging/iio/meter/ade7854.c
drivers/staging/iio/resolver/ad2s120x.c
drivers/staging/iio/resolver/ad2s1210.c
drivers/staging/iio/resolver/ad2s90.c

index 69d9570f29fca10eb33702af17f88bfb6ae0c351..c81e5172aec88c7ceb6224be2f259df2ccae27dc 100644 (file)
@@ -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:
 
index 79b785a0013af4e490ff6f64126ca2b2d124b844..df1101cefc6692f25809065a9d6547944c17f885 100644 (file)
@@ -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;
index b57f19087a93193e712b265ae48e2bd3a3155eb9..e5a2a477b113c088b6d0f7bb73c20dd322897b5f 100644 (file)
@@ -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;
index cc15e40726fc57c033f079757e61665358e2c209..97376aa2fc542f6abb34227c1bc6e1d53e6f6697 100644 (file)
@@ -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;
index e4ac956208a6df33c95fd2c4bbee46bd18a902cf..d2fb9901dd64f575f8d628090912347cde9c421f 100644 (file)
@@ -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;
index 1c1e98aee2d9fdd78aeabeab1d604f344a092367..0689e412ba878524643d370b487534c83ddefa27 100644 (file)
@@ -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;
index d11d164207eee3b222500c3ae05f3e1e6fb4ec3f..31f64ae3bb04acab7308800352b7e6acbf4078e6 100644 (file)
@@ -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;
index 79f57950ebeb00c2613c11370ddbf5856729d4d7..431aa0f886f1e69cafc9999ab8fe32228098a44e 100644 (file)
@@ -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;
index 34f16a7cc3aeee37bbe628671db5ea81ca375bd2..e11388ab457fa586e94f12ffc861f069881cf04f 100644 (file)
@@ -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;
index 5b06dea6af25679b446bfb466325211ffbc9c300..6abf2b7e3067db386dacf4c17e2d1d2027c2b39a 100644 (file)
@@ -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;
index 8555766109d894e1623aaf0177e43fac75b04324..5a2991ac47ed4f975267ecfdeea8212a15785c19 100644 (file)
@@ -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;
index fa7f840623070fb68dab597de791f37e4ed3ef29..163c30767b06e7d18b51a2f77d58fc896a9e18ca 100644 (file)
@@ -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;
index 34041a72aa529d564f958ff1e524fd1d956c8fb8..976ae7f7710644e10883412d74bd35ab49a48a76 100644 (file)
@@ -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;
index 2e9154e7d8873c5ee399e2494c89e61bed4be088..8b3a4904682aaa01ca2c12ad97f18fa411845c73 100644 (file)
@@ -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;
index 8c17b1fe90261b595396832fbdaf674ed8006180..dffbec13632ad94bdd5bb5c1e616b678e6a85311 100644 (file)
@@ -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;
index d263904b3d1dcb8bd38569512868eda8705eb91b..b16744cc5495aa65f09aaca23d59c72e22297369 100644 (file)
@@ -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;
index 4c700f07fb8304f48625e4a61bbca895fa34d44a..7ef9a6f48073dfa6699484f43fcd755d83030c11 100644 (file)
@@ -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;
index ab7ef8450ae2104bd1187dbadbcf68a01d4eddf8..1373d23996be5f9b738bcfcda8f5567ca4c47691 100644 (file)
@@ -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;
index 0fd994fdee46a6d6701e46cc2a89beff5384137a..ab23c5cfdc2213bd361260af03715172ff8328e8 100644 (file)
@@ -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;
index ad7415a6b8d9f160fbd06e95d80b9549e3ccdbe8..9e30d351cf4cc645592849d2923e12ade73a3c52 100644 (file)
@@ -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;
index 5d85efab658cfbac69fb8b3d055f89e7ec88740a..11c9fcfc3d033f9cc6bcfc1c6a59be76cce4bece 100644 (file)
@@ -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;
index f04e642e72723329803bb109bdc4731fbdff6643..09d109ffb39f4764b84771991918eca2a55d3006 100644 (file)
@@ -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;
index 771a409ee94c71771c5dd2e18277f3363385667f..7e66c42a712cfc735fe191c85f6e1823d78705f2 100644 (file)
@@ -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;
index c345f27ec7fc651f47cc09a837dabc92fe4c31f6..7cc3feb0a1727a15d4be3c19a68472648808d2be 100644 (file)
@@ -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;
index aff4d31eb89c688dc9e70ce161d259f28367bb74..f247c4c789f687b108fd892853f896651c2e5939 100644 (file)
@@ -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;
index de83c3b37a2d39001fe844ce5d63033c4724888e..1703b2a74ace3f72e8057089ca8cb4639b35f849 100644 (file)
@@ -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;
index 9b25f1205449fd10ea35e0bb88a50d5c318f66d2..d01cb4c2adbca10a139f6164bb114596bca0054e 100644 (file)
@@ -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;
index 102bcc4e08eb850b597e6b65e0bbd50cb4314d14..fd4fa5497ced49c420959aced900d1c8da941d27 100644 (file)
@@ -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;
index 153c36e7f70ec0a92fe8eff91af35d377ab5f777..28ace3011db5ee6e79753b278c356bd4583c2387 100644 (file)
@@ -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;
index a945b18ff8439997a2d27cebb55363457016c8f6..cfb5828a377f1a1789be52bd5f2d0222a568cc3c 100644 (file)
@@ -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;
index 545f1a6a270412b70c284a3a138247fa0653dc31..c4a258dfa776f19b84e9b877bec0675307e38643 100644 (file)
@@ -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;
index 7071f713604a2ebab231f36d3aa9c9e2636580bc..3eb48b65c15ed6af603c08e0558dceeb360977f1 100644 (file)
@@ -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;
index f80039c5d5390292893a741e4cc09030a169b582..5d98f93ca84ea03ae412edb83d3ad5be3d19327b 100644 (file)
@@ -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;
index 3e8491f60cfed31f43904d65b88bc57936754dc9..9c6114f4976b76e42587856be7a18f9d9c540f75 100644 (file)
@@ -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;
index eb1a681874f94fb994c318c7b3780ceb283246a3..da5e302cf0fd36fb08da0e993477767fc9fcba29 100644 (file)
@@ -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;
index b259bfeaf5aa699ca8cbd393efc814afdbc79996..34bc0e6950d2c8a245c666b76185379d4e8c69d1 100644 (file)
@@ -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;
index 594fb6a94331983afbf86b3a3a1919ee48619b6d..899a72acd8f6015f37c4606214ad904ae3001de9 100644 (file)
@@ -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;
index e8fb75cb66ecce94248b6bfea4b67d81fc6e6681..fddb6e7c7edcdc3b0a65922cf0bca7f3d9747b64 100644 (file)
@@ -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;
index 57eddf6d47137fe720b3cec4898e95a0279a0578..a9e56c6e0fa7895dacf76e82eeefe73772cf963b 100644 (file)
@@ -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;
index ae53e71d1c2f3c35b31a6d5b2779f69b96195750..e1f8a708c63068262a5c529b52ad07cc7c5a0779 100644 (file)
@@ -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;
index ef9e304a226d582ce554003811f373fbf2302ea8..26af63fd7e3461728a80e57062163f9f6d20d64f 100644 (file)
@@ -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;
index 70e2831f8fb84e4a776aa6bc5fdd26ab47154626..02fbe074824e7cb61e6b05f5ecf1b8bf19c1c52f 100644 (file)
@@ -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;
index 69a29ec93101f5aff9075364b4780606b10848db..26e3af473446f44ad448125a5c87c6f089e2f009 100644 (file)
@@ -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;
index d70bf684b7ac5eb028d525c6b12f7a7d5932d9cd..dcd88ff81a9075dd92ef58c9d5abfcc770f395ab 100644 (file)
@@ -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;
index 7127f26f8d267dc816d2ae717d98826aa8378d38..80ef2cfe4bb049856c96a715a965d410a4ef3409 100644 (file)
@@ -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
index 7ad13f4d3d741b1847688e47f744fce5687c9b01..0734d4a7069773f7446bd5a19cec0e69665d2938 100644 (file)
@@ -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;
index cf7176bc766bce19a2b73d584651c542ecd8ad35..208192470eceab08f57ac0805c991a14a516b922 100644 (file)
@@ -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;
index 540bde69cc3b8451c4a4805541542025e5b2759c..a0b53ee887f0c73181f927c31334933e474df651 100644 (file)
@@ -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;
index 1795ee1e8207377a9c987b4b4a6fc83ce0a66af1..3a824146455e3b9b999159c3272c701c5c975ce9 100644 (file)
@@ -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;
index f919cc1d35e1da29507892b01ea0b03293eea8c7..dfbc423a75e4c35ae18dde24bb4c57314ce2d0c3 100644 (file)
@@ -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;
index dadae7527d5c9472437dd5457c3d51b4d7bc4e5b..35d94c6d8d8fafe8be82b3f10c4be4d95f00ede3 100644 (file)
@@ -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;
index 1740843ee12a3542494579d8e39e50f17fad625f..b87ccd5a2f50eeea3fe2e34a951cd893596e12f0 100644 (file)
@@ -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");
index d71904a8370640b6e818319b32d547b96f5b70c5..2226b88882d817c99def399ee0a3f4635fb748c2 100644 (file)
@@ -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;
index 51689177e00e199f96af7ab97c66ca52ae2dacb2..d0676e99f1576b0cb50f9255e731bfdaf57f58a5 100644 (file)
@@ -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;
index 8b86d82c3b32f676c4aa97554abaf3fd94611513..d62d9e2f0d2cd35d2c960dc980280452ba4b8dae 100644 (file)
@@ -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;
index 4272818e7dc447e49ead46a162e759dbe422ca33..2d0b8cc05992c099d2c4d7cbc50f2245c5edb5cc 100644 (file)
@@ -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;
index b7634cb7aa4f37f34cdb8d240b12b4e90ecc6f36..8d37ef7eb9574a97bf1565591f71bcb843d37345 100644 (file)
@@ -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;
index a9d3203b2e1c3d4a320433ad1ffb18dc40f219a3..42b3b27520ce275441d418933c11aa17774f3ab0 100644 (file)
@@ -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;
index 866e585451f0e7d6e62193e1c265f71bce8c6fce..d3f1df71c7f7724e302244ba302fdffa99ff323f 100644 (file)
@@ -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;
index 8f497a23976ccb3048fef908ae839e78f706ef29..e0237ff8105498218dfc2fc786dbc40e172cd261 100644 (file)
@@ -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;
index c12f64cc40df3fbd03d11c787aa256c2b29f75df..dc7cae80cf3a45f8ce2665c1286da0de76a762da 100644 (file)
@@ -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;
index 4143535242d9261e5bf45e6f6bc7ced69dc7b35a..e300adeefa8b28cb806b3e9f57949248d471bb66 100644 (file)
@@ -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;