aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-04-26 07:35:01 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-29 21:23:49 -0400
commit7cbb753701d11f3c71e8543e1ae0fc0772edac06 (patch)
tree53954c72751f1842d8565aff3a1ca1b71826603a
parent5d4a6789d5957a6388ea86c811d7c09bbe5f8ebd (diff)
staging:iio: Streamline API function naming
Currently we use two different naming schemes in the IIO API, iio_verb_object and iio_object_verb. E.g iio_device_register and iio_allocate_device. This patches renames instances of the later to the former. The patch also renames allocate to alloc as this seems to be the preferred form throughout the kernel. In particular the following renames are performed by the patch: iio_put_device -> iio_device_put iio_allocate_device -> iio_device_alloc iio_free_device -> iio_device_free iio_get_trigger -> iio_trigger_get iio_put_trigger -> iio_trigger_put iio_allocate_trigger -> iio_trigger_alloc iio_free_trigger -> iio_trigger_free The conversion was done with the following coccinelle patch with manual fixes to comments and documentation. <smpl> @@ @@ -iio_put_device +iio_device_put @@ @@ -iio_allocate_device +iio_device_alloc @@ @@ -iio_free_device +iio_device_free @@ @@ -iio_get_trigger +iio_trigger_get @@ @@ -iio_put_trigger +iio_trigger_put @@ @@ -iio_allocate_trigger +iio_trigger_alloc @@ @@ -iio_free_trigger +iio_trigger_free </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/iio/industrialio-core.c8
-rw-r--r--drivers/iio/industrialio-trigger.c14
-rw-r--r--drivers/staging/iio/Documentation/device.txt4
-rw-r--r--drivers/staging/iio/Documentation/trigger.txt2
-rw-r--r--drivers/staging/iio/accel/adis16201_core.c6
-rw-r--r--drivers/staging/iio/accel/adis16201_trigger.c6
-rw-r--r--drivers/staging/iio/accel/adis16203_core.c6
-rw-r--r--drivers/staging/iio/accel/adis16203_trigger.c6
-rw-r--r--drivers/staging/iio/accel/adis16204_core.c6
-rw-r--r--drivers/staging/iio/accel/adis16204_trigger.c6
-rw-r--r--drivers/staging/iio/accel/adis16209_core.c6
-rw-r--r--drivers/staging/iio/accel/adis16209_trigger.c6
-rw-r--r--drivers/staging/iio/accel/adis16220_core.c6
-rw-r--r--drivers/staging/iio/accel/adis16240_core.c6
-rw-r--r--drivers/staging/iio/accel/adis16240_trigger.c6
-rw-r--r--drivers/staging/iio/accel/kxsd9.c6
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_core.c6
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_ring.c6
-rw-r--r--drivers/staging/iio/accel/sca3000_core.c6
-rw-r--r--drivers/staging/iio/adc/ad7192.c10
-rw-r--r--drivers/staging/iio/adc/ad7280a.c6
-rw-r--r--drivers/staging/iio/adc/ad7291.c6
-rw-r--r--drivers/staging/iio/adc/ad7298_core.c6
-rw-r--r--drivers/staging/iio/adc/ad7476_core.c6
-rw-r--r--drivers/staging/iio/adc/ad7606_core.c6
-rw-r--r--drivers/staging/iio/adc/ad7780.c6
-rw-r--r--drivers/staging/iio/adc/ad7793.c12
-rw-r--r--drivers/staging/iio/adc/ad7816.c6
-rw-r--r--drivers/staging/iio/adc/ad7887_core.c6
-rw-r--r--drivers/staging/iio/adc/ad799x_core.c6
-rw-r--r--drivers/staging/iio/adc/adt7310.c6
-rw-r--r--drivers/staging/iio/adc/adt7410.c6
-rw-r--r--drivers/staging/iio/adc/lpc32xx_adc.c6
-rw-r--r--drivers/staging/iio/adc/max1363_core.c6
-rw-r--r--drivers/staging/iio/adc/spear_adc.c6
-rw-r--r--drivers/staging/iio/addac/adt7316.c6
-rw-r--r--drivers/staging/iio/cdc/ad7150.c6
-rw-r--r--drivers/staging/iio/cdc/ad7152.c6
-rw-r--r--drivers/staging/iio/cdc/ad7746.c6
-rw-r--r--drivers/staging/iio/dac/ad5064.c6
-rw-r--r--drivers/staging/iio/dac/ad5360.c6
-rw-r--r--drivers/staging/iio/dac/ad5380.c6
-rw-r--r--drivers/staging/iio/dac/ad5421.c6
-rw-r--r--drivers/staging/iio/dac/ad5446.c6
-rw-r--r--drivers/staging/iio/dac/ad5504.c6
-rw-r--r--drivers/staging/iio/dac/ad5624r_spi.c6
-rw-r--r--drivers/staging/iio/dac/ad5686.c6
-rw-r--r--drivers/staging/iio/dac/ad5764.c6
-rw-r--r--drivers/staging/iio/dac/ad5791.c6
-rw-r--r--drivers/staging/iio/dac/max517.c6
-rw-r--r--drivers/staging/iio/dds/ad5930.c6
-rw-r--r--drivers/staging/iio/dds/ad9832.c6
-rw-r--r--drivers/staging/iio/dds/ad9834.c6
-rw-r--r--drivers/staging/iio/dds/ad9850.c6
-rw-r--r--drivers/staging/iio/dds/ad9852.c6
-rw-r--r--drivers/staging/iio/dds/ad9910.c6
-rw-r--r--drivers/staging/iio/dds/ad9951.c6
-rw-r--r--drivers/staging/iio/gyro/adis16060_core.c6
-rw-r--r--drivers/staging/iio/gyro/adis16080_core.c6
-rw-r--r--drivers/staging/iio/gyro/adis16130_core.c6
-rw-r--r--drivers/staging/iio/gyro/adis16260_core.c6
-rw-r--r--drivers/staging/iio/gyro/adis16260_trigger.c6
-rw-r--r--drivers/staging/iio/gyro/adxrs450_core.c6
-rw-r--r--drivers/staging/iio/iio_simple_dummy.c6
-rw-r--r--drivers/staging/iio/impedance-analyzer/ad5933.c6
-rw-r--r--drivers/staging/iio/imu/adis16400_core.c6
-rw-r--r--drivers/staging/iio/imu/adis16400_trigger.c6
-rw-r--r--drivers/staging/iio/light/isl29018.c6
-rw-r--r--drivers/staging/iio/light/isl29028.c6
-rw-r--r--drivers/staging/iio/light/tsl2563.c6
-rw-r--r--drivers/staging/iio/light/tsl2583.c6
-rwxr-xr-xdrivers/staging/iio/light/tsl2x7x_core.c6
-rw-r--r--drivers/staging/iio/magnetometer/ak8975.c6
-rw-r--r--drivers/staging/iio/magnetometer/hmc5843.c6
-rw-r--r--drivers/staging/iio/meter/ade7753.c6
-rw-r--r--drivers/staging/iio/meter/ade7754.c6
-rw-r--r--drivers/staging/iio/meter/ade7758_core.c6
-rw-r--r--drivers/staging/iio/meter/ade7758_trigger.c6
-rw-r--r--drivers/staging/iio/meter/ade7759.c6
-rw-r--r--drivers/staging/iio/meter/ade7854-i2c.c4
-rw-r--r--drivers/staging/iio/meter/ade7854-spi.c4
-rw-r--r--drivers/staging/iio/meter/ade7854.c4
-rw-r--r--drivers/staging/iio/resolver/ad2s1200.c6
-rw-r--r--drivers/staging/iio/resolver/ad2s1210.c6
-rw-r--r--drivers/staging/iio/resolver/ad2s90.c6
-rw-r--r--drivers/staging/iio/trigger/iio-trig-bfin-timer.c6
-rw-r--r--drivers/staging/iio/trigger/iio-trig-gpio.c6
-rw-r--r--drivers/staging/iio/trigger/iio-trig-periodic-rtc.c4
-rw-r--r--drivers/staging/iio/trigger/iio-trig-sysfs.c6
-rw-r--r--include/linux/iio/iio.h12
-rw-r--r--include/linux/iio/trigger.h8
91 files changed, 280 insertions, 280 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index dd1a6a2e81c0..e8e280d64295 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -737,7 +737,7 @@ static struct device_type iio_dev_type = {
737 .release = iio_dev_release, 737 .release = iio_dev_release,
738}; 738};
739 739
740struct iio_dev *iio_allocate_device(int sizeof_priv) 740struct iio_dev *iio_device_alloc(int sizeof_priv)
741{ 741{
742 struct iio_dev *dev; 742 struct iio_dev *dev;
743 size_t alloc_size; 743 size_t alloc_size;
@@ -773,16 +773,16 @@ struct iio_dev *iio_allocate_device(int sizeof_priv)
773 773
774 return dev; 774 return dev;
775} 775}
776EXPORT_SYMBOL(iio_allocate_device); 776EXPORT_SYMBOL(iio_device_alloc);
777 777
778void iio_free_device(struct iio_dev *dev) 778void iio_device_free(struct iio_dev *dev)
779{ 779{
780 if (dev) { 780 if (dev) {
781 ida_simple_remove(&iio_ida, dev->id); 781 ida_simple_remove(&iio_ida, dev->id);
782 kfree(dev); 782 kfree(dev);
783 } 783 }
784} 784}
785EXPORT_SYMBOL(iio_free_device); 785EXPORT_SYMBOL(iio_device_free);
786 786
787/** 787/**
788 * iio_chrdev_open() - chrdev file open for buffer access and ioctls 788 * iio_chrdev_open() - chrdev file open for buffer access and ioctls
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index 03fee2e097ca..1dbd7b86a694 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -360,9 +360,9 @@ static ssize_t iio_trigger_write_current(struct device *dev,
360 indio_dev->trig = trig; 360 indio_dev->trig = trig;
361 361
362 if (oldtrig && indio_dev->trig != oldtrig) 362 if (oldtrig && indio_dev->trig != oldtrig)
363 iio_put_trigger(oldtrig); 363 iio_trigger_put(oldtrig);
364 if (indio_dev->trig) 364 if (indio_dev->trig)
365 iio_get_trigger(indio_dev->trig); 365 iio_trigger_get(indio_dev->trig);
366 366
367 return len; 367 return len;
368} 368}
@@ -426,7 +426,7 @@ static void iio_trig_subirqunmask(struct irq_data *d)
426 trig->subirqs[d->irq - trig->subirq_base].enabled = true; 426 trig->subirqs[d->irq - trig->subirq_base].enabled = true;
427} 427}
428 428
429struct iio_trigger *iio_allocate_trigger(const char *fmt, ...) 429struct iio_trigger *iio_trigger_alloc(const char *fmt, ...)
430{ 430{
431 va_list vargs; 431 va_list vargs;
432 struct iio_trigger *trig; 432 struct iio_trigger *trig;
@@ -472,14 +472,14 @@ struct iio_trigger *iio_allocate_trigger(const char *fmt, ...)
472 } 472 }
473 return trig; 473 return trig;
474} 474}
475EXPORT_SYMBOL(iio_allocate_trigger); 475EXPORT_SYMBOL(iio_trigger_alloc);
476 476
477void iio_free_trigger(struct iio_trigger *trig) 477void iio_trigger_free(struct iio_trigger *trig)
478{ 478{
479 if (trig) 479 if (trig)
480 put_device(&trig->dev); 480 put_device(&trig->dev);
481} 481}
482EXPORT_SYMBOL(iio_free_trigger); 482EXPORT_SYMBOL(iio_trigger_free);
483 483
484void iio_device_register_trigger_consumer(struct iio_dev *indio_dev) 484void iio_device_register_trigger_consumer(struct iio_dev *indio_dev)
485{ 485{
@@ -491,7 +491,7 @@ void iio_device_unregister_trigger_consumer(struct iio_dev *indio_dev)
491{ 491{
492 /* Clean up and associated but not attached triggers references */ 492 /* Clean up and associated but not attached triggers references */
493 if (indio_dev->trig) 493 if (indio_dev->trig)
494 iio_put_trigger(indio_dev->trig); 494 iio_trigger_put(indio_dev->trig);
495} 495}
496 496
497int iio_triggered_buffer_postenable(struct iio_dev *indio_dev) 497int iio_triggered_buffer_postenable(struct iio_dev *indio_dev)
diff --git a/drivers/staging/iio/Documentation/device.txt b/drivers/staging/iio/Documentation/device.txt
index 8926f2448cc9..0338c7cd0a8b 100644
--- a/drivers/staging/iio/Documentation/device.txt
+++ b/drivers/staging/iio/Documentation/device.txt
@@ -8,7 +8,7 @@ The crucial structure for device drivers in iio is iio_dev.
8 8
9First allocate one using: 9First allocate one using:
10 10
11struct iio_dev *indio_dev = iio_allocate_device(sizeof(struct chip_state)); 11struct iio_dev *indio_dev = iio_device_alloc(sizeof(struct chip_state));
12where chip_state is a structure of local state data for this instance of 12where chip_state is a structure of local state data for this instance of
13the chip. 13the chip.
14 14
@@ -78,4 +78,4 @@ be registered afterwards (otherwise the whole parentage of devices
78gets confused) 78gets confused)
79 79
80On remove, iio_device_unregister(indio_dev) will remove the device from 80On remove, iio_device_unregister(indio_dev) will remove the device from
81the core, and iio_free_device will clean up. 81the core, and iio_device_free will clean up.
diff --git a/drivers/staging/iio/Documentation/trigger.txt b/drivers/staging/iio/Documentation/trigger.txt
index fc2012ebc100..75cc37ff1ed0 100644
--- a/drivers/staging/iio/Documentation/trigger.txt
+++ b/drivers/staging/iio/Documentation/trigger.txt
@@ -5,7 +5,7 @@ an IIO device. Whilst this can create device specific complexities
5such triggers are registered with the core in the same way as 5such triggers are registered with the core in the same way as
6stand-alone triggers. 6stand-alone triggers.
7 7
8struct iio_trig *trig = iio_allocate_trigger("<trigger format string>", ...); 8struct iio_trig *trig = iio_trigger_alloc("<trigger format string>", ...);
9 9
10allocates a trigger structure. The key elements to then fill in within 10allocates a trigger structure. The key elements to then fill in within
11a driver are: 11a driver are:
diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c
index 9dce7b8d38a5..62667803c5a7 100644
--- a/drivers/staging/iio/accel/adis16201_core.c
+++ b/drivers/staging/iio/accel/adis16201_core.c
@@ -532,7 +532,7 @@ static int __devinit adis16201_probe(struct spi_device *spi)
532 struct iio_dev *indio_dev; 532 struct iio_dev *indio_dev;
533 533
534 /* setup the industrialio driver allocated elements */ 534 /* setup the industrialio driver allocated elements */
535 indio_dev = iio_allocate_device(sizeof(*st)); 535 indio_dev = iio_device_alloc(sizeof(*st));
536 if (indio_dev == NULL) { 536 if (indio_dev == NULL) {
537 ret = -ENOMEM; 537 ret = -ENOMEM;
538 goto error_ret; 538 goto error_ret;
@@ -587,7 +587,7 @@ error_uninitialize_ring:
587error_unreg_ring_funcs: 587error_unreg_ring_funcs:
588 adis16201_unconfigure_ring(indio_dev); 588 adis16201_unconfigure_ring(indio_dev);
589error_free_dev: 589error_free_dev:
590 iio_free_device(indio_dev); 590 iio_device_free(indio_dev);
591error_ret: 591error_ret:
592 return ret; 592 return ret;
593} 593}
@@ -600,7 +600,7 @@ static int adis16201_remove(struct spi_device *spi)
600 adis16201_remove_trigger(indio_dev); 600 adis16201_remove_trigger(indio_dev);
601 iio_buffer_unregister(indio_dev); 601 iio_buffer_unregister(indio_dev);
602 adis16201_unconfigure_ring(indio_dev); 602 adis16201_unconfigure_ring(indio_dev);
603 iio_free_device(indio_dev); 603 iio_device_free(indio_dev);
604 604
605 return 0; 605 return 0;
606} 606}
diff --git a/drivers/staging/iio/accel/adis16201_trigger.c b/drivers/staging/iio/accel/adis16201_trigger.c
index da687e01cc45..96fdabbac201 100644
--- a/drivers/staging/iio/accel/adis16201_trigger.c
+++ b/drivers/staging/iio/accel/adis16201_trigger.c
@@ -29,7 +29,7 @@ int adis16201_probe_trigger(struct iio_dev *indio_dev)
29 int ret; 29 int ret;
30 struct adis16201_state *st = iio_priv(indio_dev); 30 struct adis16201_state *st = iio_priv(indio_dev);
31 31
32 st->trig = iio_allocate_trigger("adis16201-dev%d", indio_dev->id); 32 st->trig = iio_trigger_alloc("adis16201-dev%d", indio_dev->id);
33 if (st->trig == NULL) { 33 if (st->trig == NULL) {
34 ret = -ENOMEM; 34 ret = -ENOMEM;
35 goto error_ret; 35 goto error_ret;
@@ -56,7 +56,7 @@ int adis16201_probe_trigger(struct iio_dev *indio_dev)
56error_free_irq: 56error_free_irq:
57 free_irq(st->us->irq, st->trig); 57 free_irq(st->us->irq, st->trig);
58error_free_trig: 58error_free_trig:
59 iio_free_trigger(st->trig); 59 iio_trigger_free(st->trig);
60error_ret: 60error_ret:
61 return ret; 61 return ret;
62} 62}
@@ -67,5 +67,5 @@ void adis16201_remove_trigger(struct iio_dev *indio_dev)
67 67
68 iio_trigger_unregister(state->trig); 68 iio_trigger_unregister(state->trig);
69 free_irq(state->us->irq, state->trig); 69 free_irq(state->us->irq, state->trig);
70 iio_free_trigger(state->trig); 70 iio_trigger_free(state->trig);
71} 71}
diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c
index cf1a0e565673..42d7eea06d1a 100644
--- a/drivers/staging/iio/accel/adis16203_core.c
+++ b/drivers/staging/iio/accel/adis16203_core.c
@@ -469,7 +469,7 @@ static int __devinit adis16203_probe(struct spi_device *spi)
469 struct adis16203_state *st; 469 struct adis16203_state *st;
470 470
471 /* setup the industrialio driver allocated elements */ 471 /* setup the industrialio driver allocated elements */
472 indio_dev = iio_allocate_device(sizeof(*st)); 472 indio_dev = iio_device_alloc(sizeof(*st));
473 if (indio_dev == NULL) { 473 if (indio_dev == NULL) {
474 ret = -ENOMEM; 474 ret = -ENOMEM;
475 goto error_ret; 475 goto error_ret;
@@ -523,7 +523,7 @@ error_uninitialize_ring:
523error_unreg_ring_funcs: 523error_unreg_ring_funcs:
524 adis16203_unconfigure_ring(indio_dev); 524 adis16203_unconfigure_ring(indio_dev);
525error_free_dev: 525error_free_dev:
526 iio_free_device(indio_dev); 526 iio_device_free(indio_dev);
527error_ret: 527error_ret:
528 return ret; 528 return ret;
529} 529}
@@ -536,7 +536,7 @@ static int adis16203_remove(struct spi_device *spi)
536 adis16203_remove_trigger(indio_dev); 536 adis16203_remove_trigger(indio_dev);
537 iio_buffer_unregister(indio_dev); 537 iio_buffer_unregister(indio_dev);
538 adis16203_unconfigure_ring(indio_dev); 538 adis16203_unconfigure_ring(indio_dev);
539 iio_free_device(indio_dev); 539 iio_device_free(indio_dev);
540 540
541 return 0; 541 return 0;
542} 542}
diff --git a/drivers/staging/iio/accel/adis16203_trigger.c b/drivers/staging/iio/accel/adis16203_trigger.c
index 1e1b981e1581..b8a04073d6d7 100644
--- a/drivers/staging/iio/accel/adis16203_trigger.c
+++ b/drivers/staging/iio/accel/adis16203_trigger.c
@@ -29,7 +29,7 @@ int adis16203_probe_trigger(struct iio_dev *indio_dev)
29 int ret; 29 int ret;
30 struct adis16203_state *st = iio_priv(indio_dev); 30 struct adis16203_state *st = iio_priv(indio_dev);
31 31
32 st->trig = iio_allocate_trigger("adis16203-dev%d", indio_dev->id); 32 st->trig = iio_trigger_alloc("adis16203-dev%d", indio_dev->id);
33 if (st->trig == NULL) { 33 if (st->trig == NULL) {
34 ret = -ENOMEM; 34 ret = -ENOMEM;
35 goto error_ret; 35 goto error_ret;
@@ -58,7 +58,7 @@ int adis16203_probe_trigger(struct iio_dev *indio_dev)
58error_free_irq: 58error_free_irq:
59 free_irq(st->us->irq, st->trig); 59 free_irq(st->us->irq, st->trig);
60error_free_trig: 60error_free_trig:
61 iio_free_trigger(st->trig); 61 iio_trigger_free(st->trig);
62error_ret: 62error_ret:
63 return ret; 63 return ret;
64} 64}
@@ -69,5 +69,5 @@ void adis16203_remove_trigger(struct iio_dev *indio_dev)
69 69
70 iio_trigger_unregister(st->trig); 70 iio_trigger_unregister(st->trig);
71 free_irq(st->us->irq, st->trig); 71 free_irq(st->us->irq, st->trig);
72 iio_free_trigger(st->trig); 72 iio_trigger_free(st->trig);
73} 73}
diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c
index 2a15d71c02c7..eacda583313a 100644
--- a/drivers/staging/iio/accel/adis16204_core.c
+++ b/drivers/staging/iio/accel/adis16204_core.c
@@ -545,7 +545,7 @@ static int __devinit adis16204_probe(struct spi_device *spi)
545 struct iio_dev *indio_dev; 545 struct iio_dev *indio_dev;
546 546
547 /* setup the industrialio driver allocated elements */ 547 /* setup the industrialio driver allocated elements */
548 indio_dev = iio_allocate_device(sizeof(*st)); 548 indio_dev = iio_device_alloc(sizeof(*st));
549 if (indio_dev == NULL) { 549 if (indio_dev == NULL) {
550 ret = -ENOMEM; 550 ret = -ENOMEM;
551 goto error_ret; 551 goto error_ret;
@@ -598,7 +598,7 @@ error_uninitialize_ring:
598error_unreg_ring_funcs: 598error_unreg_ring_funcs:
599 adis16204_unconfigure_ring(indio_dev); 599 adis16204_unconfigure_ring(indio_dev);
600error_free_dev: 600error_free_dev:
601 iio_free_device(indio_dev); 601 iio_device_free(indio_dev);
602error_ret: 602error_ret:
603 return ret; 603 return ret;
604} 604}
@@ -611,7 +611,7 @@ static int adis16204_remove(struct spi_device *spi)
611 adis16204_remove_trigger(indio_dev); 611 adis16204_remove_trigger(indio_dev);
612 iio_buffer_unregister(indio_dev); 612 iio_buffer_unregister(indio_dev);
613 adis16204_unconfigure_ring(indio_dev); 613 adis16204_unconfigure_ring(indio_dev);
614 iio_free_device(indio_dev); 614 iio_device_free(indio_dev);
615 615
616 return 0; 616 return 0;
617} 617}
diff --git a/drivers/staging/iio/accel/adis16204_trigger.c b/drivers/staging/iio/accel/adis16204_trigger.c
index e6f2937ade7c..408a1682368e 100644
--- a/drivers/staging/iio/accel/adis16204_trigger.c
+++ b/drivers/staging/iio/accel/adis16204_trigger.c
@@ -29,7 +29,7 @@ int adis16204_probe_trigger(struct iio_dev *indio_dev)
29 int ret; 29 int ret;
30 struct adis16204_state *st = iio_priv(indio_dev); 30 struct adis16204_state *st = iio_priv(indio_dev);
31 31
32 st->trig = iio_allocate_trigger("adis16204-dev%d", indio_dev->id); 32 st->trig = iio_trigger_alloc("adis16204-dev%d", indio_dev->id);
33 if (st->trig == NULL) { 33 if (st->trig == NULL) {
34 ret = -ENOMEM; 34 ret = -ENOMEM;
35 goto error_ret; 35 goto error_ret;
@@ -58,7 +58,7 @@ int adis16204_probe_trigger(struct iio_dev *indio_dev)
58error_free_irq: 58error_free_irq:
59 free_irq(st->us->irq, st->trig); 59 free_irq(st->us->irq, st->trig);
60error_free_trig: 60error_free_trig:
61 iio_free_trigger(st->trig); 61 iio_trigger_free(st->trig);
62error_ret: 62error_ret:
63 return ret; 63 return ret;
64} 64}
@@ -69,5 +69,5 @@ void adis16204_remove_trigger(struct iio_dev *indio_dev)
69 69
70 iio_trigger_unregister(state->trig); 70 iio_trigger_unregister(state->trig);
71 free_irq(state->us->irq, state->trig); 71 free_irq(state->us->irq, state->trig);
72 iio_free_trigger(state->trig); 72 iio_trigger_free(state->trig);
73} 73}
diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c
index cad411340f1d..8e8dbe6b707d 100644
--- a/drivers/staging/iio/accel/adis16209_core.c
+++ b/drivers/staging/iio/accel/adis16209_core.c
@@ -544,7 +544,7 @@ static int __devinit adis16209_probe(struct spi_device *spi)
544 struct iio_dev *indio_dev; 544 struct iio_dev *indio_dev;
545 545
546 /* setup the industrialio driver allocated elements */ 546 /* setup the industrialio driver allocated elements */
547 indio_dev = iio_allocate_device(sizeof(*st)); 547 indio_dev = iio_device_alloc(sizeof(*st));
548 if (indio_dev == NULL) { 548 if (indio_dev == NULL) {
549 ret = -ENOMEM; 549 ret = -ENOMEM;
550 goto error_ret; 550 goto error_ret;
@@ -597,7 +597,7 @@ error_uninitialize_ring:
597error_unreg_ring_funcs: 597error_unreg_ring_funcs:
598 adis16209_unconfigure_ring(indio_dev); 598 adis16209_unconfigure_ring(indio_dev);
599error_free_dev: 599error_free_dev:
600 iio_free_device(indio_dev); 600 iio_device_free(indio_dev);
601error_ret: 601error_ret:
602 return ret; 602 return ret;
603} 603}
@@ -612,7 +612,7 @@ static int adis16209_remove(struct spi_device *spi)
612 adis16209_remove_trigger(indio_dev); 612 adis16209_remove_trigger(indio_dev);
613 iio_buffer_unregister(indio_dev); 613 iio_buffer_unregister(indio_dev);
614 adis16209_unconfigure_ring(indio_dev); 614 adis16209_unconfigure_ring(indio_dev);
615 iio_free_device(indio_dev); 615 iio_device_free(indio_dev);
616 616
617 return 0; 617 return 0;
618} 618}
diff --git a/drivers/staging/iio/accel/adis16209_trigger.c b/drivers/staging/iio/accel/adis16209_trigger.c
index 5f5dbed447d7..2ad93dcaf40d 100644
--- a/drivers/staging/iio/accel/adis16209_trigger.c
+++ b/drivers/staging/iio/accel/adis16209_trigger.c
@@ -38,7 +38,7 @@ int adis16209_probe_trigger(struct iio_dev *indio_dev)
38 int ret; 38 int ret;
39 struct adis16209_state *st = iio_priv(indio_dev); 39 struct adis16209_state *st = iio_priv(indio_dev);
40 40
41 st->trig = iio_allocate_trigger("adis16209-dev%d", indio_dev->id); 41 st->trig = iio_trigger_alloc("adis16209-dev%d", indio_dev->id);
42 if (st->trig == NULL) { 42 if (st->trig == NULL) {
43 ret = -ENOMEM; 43 ret = -ENOMEM;
44 goto error_ret; 44 goto error_ret;
@@ -66,7 +66,7 @@ int adis16209_probe_trigger(struct iio_dev *indio_dev)
66error_free_irq: 66error_free_irq:
67 free_irq(st->us->irq, st->trig); 67 free_irq(st->us->irq, st->trig);
68error_free_trig: 68error_free_trig:
69 iio_free_trigger(st->trig); 69 iio_trigger_free(st->trig);
70error_ret: 70error_ret:
71 return ret; 71 return ret;
72} 72}
@@ -77,5 +77,5 @@ void adis16209_remove_trigger(struct iio_dev *indio_dev)
77 77
78 iio_trigger_unregister(st->trig); 78 iio_trigger_unregister(st->trig);
79 free_irq(st->us->irq, st->trig); 79 free_irq(st->us->irq, st->trig);
80 iio_free_trigger(st->trig); 80 iio_trigger_free(st->trig);
81} 81}
diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c
index c86a3db6d747..e8c513db2d23 100644
--- a/drivers/staging/iio/accel/adis16220_core.c
+++ b/drivers/staging/iio/accel/adis16220_core.c
@@ -634,7 +634,7 @@ static int __devinit adis16220_probe(struct spi_device *spi)
634 struct iio_dev *indio_dev; 634 struct iio_dev *indio_dev;
635 635
636 /* setup the industrialio driver allocated elements */ 636 /* setup the industrialio driver allocated elements */
637 indio_dev = iio_allocate_device(sizeof(*st)); 637 indio_dev = iio_device_alloc(sizeof(*st));
638 if (indio_dev == NULL) { 638 if (indio_dev == NULL) {
639 ret = -ENOMEM; 639 ret = -ENOMEM;
640 goto error_ret; 640 goto error_ret;
@@ -685,7 +685,7 @@ error_rm_accel_bin:
685error_unregister_dev: 685error_unregister_dev:
686 iio_device_unregister(indio_dev); 686 iio_device_unregister(indio_dev);
687error_free_dev: 687error_free_dev:
688 iio_free_device(indio_dev); 688 iio_device_free(indio_dev);
689error_ret: 689error_ret:
690 return ret; 690 return ret;
691} 691}
@@ -700,7 +700,7 @@ static int adis16220_remove(struct spi_device *spi)
700 sysfs_remove_bin_file(&indio_dev->dev.kobj, &adc1_bin); 700 sysfs_remove_bin_file(&indio_dev->dev.kobj, &adc1_bin);
701 sysfs_remove_bin_file(&indio_dev->dev.kobj, &accel_bin); 701 sysfs_remove_bin_file(&indio_dev->dev.kobj, &accel_bin);
702 iio_device_unregister(indio_dev); 702 iio_device_unregister(indio_dev);
703 iio_free_device(indio_dev); 703 iio_device_free(indio_dev);
704 704
705 return 0; 705 return 0;
706} 706}
diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c
index fcc2c19f69dd..f043bbdce36f 100644
--- a/drivers/staging/iio/accel/adis16240_core.c
+++ b/drivers/staging/iio/accel/adis16240_core.c
@@ -578,7 +578,7 @@ static int __devinit adis16240_probe(struct spi_device *spi)
578 struct iio_dev *indio_dev; 578 struct iio_dev *indio_dev;
579 579
580 /* setup the industrialio driver allocated elements */ 580 /* setup the industrialio driver allocated elements */
581 indio_dev = iio_allocate_device(sizeof(*st)); 581 indio_dev = iio_device_alloc(sizeof(*st));
582 if (indio_dev == NULL) { 582 if (indio_dev == NULL) {
583 ret = -ENOMEM; 583 ret = -ENOMEM;
584 goto error_ret; 584 goto error_ret;
@@ -631,7 +631,7 @@ error_uninitialize_ring:
631error_unreg_ring_funcs: 631error_unreg_ring_funcs:
632 adis16240_unconfigure_ring(indio_dev); 632 adis16240_unconfigure_ring(indio_dev);
633error_free_dev: 633error_free_dev:
634 iio_free_device(indio_dev); 634 iio_device_free(indio_dev);
635error_ret: 635error_ret:
636 return ret; 636 return ret;
637} 637}
@@ -647,7 +647,7 @@ static int adis16240_remove(struct spi_device *spi)
647 adis16240_remove_trigger(indio_dev); 647 adis16240_remove_trigger(indio_dev);
648 iio_buffer_unregister(indio_dev); 648 iio_buffer_unregister(indio_dev);
649 adis16240_unconfigure_ring(indio_dev); 649 adis16240_unconfigure_ring(indio_dev);
650 iio_free_device(indio_dev); 650 iio_device_free(indio_dev);
651 651
652 return 0; 652 return 0;
653} 653}
diff --git a/drivers/staging/iio/accel/adis16240_trigger.c b/drivers/staging/iio/accel/adis16240_trigger.c
index 53eda35b37e7..fa90a22b143e 100644
--- a/drivers/staging/iio/accel/adis16240_trigger.c
+++ b/drivers/staging/iio/accel/adis16240_trigger.c
@@ -38,7 +38,7 @@ int adis16240_probe_trigger(struct iio_dev *indio_dev)
38 int ret; 38 int ret;
39 struct adis16240_state *st = iio_priv(indio_dev); 39 struct adis16240_state *st = iio_priv(indio_dev);
40 40
41 st->trig = iio_allocate_trigger("adis16240-dev%d", indio_dev->id); 41 st->trig = iio_trigger_alloc("adis16240-dev%d", indio_dev->id);
42 if (st->trig == NULL) { 42 if (st->trig == NULL) {
43 ret = -ENOMEM; 43 ret = -ENOMEM;
44 goto error_ret; 44 goto error_ret;
@@ -67,7 +67,7 @@ int adis16240_probe_trigger(struct iio_dev *indio_dev)
67error_free_irq: 67error_free_irq:
68 free_irq(st->us->irq, st->trig); 68 free_irq(st->us->irq, st->trig);
69error_free_trig: 69error_free_trig:
70 iio_free_trigger(st->trig); 70 iio_trigger_free(st->trig);
71error_ret: 71error_ret:
72 return ret; 72 return ret;
73} 73}
@@ -78,5 +78,5 @@ void adis16240_remove_trigger(struct iio_dev *indio_dev)
78 78
79 iio_trigger_unregister(st->trig); 79 iio_trigger_unregister(st->trig);
80 free_irq(st->us->irq, st->trig); 80 free_irq(st->us->irq, st->trig);
81 iio_free_trigger(st->trig); 81 iio_trigger_free(st->trig);
82} 82}
diff --git a/drivers/staging/iio/accel/kxsd9.c b/drivers/staging/iio/accel/kxsd9.c
index 329239011d47..8cf7cd943c90 100644
--- a/drivers/staging/iio/accel/kxsd9.c
+++ b/drivers/staging/iio/accel/kxsd9.c
@@ -228,7 +228,7 @@ static int __devinit kxsd9_probe(struct spi_device *spi)
228 struct kxsd9_state *st; 228 struct kxsd9_state *st;
229 int ret = 0; 229 int ret = 0;
230 230
231 indio_dev = iio_allocate_device(sizeof(*st)); 231 indio_dev = iio_device_alloc(sizeof(*st));
232 if (indio_dev == NULL) { 232 if (indio_dev == NULL) {
233 ret = -ENOMEM; 233 ret = -ENOMEM;
234 goto error_ret; 234 goto error_ret;
@@ -256,7 +256,7 @@ static int __devinit kxsd9_probe(struct spi_device *spi)
256 return 0; 256 return 0;
257 257
258error_free_dev: 258error_free_dev:
259 iio_free_device(indio_dev); 259 iio_device_free(indio_dev);
260error_ret: 260error_ret:
261 return ret; 261 return ret;
262} 262}
@@ -264,7 +264,7 @@ error_ret:
264static int __devexit kxsd9_remove(struct spi_device *spi) 264static int __devexit kxsd9_remove(struct spi_device *spi)
265{ 265{
266 iio_device_unregister(spi_get_drvdata(spi)); 266 iio_device_unregister(spi_get_drvdata(spi));
267 iio_free_device(spi_get_drvdata(spi)); 267 iio_device_free(spi_get_drvdata(spi));
268 268
269 return 0; 269 return 0;
270} 270}
diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c
index bbef0be3d81e..a7780439af15 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -680,7 +680,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi)
680 struct lis3l02dq_state *st; 680 struct lis3l02dq_state *st;
681 struct iio_dev *indio_dev; 681 struct iio_dev *indio_dev;
682 682
683 indio_dev = iio_allocate_device(sizeof *st); 683 indio_dev = iio_device_alloc(sizeof *st);
684 if (indio_dev == NULL) { 684 if (indio_dev == NULL) {
685 ret = -ENOMEM; 685 ret = -ENOMEM;
686 goto error_ret; 686 goto error_ret;
@@ -748,7 +748,7 @@ error_uninitialize_buffer:
748error_unreg_buffer_funcs: 748error_unreg_buffer_funcs:
749 lis3l02dq_unconfigure_buffer(indio_dev); 749 lis3l02dq_unconfigure_buffer(indio_dev);
750error_free_dev: 750error_free_dev:
751 iio_free_device(indio_dev); 751 iio_device_free(indio_dev);
752error_ret: 752error_ret:
753 return ret; 753 return ret;
754} 754}
@@ -803,7 +803,7 @@ static int lis3l02dq_remove(struct spi_device *spi)
803 iio_buffer_unregister(indio_dev); 803 iio_buffer_unregister(indio_dev);
804 lis3l02dq_unconfigure_buffer(indio_dev); 804 lis3l02dq_unconfigure_buffer(indio_dev);
805 805
806 iio_free_device(indio_dev); 806 iio_device_free(indio_dev);
807err_ret: 807err_ret:
808 return ret; 808 return ret;
809} 809}
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index c8b8164eef77..9306f934e333 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -286,7 +286,7 @@ int lis3l02dq_probe_trigger(struct iio_dev *indio_dev)
286 int ret; 286 int ret;
287 struct lis3l02dq_state *st = iio_priv(indio_dev); 287 struct lis3l02dq_state *st = iio_priv(indio_dev);
288 288
289 st->trig = iio_allocate_trigger("lis3l02dq-dev%d", indio_dev->id); 289 st->trig = iio_trigger_alloc("lis3l02dq-dev%d", indio_dev->id);
290 if (!st->trig) { 290 if (!st->trig) {
291 ret = -ENOMEM; 291 ret = -ENOMEM;
292 goto error_ret; 292 goto error_ret;
@@ -302,7 +302,7 @@ int lis3l02dq_probe_trigger(struct iio_dev *indio_dev)
302 return 0; 302 return 0;
303 303
304error_free_trig: 304error_free_trig:
305 iio_free_trigger(st->trig); 305 iio_trigger_free(st->trig);
306error_ret: 306error_ret:
307 return ret; 307 return ret;
308} 308}
@@ -312,7 +312,7 @@ void lis3l02dq_remove_trigger(struct iio_dev *indio_dev)
312 struct lis3l02dq_state *st = iio_priv(indio_dev); 312 struct lis3l02dq_state *st = iio_priv(indio_dev);
313 313
314 iio_trigger_unregister(st->trig); 314 iio_trigger_unregister(st->trig);
315 iio_free_trigger(st->trig); 315 iio_trigger_free(st->trig);
316} 316}
317 317
318void lis3l02dq_unconfigure_buffer(struct iio_dev *indio_dev) 318void lis3l02dq_unconfigure_buffer(struct iio_dev *indio_dev)
diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c
index 2ee5eb060932..3c5aea5efb2b 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -1145,7 +1145,7 @@ static int __devinit sca3000_probe(struct spi_device *spi)
1145 struct sca3000_state *st; 1145 struct sca3000_state *st;
1146 struct iio_dev *indio_dev; 1146 struct iio_dev *indio_dev;
1147 1147
1148 indio_dev = iio_allocate_device(sizeof(*st)); 1148 indio_dev = iio_device_alloc(sizeof(*st));
1149 if (indio_dev == NULL) { 1149 if (indio_dev == NULL) {
1150 ret = -ENOMEM; 1150 ret = -ENOMEM;
1151 goto error_ret; 1151 goto error_ret;
@@ -1209,7 +1209,7 @@ error_unregister_ring:
1209error_unregister_dev: 1209error_unregister_dev:
1210 iio_device_unregister(indio_dev); 1210 iio_device_unregister(indio_dev);
1211error_free_dev: 1211error_free_dev:
1212 iio_free_device(indio_dev); 1212 iio_device_free(indio_dev);
1213 1213
1214error_ret: 1214error_ret:
1215 return ret; 1215 return ret;
@@ -1247,7 +1247,7 @@ static int sca3000_remove(struct spi_device *spi)
1247 iio_device_unregister(indio_dev); 1247 iio_device_unregister(indio_dev);
1248 iio_buffer_unregister(indio_dev); 1248 iio_buffer_unregister(indio_dev);
1249 sca3000_unconfigure_ring(indio_dev); 1249 sca3000_unconfigure_ring(indio_dev);
1250 iio_free_device(indio_dev); 1250 iio_device_free(indio_dev);
1251 1251
1252 return 0; 1252 return 0;
1253} 1253}
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index 14f983450d7f..7b44705acb7e 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -604,7 +604,7 @@ static int ad7192_probe_trigger(struct iio_dev *indio_dev)
604 struct ad7192_state *st = iio_priv(indio_dev); 604 struct ad7192_state *st = iio_priv(indio_dev);
605 int ret; 605 int ret;
606 606
607 st->trig = iio_allocate_trigger("%s-dev%d", 607 st->trig = iio_trigger_alloc("%s-dev%d",
608 spi_get_device_id(st->spi)->name, 608 spi_get_device_id(st->spi)->name,
609 indio_dev->id); 609 indio_dev->id);
610 if (st->trig == NULL) { 610 if (st->trig == NULL) {
@@ -637,7 +637,7 @@ static int ad7192_probe_trigger(struct iio_dev *indio_dev)
637error_free_irq: 637error_free_irq:
638 free_irq(st->spi->irq, indio_dev); 638 free_irq(st->spi->irq, indio_dev);
639error_free_trig: 639error_free_trig:
640 iio_free_trigger(st->trig); 640 iio_trigger_free(st->trig);
641error_ret: 641error_ret:
642 return ret; 642 return ret;
643} 643}
@@ -648,7 +648,7 @@ static void ad7192_remove_trigger(struct iio_dev *indio_dev)
648 648
649 iio_trigger_unregister(st->trig); 649 iio_trigger_unregister(st->trig);
650 free_irq(st->spi->irq, indio_dev); 650 free_irq(st->spi->irq, indio_dev);
651 iio_free_trigger(st->trig); 651 iio_trigger_free(st->trig);
652} 652}
653 653
654static ssize_t ad7192_read_frequency(struct device *dev, 654static ssize_t ad7192_read_frequency(struct device *dev,
@@ -1024,7 +1024,7 @@ static int __devinit ad7192_probe(struct spi_device *spi)
1024 return -ENODEV; 1024 return -ENODEV;
1025 } 1025 }
1026 1026
1027 indio_dev = iio_allocate_device(sizeof(*st)); 1027 indio_dev = iio_device_alloc(sizeof(*st));
1028 if (indio_dev == NULL) 1028 if (indio_dev == NULL)
1029 return -ENOMEM; 1029 return -ENOMEM;
1030 1030
@@ -1105,7 +1105,7 @@ error_put_reg:
1105 if (!IS_ERR(st->reg)) 1105 if (!IS_ERR(st->reg))
1106 regulator_put(st->reg); 1106 regulator_put(st->reg);
1107 1107
1108 iio_free_device(indio_dev); 1108 iio_device_free(indio_dev);
1109 1109
1110 return ret; 1110 return ret;
1111} 1111}
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index d72780f91031..9c3b66f37395 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -839,7 +839,7 @@ static int __devinit ad7280_probe(struct spi_device *spi)
839 int ret; 839 int ret;
840 const unsigned short tACQ_ns[4] = {465, 1010, 1460, 1890}; 840 const unsigned short tACQ_ns[4] = {465, 1010, 1460, 1890};
841 const unsigned short nAVG[4] = {1, 2, 4, 8}; 841 const unsigned short nAVG[4] = {1, 2, 4, 8};
842 struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st)); 842 struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
843 843
844 if (indio_dev == NULL) 844 if (indio_dev == NULL)
845 return -ENOMEM; 845 return -ENOMEM;
@@ -945,7 +945,7 @@ error_free_channels:
945 kfree(st->channels); 945 kfree(st->channels);
946 946
947error_free_device: 947error_free_device:
948 iio_free_device(indio_dev); 948 iio_device_free(indio_dev);
949 949
950 return ret; 950 return ret;
951} 951}
@@ -964,7 +964,7 @@ static int __devexit ad7280_remove(struct spi_device *spi)
964 964
965 kfree(st->channels); 965 kfree(st->channels);
966 kfree(st->iio_attr); 966 kfree(st->iio_attr);
967 iio_free_device(indio_dev); 967 iio_device_free(indio_dev);
968 968
969 return 0; 969 return 0;
970} 970}
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
index b8e4fe6c0c50..a987c2011ec1 100644
--- a/drivers/staging/iio/adc/ad7291.c
+++ b/drivers/staging/iio/adc/ad7291.c
@@ -587,7 +587,7 @@ static int __devinit ad7291_probe(struct i2c_client *client,
587 struct iio_dev *indio_dev; 587 struct iio_dev *indio_dev;
588 int ret = 0, voltage_uv = 0; 588 int ret = 0, voltage_uv = 0;
589 589
590 indio_dev = iio_allocate_device(sizeof(*chip)); 590 indio_dev = iio_device_alloc(sizeof(*chip));
591 if (indio_dev == NULL) { 591 if (indio_dev == NULL) {
592 ret = -ENOMEM; 592 ret = -ENOMEM;
593 goto error_ret; 593 goto error_ret;
@@ -669,7 +669,7 @@ error_put_reg:
669 if (!IS_ERR(chip->reg)) 669 if (!IS_ERR(chip->reg))
670 regulator_put(chip->reg); 670 regulator_put(chip->reg);
671 671
672 iio_free_device(indio_dev); 672 iio_device_free(indio_dev);
673error_ret: 673error_ret:
674 return ret; 674 return ret;
675} 675}
@@ -689,7 +689,7 @@ static int __devexit ad7291_remove(struct i2c_client *client)
689 regulator_put(chip->reg); 689 regulator_put(chip->reg);
690 } 690 }
691 691
692 iio_free_device(indio_dev); 692 iio_device_free(indio_dev);
693 693
694 return 0; 694 return 0;
695} 695}
diff --git a/drivers/staging/iio/adc/ad7298_core.c b/drivers/staging/iio/adc/ad7298_core.c
index 974a8e3ef26a..c90f2b3e661f 100644
--- a/drivers/staging/iio/adc/ad7298_core.c
+++ b/drivers/staging/iio/adc/ad7298_core.c
@@ -179,7 +179,7 @@ static int __devinit ad7298_probe(struct spi_device *spi)
179 struct ad7298_platform_data *pdata = spi->dev.platform_data; 179 struct ad7298_platform_data *pdata = spi->dev.platform_data;
180 struct ad7298_state *st; 180 struct ad7298_state *st;
181 int ret; 181 int ret;
182 struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st)); 182 struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
183 183
184 if (indio_dev == NULL) 184 if (indio_dev == NULL)
185 return -ENOMEM; 185 return -ENOMEM;
@@ -252,7 +252,7 @@ error_disable_reg:
252error_put_reg: 252error_put_reg:
253 if (!IS_ERR(st->reg)) 253 if (!IS_ERR(st->reg))
254 regulator_put(st->reg); 254 regulator_put(st->reg);
255 iio_free_device(indio_dev); 255 iio_device_free(indio_dev);
256 256
257 return ret; 257 return ret;
258} 258}
@@ -269,7 +269,7 @@ static int __devexit ad7298_remove(struct spi_device *spi)
269 regulator_disable(st->reg); 269 regulator_disable(st->reg);
270 regulator_put(st->reg); 270 regulator_put(st->reg);
271 } 271 }
272 iio_free_device(indio_dev); 272 iio_device_free(indio_dev);
273 273
274 return 0; 274 return 0;
275} 275}
diff --git a/drivers/staging/iio/adc/ad7476_core.c b/drivers/staging/iio/adc/ad7476_core.c
index 1241b9fadbf7..be1c260cf165 100644
--- a/drivers/staging/iio/adc/ad7476_core.c
+++ b/drivers/staging/iio/adc/ad7476_core.c
@@ -128,7 +128,7 @@ static int __devinit ad7476_probe(struct spi_device *spi)
128 struct iio_dev *indio_dev; 128 struct iio_dev *indio_dev;
129 int ret, voltage_uv = 0; 129 int ret, voltage_uv = 0;
130 130
131 indio_dev = iio_allocate_device(sizeof(*st)); 131 indio_dev = iio_device_alloc(sizeof(*st));
132 if (indio_dev == NULL) { 132 if (indio_dev == NULL) {
133 ret = -ENOMEM; 133 ret = -ENOMEM;
134 goto error_ret; 134 goto error_ret;
@@ -198,7 +198,7 @@ error_disable_reg:
198error_put_reg: 198error_put_reg:
199 if (!IS_ERR(st->reg)) 199 if (!IS_ERR(st->reg))
200 regulator_put(st->reg); 200 regulator_put(st->reg);
201 iio_free_device(indio_dev); 201 iio_device_free(indio_dev);
202 202
203error_ret: 203error_ret:
204 return ret; 204 return ret;
@@ -216,7 +216,7 @@ static int ad7476_remove(struct spi_device *spi)
216 regulator_disable(st->reg); 216 regulator_disable(st->reg);
217 regulator_put(st->reg); 217 regulator_put(st->reg);
218 } 218 }
219 iio_free_device(indio_dev); 219 iio_device_free(indio_dev);
220 220
221 return 0; 221 return 0;
222} 222}
diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c
index 9c540643576b..f82d36c603c1 100644
--- a/drivers/staging/iio/adc/ad7606_core.c
+++ b/drivers/staging/iio/adc/ad7606_core.c
@@ -461,7 +461,7 @@ struct iio_dev *ad7606_probe(struct device *dev, int irq,
461 struct ad7606_platform_data *pdata = dev->platform_data; 461 struct ad7606_platform_data *pdata = dev->platform_data;
462 struct ad7606_state *st; 462 struct ad7606_state *st;
463 int ret; 463 int ret;
464 struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st)); 464 struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
465 465
466 if (indio_dev == NULL) { 466 if (indio_dev == NULL) {
467 ret = -ENOMEM; 467 ret = -ENOMEM;
@@ -560,7 +560,7 @@ error_disable_reg:
560error_put_reg: 560error_put_reg:
561 if (!IS_ERR(st->reg)) 561 if (!IS_ERR(st->reg))
562 regulator_put(st->reg); 562 regulator_put(st->reg);
563 iio_free_device(indio_dev); 563 iio_device_free(indio_dev);
564error_ret: 564error_ret:
565 return ERR_PTR(ret); 565 return ERR_PTR(ret);
566} 566}
@@ -580,7 +580,7 @@ int ad7606_remove(struct iio_dev *indio_dev, int irq)
580 } 580 }
581 581
582 ad7606_free_gpios(st); 582 ad7606_free_gpios(st);
583 iio_free_device(indio_dev); 583 iio_device_free(indio_dev);
584 584
585 return 0; 585 return 0;
586} 586}
diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c
index a8e661e5e4e6..1ece2ac8de56 100644
--- a/drivers/staging/iio/adc/ad7780.c
+++ b/drivers/staging/iio/adc/ad7780.c
@@ -187,7 +187,7 @@ static int __devinit ad7780_probe(struct spi_device *spi)
187 return -ENODEV; 187 return -ENODEV;
188 } 188 }
189 189
190 indio_dev = iio_allocate_device(sizeof(*st)); 190 indio_dev = iio_device_alloc(sizeof(*st));
191 if (indio_dev == NULL) 191 if (indio_dev == NULL)
192 return -ENOMEM; 192 return -ENOMEM;
193 193
@@ -265,7 +265,7 @@ error_put_reg:
265 if (!IS_ERR(st->reg)) 265 if (!IS_ERR(st->reg))
266 regulator_put(st->reg); 266 regulator_put(st->reg);
267 267
268 iio_free_device(indio_dev); 268 iio_device_free(indio_dev);
269 269
270 return ret; 270 return ret;
271} 271}
@@ -282,7 +282,7 @@ static int ad7780_remove(struct spi_device *spi)
282 regulator_disable(st->reg); 282 regulator_disable(st->reg);
283 regulator_put(st->reg); 283 regulator_put(st->reg);
284 } 284 }
285 iio_free_device(indio_dev); 285 iio_device_free(indio_dev);
286 286
287 return 0; 287 return 0;
288} 288}
diff --git a/drivers/staging/iio/adc/ad7793.c b/drivers/staging/iio/adc/ad7793.c
index 3a7d1a7b4e05..8ffdd800bcd9 100644
--- a/drivers/staging/iio/adc/ad7793.c
+++ b/drivers/staging/iio/adc/ad7793.c
@@ -469,7 +469,7 @@ static int ad7793_probe_trigger(struct iio_dev *indio_dev)
469 struct ad7793_state *st = iio_priv(indio_dev); 469 struct ad7793_state *st = iio_priv(indio_dev);
470 int ret; 470 int ret;
471 471
472 st->trig = iio_allocate_trigger("%s-dev%d", 472 st->trig = iio_trigger_alloc("%s-dev%d",
473 spi_get_device_id(st->spi)->name, 473 spi_get_device_id(st->spi)->name,
474 indio_dev->id); 474 indio_dev->id);
475 if (st->trig == NULL) { 475 if (st->trig == NULL) {
@@ -503,7 +503,7 @@ static int ad7793_probe_trigger(struct iio_dev *indio_dev)
503error_free_irq: 503error_free_irq:
504 free_irq(st->spi->irq, indio_dev); 504 free_irq(st->spi->irq, indio_dev);
505error_free_trig: 505error_free_trig:
506 iio_free_trigger(st->trig); 506 iio_trigger_free(st->trig);
507error_ret: 507error_ret:
508 return ret; 508 return ret;
509} 509}
@@ -514,7 +514,7 @@ static void ad7793_remove_trigger(struct iio_dev *indio_dev)
514 514
515 iio_trigger_unregister(st->trig); 515 iio_trigger_unregister(st->trig);
516 free_irq(st->spi->irq, indio_dev); 516 free_irq(st->spi->irq, indio_dev);
517 iio_free_trigger(st->trig); 517 iio_trigger_free(st->trig);
518} 518}
519 519
520static const u16 sample_freq_avail[16] = {0, 470, 242, 123, 62, 50, 39, 33, 19, 520static const u16 sample_freq_avail[16] = {0, 470, 242, 123, 62, 50, 39, 33, 19,
@@ -904,7 +904,7 @@ static int __devinit ad7793_probe(struct spi_device *spi)
904 return -ENODEV; 904 return -ENODEV;
905 } 905 }
906 906
907 indio_dev = iio_allocate_device(sizeof(*st)); 907 indio_dev = iio_device_alloc(sizeof(*st));
908 if (indio_dev == NULL) 908 if (indio_dev == NULL)
909 return -ENOMEM; 909 return -ENOMEM;
910 910
@@ -988,7 +988,7 @@ error_put_reg:
988 if (!IS_ERR(st->reg)) 988 if (!IS_ERR(st->reg))
989 regulator_put(st->reg); 989 regulator_put(st->reg);
990 990
991 iio_free_device(indio_dev); 991 iio_device_free(indio_dev);
992 992
993 return ret; 993 return ret;
994} 994}
@@ -1008,7 +1008,7 @@ static int ad7793_remove(struct spi_device *spi)
1008 regulator_put(st->reg); 1008 regulator_put(st->reg);
1009 } 1009 }
1010 1010
1011 iio_free_device(indio_dev); 1011 iio_device_free(indio_dev);
1012 1012
1013 return 0; 1013 return 0;
1014} 1014}
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 586f6c2425e2..c97da5b66435 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -354,7 +354,7 @@ static int __devinit ad7816_probe(struct spi_device *spi_dev)
354 return -EINVAL; 354 return -EINVAL;
355 } 355 }
356 356
357 indio_dev = iio_allocate_device(sizeof(*chip)); 357 indio_dev = iio_device_alloc(sizeof(*chip));
358 if (indio_dev == NULL) { 358 if (indio_dev == NULL) {
359 ret = -ENOMEM; 359 ret = -ENOMEM;
360 goto error_ret; 360 goto error_ret;
@@ -426,7 +426,7 @@ error_free_gpio_convert:
426error_free_gpio_rdwr: 426error_free_gpio_rdwr:
427 gpio_free(chip->rdwr_pin); 427 gpio_free(chip->rdwr_pin);
428error_free_device: 428error_free_device:
429 iio_free_device(indio_dev); 429 iio_device_free(indio_dev);
430error_ret: 430error_ret:
431 return ret; 431 return ret;
432} 432}
@@ -443,7 +443,7 @@ static int __devexit ad7816_remove(struct spi_device *spi_dev)
443 gpio_free(chip->busy_pin); 443 gpio_free(chip->busy_pin);
444 gpio_free(chip->convert_pin); 444 gpio_free(chip->convert_pin);
445 gpio_free(chip->rdwr_pin); 445 gpio_free(chip->rdwr_pin);
446 iio_free_device(indio_dev); 446 iio_device_free(indio_dev);
447 447
448 return 0; 448 return 0;
449} 449}
diff --git a/drivers/staging/iio/adc/ad7887_core.c b/drivers/staging/iio/adc/ad7887_core.c
index fef916998f24..7186074deeb3 100644
--- a/drivers/staging/iio/adc/ad7887_core.c
+++ b/drivers/staging/iio/adc/ad7887_core.c
@@ -106,7 +106,7 @@ static int __devinit ad7887_probe(struct spi_device *spi)
106 struct ad7887_platform_data *pdata = spi->dev.platform_data; 106 struct ad7887_platform_data *pdata = spi->dev.platform_data;
107 struct ad7887_state *st; 107 struct ad7887_state *st;
108 int ret, voltage_uv = 0; 108 int ret, voltage_uv = 0;
109 struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st)); 109 struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
110 110
111 if (indio_dev == NULL) 111 if (indio_dev == NULL)
112 return -ENOMEM; 112 return -ENOMEM;
@@ -222,7 +222,7 @@ error_disable_reg:
222error_put_reg: 222error_put_reg:
223 if (!IS_ERR(st->reg)) 223 if (!IS_ERR(st->reg))
224 regulator_put(st->reg); 224 regulator_put(st->reg);
225 iio_free_device(indio_dev); 225 iio_device_free(indio_dev);
226 226
227 return ret; 227 return ret;
228} 228}
@@ -239,7 +239,7 @@ static int ad7887_remove(struct spi_device *spi)
239 regulator_disable(st->reg); 239 regulator_disable(st->reg);
240 regulator_put(st->reg); 240 regulator_put(st->reg);
241 } 241 }
242 iio_free_device(indio_dev); 242 iio_device_free(indio_dev);
243 243
244 return 0; 244 return 0;
245} 245}
diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
index 561ae17ec7cc..cc637b5a36e5 100644
--- a/drivers/staging/iio/adc/ad799x_core.c
+++ b/drivers/staging/iio/adc/ad799x_core.c
@@ -847,7 +847,7 @@ static int __devinit ad799x_probe(struct i2c_client *client,
847 int ret; 847 int ret;
848 struct ad799x_platform_data *pdata = client->dev.platform_data; 848 struct ad799x_platform_data *pdata = client->dev.platform_data;
849 struct ad799x_state *st; 849 struct ad799x_state *st;
850 struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st)); 850 struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
851 851
852 if (indio_dev == NULL) 852 if (indio_dev == NULL)
853 return -ENOMEM; 853 return -ENOMEM;
@@ -920,7 +920,7 @@ error_disable_reg:
920error_put_reg: 920error_put_reg:
921 if (!IS_ERR(st->reg)) 921 if (!IS_ERR(st->reg))
922 regulator_put(st->reg); 922 regulator_put(st->reg);
923 iio_free_device(indio_dev); 923 iio_device_free(indio_dev);
924 924
925 return ret; 925 return ret;
926} 926}
@@ -940,7 +940,7 @@ static __devexit int ad799x_remove(struct i2c_client *client)
940 regulator_disable(st->reg); 940 regulator_disable(st->reg);
941 regulator_put(st->reg); 941 regulator_put(st->reg);
942 } 942 }
943 iio_free_device(indio_dev); 943 iio_device_free(indio_dev);
944 944
945 return 0; 945 return 0;
946} 946}
diff --git a/drivers/staging/iio/adc/adt7310.c b/drivers/staging/iio/adc/adt7310.c
index 223aea5952df..ba4e571a112a 100644
--- a/drivers/staging/iio/adc/adt7310.c
+++ b/drivers/staging/iio/adc/adt7310.c
@@ -753,7 +753,7 @@ static int __devinit adt7310_probe(struct spi_device *spi_dev)
753 unsigned long *adt7310_platform_data = spi_dev->dev.platform_data; 753 unsigned long *adt7310_platform_data = spi_dev->dev.platform_data;
754 unsigned long irq_flags; 754 unsigned long irq_flags;
755 755
756 indio_dev = iio_allocate_device(sizeof(*chip)); 756 indio_dev = iio_device_alloc(sizeof(*chip));
757 if (indio_dev == NULL) { 757 if (indio_dev == NULL) {
758 ret = -ENOMEM; 758 ret = -ENOMEM;
759 goto error_ret; 759 goto error_ret;
@@ -833,7 +833,7 @@ error_unreg_int_irq:
833error_unreg_ct_irq: 833error_unreg_ct_irq:
834 free_irq(spi_dev->irq, indio_dev); 834 free_irq(spi_dev->irq, indio_dev);
835error_free_dev: 835error_free_dev:
836 iio_free_device(indio_dev); 836 iio_device_free(indio_dev);
837error_ret: 837error_ret:
838 return ret; 838 return ret;
839} 839}
@@ -849,7 +849,7 @@ static int __devexit adt7310_remove(struct spi_device *spi_dev)
849 free_irq(adt7310_platform_data[0], indio_dev); 849 free_irq(adt7310_platform_data[0], indio_dev);
850 if (spi_dev->irq) 850 if (spi_dev->irq)
851 free_irq(spi_dev->irq, indio_dev); 851 free_irq(spi_dev->irq, indio_dev);
852 iio_free_device(indio_dev); 852 iio_device_free(indio_dev);
853 853
854 return 0; 854 return 0;
855} 855}
diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c
index dab4a5abff8a..2d4b5c6cd8fc 100644
--- a/drivers/staging/iio/adc/adt7410.c
+++ b/drivers/staging/iio/adc/adt7410.c
@@ -721,7 +721,7 @@ static int __devinit adt7410_probe(struct i2c_client *client,
721 int ret = 0; 721 int ret = 0;
722 unsigned long *adt7410_platform_data = client->dev.platform_data; 722 unsigned long *adt7410_platform_data = client->dev.platform_data;
723 723
724 indio_dev = iio_allocate_device(sizeof(*chip)); 724 indio_dev = iio_device_alloc(sizeof(*chip));
725 if (indio_dev == NULL) { 725 if (indio_dev == NULL) {
726 ret = -ENOMEM; 726 ret = -ENOMEM;
727 goto error_ret; 727 goto error_ret;
@@ -797,7 +797,7 @@ error_unreg_int_irq:
797error_unreg_ct_irq: 797error_unreg_ct_irq:
798 free_irq(client->irq, indio_dev); 798 free_irq(client->irq, indio_dev);
799error_free_dev: 799error_free_dev:
800 iio_free_device(indio_dev); 800 iio_device_free(indio_dev);
801error_ret: 801error_ret:
802 return ret; 802 return ret;
803} 803}
@@ -812,7 +812,7 @@ static int __devexit adt7410_remove(struct i2c_client *client)
812 free_irq(adt7410_platform_data[0], indio_dev); 812 free_irq(adt7410_platform_data[0], indio_dev);
813 if (client->irq) 813 if (client->irq)
814 free_irq(client->irq, indio_dev); 814 free_irq(client->irq, indio_dev);
815 iio_free_device(indio_dev); 815 iio_device_free(indio_dev);
816 816
817 return 0; 817 return 0;
818} 818}
diff --git a/drivers/staging/iio/adc/lpc32xx_adc.c b/drivers/staging/iio/adc/lpc32xx_adc.c
index 0ddd91712f44..9690306d1f8f 100644
--- a/drivers/staging/iio/adc/lpc32xx_adc.c
+++ b/drivers/staging/iio/adc/lpc32xx_adc.c
@@ -141,7 +141,7 @@ static int __devinit lpc32xx_adc_probe(struct platform_device *pdev)
141 goto errout1; 141 goto errout1;
142 } 142 }
143 143
144 iodev = iio_allocate_device(sizeof(struct lpc32xx_adc_info)); 144 iodev = iio_device_alloc(sizeof(struct lpc32xx_adc_info));
145 if (!iodev) { 145 if (!iodev) {
146 dev_err(&pdev->dev, "failed allocating iio device\n"); 146 dev_err(&pdev->dev, "failed allocating iio device\n");
147 retval = -ENOMEM; 147 retval = -ENOMEM;
@@ -202,7 +202,7 @@ errout4:
202errout3: 202errout3:
203 iounmap(info->adc_base); 203 iounmap(info->adc_base);
204errout2: 204errout2:
205 iio_free_device(iodev); 205 iio_device_free(iodev);
206errout1: 206errout1:
207 return retval; 207 return retval;
208} 208}
@@ -218,7 +218,7 @@ static int __devexit lpc32xx_adc_remove(struct platform_device *pdev)
218 platform_set_drvdata(pdev, NULL); 218 platform_set_drvdata(pdev, NULL);
219 clk_put(info->clk); 219 clk_put(info->clk);
220 iounmap(info->adc_base); 220 iounmap(info->adc_base);
221 iio_free_device(iodev); 221 iio_device_free(iodev);
222 222
223 return 0; 223 return 0;
224} 224}
diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c
index 7ab871c8aab5..572a500d6e51 100644
--- a/drivers/staging/iio/adc/max1363_core.c
+++ b/drivers/staging/iio/adc/max1363_core.c
@@ -1287,7 +1287,7 @@ static int __devinit max1363_probe(struct i2c_client *client,
1287 if (ret) 1287 if (ret)
1288 goto error_put_reg; 1288 goto error_put_reg;
1289 1289
1290 indio_dev = iio_allocate_device(sizeof(struct max1363_state)); 1290 indio_dev = iio_device_alloc(sizeof(struct max1363_state));
1291 if (indio_dev == NULL) { 1291 if (indio_dev == NULL) {
1292 ret = -ENOMEM; 1292 ret = -ENOMEM;
1293 goto error_disable_reg; 1293 goto error_disable_reg;
@@ -1358,7 +1358,7 @@ error_free_available_scan_masks:
1358error_unregister_map: 1358error_unregister_map:
1359 iio_map_array_unregister(indio_dev, client->dev.platform_data); 1359 iio_map_array_unregister(indio_dev, client->dev.platform_data);
1360error_free_device: 1360error_free_device:
1361 iio_free_device(indio_dev); 1361 iio_device_free(indio_dev);
1362error_disable_reg: 1362error_disable_reg:
1363 regulator_disable(reg); 1363 regulator_disable(reg);
1364error_put_reg: 1364error_put_reg:
@@ -1384,7 +1384,7 @@ static int max1363_remove(struct i2c_client *client)
1384 regulator_put(reg); 1384 regulator_put(reg);
1385 } 1385 }
1386 iio_map_array_unregister(indio_dev, client->dev.platform_data); 1386 iio_map_array_unregister(indio_dev, client->dev.platform_data);
1387 iio_free_device(indio_dev); 1387 iio_device_free(indio_dev);
1388 1388
1389 return 0; 1389 return 0;
1390} 1390}
diff --git a/drivers/staging/iio/adc/spear_adc.c b/drivers/staging/iio/adc/spear_adc.c
index 2b4e1eb8eab1..8c6013f0a4b3 100644
--- a/drivers/staging/iio/adc/spear_adc.c
+++ b/drivers/staging/iio/adc/spear_adc.c
@@ -300,7 +300,7 @@ static int __devinit spear_adc_probe(struct platform_device *pdev)
300 int ret = -ENODEV; 300 int ret = -ENODEV;
301 int irq; 301 int irq;
302 302
303 iodev = iio_allocate_device(sizeof(struct spear_adc_info)); 303 iodev = iio_device_alloc(sizeof(struct spear_adc_info));
304 if (!iodev) { 304 if (!iodev) {
305 dev_err(dev, "failed allocating iio device\n"); 305 dev_err(dev, "failed allocating iio device\n");
306 ret = -ENOMEM; 306 ret = -ENOMEM;
@@ -404,7 +404,7 @@ errout4:
404errout3: 404errout3:
405 iounmap(info->adc_base_spear6xx); 405 iounmap(info->adc_base_spear6xx);
406errout2: 406errout2:
407 iio_free_device(iodev); 407 iio_device_free(iodev);
408errout1: 408errout1:
409 return ret; 409 return ret;
410} 410}
@@ -420,7 +420,7 @@ static int __devexit spear_adc_remove(struct platform_device *pdev)
420 clk_unprepare(info->clk); 420 clk_unprepare(info->clk);
421 clk_put(info->clk); 421 clk_put(info->clk);
422 iounmap(info->adc_base_spear6xx); 422 iounmap(info->adc_base_spear6xx);
423 iio_free_device(iodev); 423 iio_device_free(iodev);
424 424
425 return 0; 425 return 0;
426} 426}
diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index f469ab3cc7b9..5aba804237ce 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -2133,7 +2133,7 @@ int __devinit adt7316_probe(struct device *dev, struct adt7316_bus *bus,
2133 unsigned short *adt7316_platform_data = dev->platform_data; 2133 unsigned short *adt7316_platform_data = dev->platform_data;
2134 int ret = 0; 2134 int ret = 0;
2135 2135
2136 indio_dev = iio_allocate_device(sizeof(*chip)); 2136 indio_dev = iio_device_alloc(sizeof(*chip));
2137 if (indio_dev == NULL) { 2137 if (indio_dev == NULL) {
2138 ret = -ENOMEM; 2138 ret = -ENOMEM;
2139 goto error_ret; 2139 goto error_ret;
@@ -2210,7 +2210,7 @@ int __devinit adt7316_probe(struct device *dev, struct adt7316_bus *bus,
2210error_unreg_irq: 2210error_unreg_irq:
2211 free_irq(chip->bus.irq, indio_dev); 2211 free_irq(chip->bus.irq, indio_dev);
2212error_free_dev: 2212error_free_dev:
2213 iio_free_device(indio_dev); 2213 iio_device_free(indio_dev);
2214error_ret: 2214error_ret:
2215 return ret; 2215 return ret;
2216} 2216}
@@ -2224,7 +2224,7 @@ int __devexit adt7316_remove(struct device *dev)
2224 iio_device_unregister(indio_dev); 2224 iio_device_unregister(indio_dev);
2225 if (chip->bus.irq) 2225 if (chip->bus.irq)
2226 free_irq(chip->bus.irq, indio_dev); 2226 free_irq(chip->bus.irq, indio_dev);
2227 iio_free_device(indio_dev); 2227 iio_device_free(indio_dev);
2228 2228
2229 return 0; 2229 return 0;
2230} 2230}
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index c0ccbc524c6e..14470764fa0b 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -558,7 +558,7 @@ static int __devinit ad7150_probe(struct i2c_client *client,
558 struct ad7150_chip_info *chip; 558 struct ad7150_chip_info *chip;
559 struct iio_dev *indio_dev; 559 struct iio_dev *indio_dev;
560 560
561 indio_dev = iio_allocate_device(sizeof(*chip)); 561 indio_dev = iio_device_alloc(sizeof(*chip));
562 if (indio_dev == NULL) { 562 if (indio_dev == NULL) {
563 ret = -ENOMEM; 563 ret = -ENOMEM;
564 goto error_ret; 564 goto error_ret;
@@ -621,7 +621,7 @@ error_free_irq:
621 if (client->irq) 621 if (client->irq)
622 free_irq(client->irq, indio_dev); 622 free_irq(client->irq, indio_dev);
623error_free_dev: 623error_free_dev:
624 iio_free_device(indio_dev); 624 iio_device_free(indio_dev);
625error_ret: 625error_ret:
626 return ret; 626 return ret;
627} 627}
@@ -637,7 +637,7 @@ static int __devexit ad7150_remove(struct i2c_client *client)
637 if (client->dev.platform_data) 637 if (client->dev.platform_data)
638 free_irq(*(unsigned int *)client->dev.platform_data, indio_dev); 638 free_irq(*(unsigned int *)client->dev.platform_data, indio_dev);
639 639
640 iio_free_device(indio_dev); 640 iio_device_free(indio_dev);
641 641
642 return 0; 642 return 0;
643} 643}
diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c
index ea403596c958..195d90748633 100644
--- a/drivers/staging/iio/cdc/ad7152.c
+++ b/drivers/staging/iio/cdc/ad7152.c
@@ -481,7 +481,7 @@ static int __devinit ad7152_probe(struct i2c_client *client,
481 struct ad7152_chip_info *chip; 481 struct ad7152_chip_info *chip;
482 struct iio_dev *indio_dev; 482 struct iio_dev *indio_dev;
483 483
484 indio_dev = iio_allocate_device(sizeof(*chip)); 484 indio_dev = iio_device_alloc(sizeof(*chip));
485 if (indio_dev == NULL) { 485 if (indio_dev == NULL) {
486 ret = -ENOMEM; 486 ret = -ENOMEM;
487 goto error_ret; 487 goto error_ret;
@@ -513,7 +513,7 @@ static int __devinit ad7152_probe(struct i2c_client *client,
513 return 0; 513 return 0;
514 514
515error_free_dev: 515error_free_dev:
516 iio_free_device(indio_dev); 516 iio_device_free(indio_dev);
517error_ret: 517error_ret:
518 return ret; 518 return ret;
519} 519}
@@ -523,7 +523,7 @@ static int __devexit ad7152_remove(struct i2c_client *client)
523 struct iio_dev *indio_dev = i2c_get_clientdata(client); 523 struct iio_dev *indio_dev = i2c_get_clientdata(client);
524 524
525 iio_device_unregister(indio_dev); 525 iio_device_unregister(indio_dev);
526 iio_free_device(indio_dev); 526 iio_device_free(indio_dev);
527 527
528 return 0; 528 return 0;
529} 529}
diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index 74a889a6d899..e936831d5c96 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -703,7 +703,7 @@ static int __devinit ad7746_probe(struct i2c_client *client,
703 int ret = 0; 703 int ret = 0;
704 unsigned char regval = 0; 704 unsigned char regval = 0;
705 705
706 indio_dev = iio_allocate_device(sizeof(*chip)); 706 indio_dev = iio_device_alloc(sizeof(*chip));
707 if (indio_dev == NULL) { 707 if (indio_dev == NULL) {
708 ret = -ENOMEM; 708 ret = -ENOMEM;
709 goto error_ret; 709 goto error_ret;
@@ -763,7 +763,7 @@ static int __devinit ad7746_probe(struct i2c_client *client,
763 return 0; 763 return 0;
764 764
765error_free_dev: 765error_free_dev:
766 iio_free_device(indio_dev); 766 iio_device_free(indio_dev);
767error_ret: 767error_ret:
768 return ret; 768 return ret;
769} 769}
@@ -773,7 +773,7 @@ static int __devexit ad7746_remove(struct i2c_client *client)
773 struct iio_dev *indio_dev = i2c_get_clientdata(client); 773 struct iio_dev *indio_dev = i2c_get_clientdata(client);
774 774
775 iio_device_unregister(indio_dev); 775 iio_device_unregister(indio_dev);
776 iio_free_device(indio_dev); 776 iio_device_free(indio_dev);
777 777
778 return 0; 778 return 0;
779} 779}
diff --git a/drivers/staging/iio/dac/ad5064.c b/drivers/staging/iio/dac/ad5064.c
index c0fad4fd13fa..bce641a1cf82 100644
--- a/drivers/staging/iio/dac/ad5064.c
+++ b/drivers/staging/iio/dac/ad5064.c
@@ -443,7 +443,7 @@ static int __devinit ad5064_probe(struct spi_device *spi)
443 unsigned int i; 443 unsigned int i;
444 int ret; 444 int ret;
445 445
446 indio_dev = iio_allocate_device(sizeof(*st)); 446 indio_dev = iio_device_alloc(sizeof(*st));
447 if (indio_dev == NULL) 447 if (indio_dev == NULL)
448 return -ENOMEM; 448 return -ENOMEM;
449 449
@@ -500,7 +500,7 @@ error_free_reg:
500 if (!st->use_internal_vref) 500 if (!st->use_internal_vref)
501 regulator_bulk_free(ad5064_num_vref(st), st->vref_reg); 501 regulator_bulk_free(ad5064_num_vref(st), st->vref_reg);
502error_free: 502error_free:
503 iio_free_device(indio_dev); 503 iio_device_free(indio_dev);
504 504
505 return ret; 505 return ret;
506} 506}
@@ -518,7 +518,7 @@ static int __devexit ad5064_remove(struct spi_device *spi)
518 regulator_bulk_free(ad5064_num_vref(st), st->vref_reg); 518 regulator_bulk_free(ad5064_num_vref(st), st->vref_reg);
519 } 519 }
520 520
521 iio_free_device(indio_dev); 521 iio_device_free(indio_dev);
522 522
523 return 0; 523 return 0;
524} 524}
diff --git a/drivers/staging/iio/dac/ad5360.c b/drivers/staging/iio/dac/ad5360.c
index 0978dd2891b9..26cac42dcca9 100644
--- a/drivers/staging/iio/dac/ad5360.c
+++ b/drivers/staging/iio/dac/ad5360.c
@@ -465,7 +465,7 @@ static int __devinit ad5360_probe(struct spi_device *spi)
465 unsigned int i; 465 unsigned int i;
466 int ret; 466 int ret;
467 467
468 indio_dev = iio_allocate_device(sizeof(*st)); 468 indio_dev = iio_device_alloc(sizeof(*st));
469 if (indio_dev == NULL) { 469 if (indio_dev == NULL) {
470 dev_err(&spi->dev, "Failed to allocate iio device\n"); 470 dev_err(&spi->dev, "Failed to allocate iio device\n");
471 return -ENOMEM; 471 return -ENOMEM;
@@ -520,7 +520,7 @@ error_free_reg:
520error_free_channels: 520error_free_channels:
521 kfree(indio_dev->channels); 521 kfree(indio_dev->channels);
522error_free: 522error_free:
523 iio_free_device(indio_dev); 523 iio_device_free(indio_dev);
524 524
525 return ret; 525 return ret;
526} 526}
@@ -537,7 +537,7 @@ static int __devexit ad5360_remove(struct spi_device *spi)
537 regulator_bulk_disable(st->chip_info->num_vrefs, st->vref_reg); 537 regulator_bulk_disable(st->chip_info->num_vrefs, st->vref_reg);
538 regulator_bulk_free(st->chip_info->num_vrefs, st->vref_reg); 538 regulator_bulk_free(st->chip_info->num_vrefs, st->vref_reg);
539 539
540 iio_free_device(indio_dev); 540 iio_device_free(indio_dev);
541 541
542 return 0; 542 return 0;
543} 543}
diff --git a/drivers/staging/iio/dac/ad5380.c b/drivers/staging/iio/dac/ad5380.c
index aa077e676dfe..4afb099fa5dd 100644
--- a/drivers/staging/iio/dac/ad5380.c
+++ b/drivers/staging/iio/dac/ad5380.c
@@ -389,7 +389,7 @@ static int __devinit ad5380_probe(struct device *dev, struct regmap *regmap,
389 unsigned int ctrl = 0; 389 unsigned int ctrl = 0;
390 int ret; 390 int ret;
391 391
392 indio_dev = iio_allocate_device(sizeof(*st)); 392 indio_dev = iio_device_alloc(sizeof(*st));
393 if (indio_dev == NULL) { 393 if (indio_dev == NULL) {
394 dev_err(dev, "Failed to allocate iio device\n"); 394 dev_err(dev, "Failed to allocate iio device\n");
395 ret = -ENOMEM; 395 ret = -ENOMEM;
@@ -455,7 +455,7 @@ error_free_reg:
455 455
456 kfree(indio_dev->channels); 456 kfree(indio_dev->channels);
457error_free: 457error_free:
458 iio_free_device(indio_dev); 458 iio_device_free(indio_dev);
459error_regmap_exit: 459error_regmap_exit:
460 regmap_exit(regmap); 460 regmap_exit(regmap);
461 461
@@ -477,7 +477,7 @@ static int __devexit ad5380_remove(struct device *dev)
477 } 477 }
478 478
479 regmap_exit(st->regmap); 479 regmap_exit(st->regmap);
480 iio_free_device(indio_dev); 480 iio_device_free(indio_dev);
481 481
482 return 0; 482 return 0;
483} 483}
diff --git a/drivers/staging/iio/dac/ad5421.c b/drivers/staging/iio/dac/ad5421.c
index b1a893ce2c88..ffbd4c234f57 100644
--- a/drivers/staging/iio/dac/ad5421.c
+++ b/drivers/staging/iio/dac/ad5421.c
@@ -457,7 +457,7 @@ static int __devinit ad5421_probe(struct spi_device *spi)
457 struct ad5421_state *st; 457 struct ad5421_state *st;
458 int ret; 458 int ret;
459 459
460 indio_dev = iio_allocate_device(sizeof(*st)); 460 indio_dev = iio_device_alloc(sizeof(*st));
461 if (indio_dev == NULL) { 461 if (indio_dev == NULL) {
462 dev_err(&spi->dev, "Failed to allocate iio device\n"); 462 dev_err(&spi->dev, "Failed to allocate iio device\n");
463 return -ENOMEM; 463 return -ENOMEM;
@@ -512,7 +512,7 @@ error_free_irq:
512 if (spi->irq) 512 if (spi->irq)
513 free_irq(spi->irq, indio_dev); 513 free_irq(spi->irq, indio_dev);
514error_free: 514error_free:
515 iio_free_device(indio_dev); 515 iio_device_free(indio_dev);
516 516
517 return ret; 517 return ret;
518} 518}
@@ -524,7 +524,7 @@ static int __devexit ad5421_remove(struct spi_device *spi)
524 iio_device_unregister(indio_dev); 524 iio_device_unregister(indio_dev);
525 if (spi->irq) 525 if (spi->irq)
526 free_irq(spi->irq, indio_dev); 526 free_irq(spi->irq, indio_dev);
527 iio_free_device(indio_dev); 527 iio_device_free(indio_dev);
528 528
529 return 0; 529 return 0;
530} 530}
diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c
index 62ad1d5df475..3b2551f67a0d 100644
--- a/drivers/staging/iio/dac/ad5446.c
+++ b/drivers/staging/iio/dac/ad5446.c
@@ -296,7 +296,7 @@ static int __devinit ad5446_probe(struct spi_device *spi)
296 voltage_uv = regulator_get_voltage(reg); 296 voltage_uv = regulator_get_voltage(reg);
297 } 297 }
298 298
299 indio_dev = iio_allocate_device(sizeof(*st)); 299 indio_dev = iio_device_alloc(sizeof(*st));
300 if (indio_dev == NULL) { 300 if (indio_dev == NULL) {
301 ret = -ENOMEM; 301 ret = -ENOMEM;
302 goto error_disable_reg; 302 goto error_disable_reg;
@@ -331,7 +331,7 @@ static int __devinit ad5446_probe(struct spi_device *spi)
331 return 0; 331 return 0;
332 332
333error_free_device: 333error_free_device:
334 iio_free_device(indio_dev); 334 iio_device_free(indio_dev);
335error_disable_reg: 335error_disable_reg:
336 if (!IS_ERR(reg)) 336 if (!IS_ERR(reg))
337 regulator_disable(reg); 337 regulator_disable(reg);
@@ -352,7 +352,7 @@ static int ad5446_remove(struct spi_device *spi)
352 regulator_disable(st->reg); 352 regulator_disable(st->reg);
353 regulator_put(st->reg); 353 regulator_put(st->reg);
354 } 354 }
355 iio_free_device(indio_dev); 355 iio_device_free(indio_dev);
356 356
357 return 0; 357 return 0;
358} 358}
diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c
index 18fc391e62d4..e47f4d0967b4 100644
--- a/drivers/staging/iio/dac/ad5504.c
+++ b/drivers/staging/iio/dac/ad5504.c
@@ -288,7 +288,7 @@ static int __devinit ad5504_probe(struct spi_device *spi)
288 struct regulator *reg; 288 struct regulator *reg;
289 int ret, voltage_uv = 0; 289 int ret, voltage_uv = 0;
290 290
291 indio_dev = iio_allocate_device(sizeof(*st)); 291 indio_dev = iio_device_alloc(sizeof(*st));
292 if (indio_dev == NULL) { 292 if (indio_dev == NULL) {
293 ret = -ENOMEM; 293 ret = -ENOMEM;
294 goto error_ret; 294 goto error_ret;
@@ -351,7 +351,7 @@ error_put_reg:
351 if (!IS_ERR(reg)) 351 if (!IS_ERR(reg))
352 regulator_put(reg); 352 regulator_put(reg);
353 353
354 iio_free_device(indio_dev); 354 iio_device_free(indio_dev);
355error_ret: 355error_ret:
356 return ret; 356 return ret;
357} 357}
@@ -369,7 +369,7 @@ static int __devexit ad5504_remove(struct spi_device *spi)
369 regulator_disable(st->reg); 369 regulator_disable(st->reg);
370 regulator_put(st->reg); 370 regulator_put(st->reg);
371 } 371 }
372 iio_free_device(indio_dev); 372 iio_device_free(indio_dev);
373 373
374 return 0; 374 return 0;
375} 375}
diff --git a/drivers/staging/iio/dac/ad5624r_spi.c b/drivers/staging/iio/dac/ad5624r_spi.c
index c7786c18b847..cde4a9f8d897 100644
--- a/drivers/staging/iio/dac/ad5624r_spi.c
+++ b/drivers/staging/iio/dac/ad5624r_spi.c
@@ -256,7 +256,7 @@ static int __devinit ad5624r_probe(struct spi_device *spi)
256 struct iio_dev *indio_dev; 256 struct iio_dev *indio_dev;
257 int ret, voltage_uv = 0; 257 int ret, voltage_uv = 0;
258 258
259 indio_dev = iio_allocate_device(sizeof(*st)); 259 indio_dev = iio_device_alloc(sizeof(*st));
260 if (indio_dev == NULL) { 260 if (indio_dev == NULL) {
261 ret = -ENOMEM; 261 ret = -ENOMEM;
262 goto error_ret; 262 goto error_ret;
@@ -306,7 +306,7 @@ error_disable_reg:
306error_put_reg: 306error_put_reg:
307 if (!IS_ERR(st->reg)) 307 if (!IS_ERR(st->reg))
308 regulator_put(st->reg); 308 regulator_put(st->reg);
309 iio_free_device(indio_dev); 309 iio_device_free(indio_dev);
310error_ret: 310error_ret:
311 311
312 return ret; 312 return ret;
@@ -322,7 +322,7 @@ static int __devexit ad5624r_remove(struct spi_device *spi)
322 regulator_disable(st->reg); 322 regulator_disable(st->reg);
323 regulator_put(st->reg); 323 regulator_put(st->reg);
324 } 324 }
325 iio_free_device(indio_dev); 325 iio_device_free(indio_dev);
326 326
327 return 0; 327 return 0;
328} 328}
diff --git a/drivers/staging/iio/dac/ad5686.c b/drivers/staging/iio/dac/ad5686.c
index 86c869134bd4..6a74436af594 100644
--- a/drivers/staging/iio/dac/ad5686.c
+++ b/drivers/staging/iio/dac/ad5686.c
@@ -359,7 +359,7 @@ static int __devinit ad5686_probe(struct spi_device *spi)
359 struct iio_dev *indio_dev; 359 struct iio_dev *indio_dev;
360 int ret, regdone = 0, voltage_uv = 0; 360 int ret, regdone = 0, voltage_uv = 0;
361 361
362 indio_dev = iio_allocate_device(sizeof(*st)); 362 indio_dev = iio_device_alloc(sizeof(*st));
363 if (indio_dev == NULL) 363 if (indio_dev == NULL)
364 return -ENOMEM; 364 return -ENOMEM;
365 365
@@ -411,7 +411,7 @@ error_put_reg:
411 if (!IS_ERR(st->reg)) 411 if (!IS_ERR(st->reg))
412 regulator_put(st->reg); 412 regulator_put(st->reg);
413 413
414 iio_free_device(indio_dev); 414 iio_device_free(indio_dev);
415 415
416 return ret; 416 return ret;
417} 417}
@@ -426,7 +426,7 @@ static int __devexit ad5686_remove(struct spi_device *spi)
426 regulator_disable(st->reg); 426 regulator_disable(st->reg);
427 regulator_put(st->reg); 427 regulator_put(st->reg);
428 } 428 }
429 iio_free_device(indio_dev); 429 iio_device_free(indio_dev);
430 430
431 return 0; 431 return 0;
432} 432}
diff --git a/drivers/staging/iio/dac/ad5764.c b/drivers/staging/iio/dac/ad5764.c
index b01d7eedb95e..03dbd937b081 100644
--- a/drivers/staging/iio/dac/ad5764.c
+++ b/drivers/staging/iio/dac/ad5764.c
@@ -281,7 +281,7 @@ static int __devinit ad5764_probe(struct spi_device *spi)
281 struct ad5764_state *st; 281 struct ad5764_state *st;
282 int ret; 282 int ret;
283 283
284 indio_dev = iio_allocate_device(sizeof(*st)); 284 indio_dev = iio_device_alloc(sizeof(*st));
285 if (indio_dev == NULL) { 285 if (indio_dev == NULL) {
286 dev_err(&spi->dev, "Failed to allocate iio device\n"); 286 dev_err(&spi->dev, "Failed to allocate iio device\n");
287 return -ENOMEM; 287 return -ENOMEM;
@@ -336,7 +336,7 @@ error_free_reg:
336 if (st->chip_info->int_vref == 0) 336 if (st->chip_info->int_vref == 0)
337 regulator_bulk_free(ARRAY_SIZE(st->vref_reg), st->vref_reg); 337 regulator_bulk_free(ARRAY_SIZE(st->vref_reg), st->vref_reg);
338error_free: 338error_free:
339 iio_free_device(indio_dev); 339 iio_device_free(indio_dev);
340 340
341 return ret; 341 return ret;
342} 342}
@@ -353,7 +353,7 @@ static int __devexit ad5764_remove(struct spi_device *spi)
353 regulator_bulk_free(ARRAY_SIZE(st->vref_reg), st->vref_reg); 353 regulator_bulk_free(ARRAY_SIZE(st->vref_reg), st->vref_reg);
354 } 354 }
355 355
356 iio_free_device(indio_dev); 356 iio_device_free(indio_dev);
357 357
358 return 0; 358 return 0;
359} 359}
diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c
index c013868dfcd5..1cc75e6cd901 100644
--- a/drivers/staging/iio/dac/ad5791.c
+++ b/drivers/staging/iio/dac/ad5791.c
@@ -289,7 +289,7 @@ static int __devinit ad5791_probe(struct spi_device *spi)
289 struct ad5791_state *st; 289 struct ad5791_state *st;
290 int ret, pos_voltage_uv = 0, neg_voltage_uv = 0; 290 int ret, pos_voltage_uv = 0, neg_voltage_uv = 0;
291 291
292 indio_dev = iio_allocate_device(sizeof(*st)); 292 indio_dev = iio_device_alloc(sizeof(*st));
293 if (indio_dev == NULL) { 293 if (indio_dev == NULL) {
294 ret = -ENOMEM; 294 ret = -ENOMEM;
295 goto error_ret; 295 goto error_ret;
@@ -369,7 +369,7 @@ error_put_reg_neg:
369error_put_reg_pos: 369error_put_reg_pos:
370 if (!IS_ERR(st->reg_vdd)) 370 if (!IS_ERR(st->reg_vdd))
371 regulator_put(st->reg_vdd); 371 regulator_put(st->reg_vdd);
372 iio_free_device(indio_dev); 372 iio_device_free(indio_dev);
373error_ret: 373error_ret:
374 374
375 return ret; 375 return ret;
@@ -390,7 +390,7 @@ static int __devexit ad5791_remove(struct spi_device *spi)
390 regulator_disable(st->reg_vss); 390 regulator_disable(st->reg_vss);
391 regulator_put(st->reg_vss); 391 regulator_put(st->reg_vss);
392 } 392 }
393 iio_free_device(indio_dev); 393 iio_device_free(indio_dev);
394 394
395 return 0; 395 return 0;
396} 396}
diff --git a/drivers/staging/iio/dac/max517.c b/drivers/staging/iio/dac/max517.c
index 373127cc83a8..a3f588dfdbfb 100644
--- a/drivers/staging/iio/dac/max517.c
+++ b/drivers/staging/iio/dac/max517.c
@@ -218,7 +218,7 @@ static int max517_probe(struct i2c_client *client,
218 struct max517_platform_data *platform_data = client->dev.platform_data; 218 struct max517_platform_data *platform_data = client->dev.platform_data;
219 int err; 219 int err;
220 220
221 indio_dev = iio_allocate_device(sizeof(*data)); 221 indio_dev = iio_device_alloc(sizeof(*data));
222 if (indio_dev == NULL) { 222 if (indio_dev == NULL) {
223 err = -ENOMEM; 223 err = -ENOMEM;
224 goto exit; 224 goto exit;
@@ -257,14 +257,14 @@ static int max517_probe(struct i2c_client *client,
257 return 0; 257 return 0;
258 258
259exit_free_device: 259exit_free_device:
260 iio_free_device(indio_dev); 260 iio_device_free(indio_dev);
261exit: 261exit:
262 return err; 262 return err;
263} 263}
264 264
265static int max517_remove(struct i2c_client *client) 265static int max517_remove(struct i2c_client *client)
266{ 266{
267 iio_free_device(i2c_get_clientdata(client)); 267 iio_device_free(i2c_get_clientdata(client));
268 268
269 return 0; 269 return 0;
270} 270}
diff --git a/drivers/staging/iio/dds/ad5930.c b/drivers/staging/iio/dds/ad5930.c
index 6df4d86be849..97542fc9bf22 100644
--- a/drivers/staging/iio/dds/ad5930.c
+++ b/drivers/staging/iio/dds/ad5930.c
@@ -97,7 +97,7 @@ static int __devinit ad5930_probe(struct spi_device *spi)
97 struct iio_dev *idev; 97 struct iio_dev *idev;
98 int ret = 0; 98 int ret = 0;
99 99
100 idev = iio_allocate_device(sizeof(*st)); 100 idev = iio_device_alloc(sizeof(*st));
101 if (idev == NULL) { 101 if (idev == NULL) {
102 ret = -ENOMEM; 102 ret = -ENOMEM;
103 goto error_ret; 103 goto error_ret;
@@ -122,7 +122,7 @@ static int __devinit ad5930_probe(struct spi_device *spi)
122 return 0; 122 return 0;
123 123
124error_free_dev: 124error_free_dev:
125 iio_free_device(idev); 125 iio_device_free(idev);
126error_ret: 126error_ret:
127 return ret; 127 return ret;
128} 128}
@@ -130,7 +130,7 @@ error_ret:
130static int __devexit ad5930_remove(struct spi_device *spi) 130static int __devexit ad5930_remove(struct spi_device *spi)
131{ 131{
132 iio_device_unregister(spi_get_drvdata(spi)); 132 iio_device_unregister(spi_get_drvdata(spi));
133 iio_free_device(spi_get_drvdata(spi)); 133 iio_device_free(spi_get_drvdata(spi));
134 134
135 return 0; 135 return 0;
136} 136}
diff --git a/drivers/staging/iio/dds/ad9832.c b/drivers/staging/iio/dds/ad9832.c
index 57627ff45c3a..7a9b723d51e0 100644
--- a/drivers/staging/iio/dds/ad9832.c
+++ b/drivers/staging/iio/dds/ad9832.c
@@ -221,7 +221,7 @@ static int __devinit ad9832_probe(struct spi_device *spi)
221 goto error_put_reg; 221 goto error_put_reg;
222 } 222 }
223 223
224 indio_dev = iio_allocate_device(sizeof(*st)); 224 indio_dev = iio_device_alloc(sizeof(*st));
225 if (indio_dev == NULL) { 225 if (indio_dev == NULL) {
226 ret = -ENOMEM; 226 ret = -ENOMEM;
227 goto error_disable_reg; 227 goto error_disable_reg;
@@ -313,7 +313,7 @@ static int __devinit ad9832_probe(struct spi_device *spi)
313 return 0; 313 return 0;
314 314
315error_free_device: 315error_free_device:
316 iio_free_device(indio_dev); 316 iio_device_free(indio_dev);
317error_disable_reg: 317error_disable_reg:
318 if (!IS_ERR(reg)) 318 if (!IS_ERR(reg))
319 regulator_disable(reg); 319 regulator_disable(reg);
@@ -334,7 +334,7 @@ static int __devexit ad9832_remove(struct spi_device *spi)
334 regulator_disable(st->reg); 334 regulator_disable(st->reg);
335 regulator_put(st->reg); 335 regulator_put(st->reg);
336 } 336 }
337 iio_free_device(indio_dev); 337 iio_device_free(indio_dev);
338 338
339 return 0; 339 return 0;
340} 340}
diff --git a/drivers/staging/iio/dds/ad9834.c b/drivers/staging/iio/dds/ad9834.c
index 9b2c8795f894..b8ef8d9be550 100644
--- a/drivers/staging/iio/dds/ad9834.c
+++ b/drivers/staging/iio/dds/ad9834.c
@@ -334,7 +334,7 @@ static int __devinit ad9834_probe(struct spi_device *spi)
334 goto error_put_reg; 334 goto error_put_reg;
335 } 335 }
336 336
337 indio_dev = iio_allocate_device(sizeof(*st)); 337 indio_dev = iio_device_alloc(sizeof(*st));
338 if (indio_dev == NULL) { 338 if (indio_dev == NULL) {
339 ret = -ENOMEM; 339 ret = -ENOMEM;
340 goto error_disable_reg; 340 goto error_disable_reg;
@@ -414,7 +414,7 @@ static int __devinit ad9834_probe(struct spi_device *spi)
414 return 0; 414 return 0;
415 415
416error_free_device: 416error_free_device:
417 iio_free_device(indio_dev); 417 iio_device_free(indio_dev);
418error_disable_reg: 418error_disable_reg:
419 if (!IS_ERR(reg)) 419 if (!IS_ERR(reg))
420 regulator_disable(reg); 420 regulator_disable(reg);
@@ -434,7 +434,7 @@ static int __devexit ad9834_remove(struct spi_device *spi)
434 regulator_disable(st->reg); 434 regulator_disable(st->reg);
435 regulator_put(st->reg); 435 regulator_put(st->reg);
436 } 436 }
437 iio_free_device(indio_dev); 437 iio_device_free(indio_dev);
438 438
439 return 0; 439 return 0;
440} 440}
diff --git a/drivers/staging/iio/dds/ad9850.c b/drivers/staging/iio/dds/ad9850.c
index cc7a87d25a59..39f12a6a08b4 100644
--- a/drivers/staging/iio/dds/ad9850.c
+++ b/drivers/staging/iio/dds/ad9850.c
@@ -83,7 +83,7 @@ static int __devinit ad9850_probe(struct spi_device *spi)
83 struct iio_dev *idev; 83 struct iio_dev *idev;
84 int ret = 0; 84 int ret = 0;
85 85
86 idev = iio_allocate_device(sizeof(*st)); 86 idev = iio_device_alloc(sizeof(*st));
87 if (idev == NULL) { 87 if (idev == NULL) {
88 ret = -ENOMEM; 88 ret = -ENOMEM;
89 goto error_ret; 89 goto error_ret;
@@ -108,7 +108,7 @@ static int __devinit ad9850_probe(struct spi_device *spi)
108 return 0; 108 return 0;
109 109
110error_free_dev: 110error_free_dev:
111 iio_free_device(idev); 111 iio_device_free(idev);
112error_ret: 112error_ret:
113 return ret; 113 return ret;
114} 114}
@@ -116,7 +116,7 @@ error_ret:
116static int __devexit ad9850_remove(struct spi_device *spi) 116static int __devexit ad9850_remove(struct spi_device *spi)
117{ 117{
118 iio_device_unregister(spi_get_drvdata(spi)); 118 iio_device_unregister(spi_get_drvdata(spi));
119 iio_free_device(spi_get_drvdata(spi)); 119 iio_device_free(spi_get_drvdata(spi));
120 120
121 return 0; 121 return 0;
122} 122}
diff --git a/drivers/staging/iio/dds/ad9852.c b/drivers/staging/iio/dds/ad9852.c
index 2f8df7bcb783..58d4bf89e64e 100644
--- a/drivers/staging/iio/dds/ad9852.c
+++ b/drivers/staging/iio/dds/ad9852.c
@@ -232,7 +232,7 @@ static int __devinit ad9852_probe(struct spi_device *spi)
232 struct iio_dev *idev; 232 struct iio_dev *idev;
233 int ret = 0; 233 int ret = 0;
234 234
235 idev = iio_allocate_device(sizeof(*st)); 235 idev = iio_device_alloc(sizeof(*st));
236 if (idev == NULL) { 236 if (idev == NULL) {
237 ret = -ENOMEM; 237 ret = -ENOMEM;
238 goto error_ret; 238 goto error_ret;
@@ -258,7 +258,7 @@ static int __devinit ad9852_probe(struct spi_device *spi)
258 return 0; 258 return 0;
259 259
260error_free_dev: 260error_free_dev:
261 iio_free_device(idev); 261 iio_device_free(idev);
262 262
263error_ret: 263error_ret:
264 return ret; 264 return ret;
@@ -267,7 +267,7 @@ error_ret:
267static int __devexit ad9852_remove(struct spi_device *spi) 267static int __devexit ad9852_remove(struct spi_device *spi)
268{ 268{
269 iio_device_unregister(spi_get_drvdata(spi)); 269 iio_device_unregister(spi_get_drvdata(spi));
270 iio_free_device(spi_get_drvdata(spi)); 270 iio_device_free(spi_get_drvdata(spi));
271 271
272 return 0; 272 return 0;
273} 273}
diff --git a/drivers/staging/iio/dds/ad9910.c b/drivers/staging/iio/dds/ad9910.c
index e91efc5c0fca..6e7a97e92a20 100644
--- a/drivers/staging/iio/dds/ad9910.c
+++ b/drivers/staging/iio/dds/ad9910.c
@@ -367,7 +367,7 @@ static int __devinit ad9910_probe(struct spi_device *spi)
367 struct iio_dev *idev; 367 struct iio_dev *idev;
368 int ret = 0; 368 int ret = 0;
369 369
370 idev = iio_allocate_device(sizeof(*st)); 370 idev = iio_device_alloc(sizeof(*st));
371 if (idev == NULL) { 371 if (idev == NULL) {
372 ret = -ENOMEM; 372 ret = -ENOMEM;
373 goto error_ret; 373 goto error_ret;
@@ -392,7 +392,7 @@ static int __devinit ad9910_probe(struct spi_device *spi)
392 return 0; 392 return 0;
393 393
394error_free_dev: 394error_free_dev:
395 iio_free_device(idev); 395 iio_device_free(idev);
396error_ret: 396error_ret:
397 return ret; 397 return ret;
398} 398}
@@ -400,7 +400,7 @@ error_ret:
400static int __devexit ad9910_remove(struct spi_device *spi) 400static int __devexit ad9910_remove(struct spi_device *spi)
401{ 401{
402 iio_device_unregister(spi_get_drvdata(spi)); 402 iio_device_unregister(spi_get_drvdata(spi));
403 iio_free_device(spi_get_drvdata(spi)); 403 iio_device_free(spi_get_drvdata(spi));
404 404
405 return 0; 405 return 0;
406} 406}
diff --git a/drivers/staging/iio/dds/ad9951.c b/drivers/staging/iio/dds/ad9951.c
index ca1d3111b0bf..19ba721788fe 100644
--- a/drivers/staging/iio/dds/ad9951.c
+++ b/drivers/staging/iio/dds/ad9951.c
@@ -176,7 +176,7 @@ static int __devinit ad9951_probe(struct spi_device *spi)
176 struct iio_dev *idev; 176 struct iio_dev *idev;
177 int ret = 0; 177 int ret = 0;
178 178
179 idev = iio_allocate_device(sizeof(*st)); 179 idev = iio_device_alloc(sizeof(*st));
180 if (idev == NULL) { 180 if (idev == NULL) {
181 ret = -ENOMEM; 181 ret = -ENOMEM;
182 goto error_ret; 182 goto error_ret;
@@ -202,7 +202,7 @@ static int __devinit ad9951_probe(struct spi_device *spi)
202 return 0; 202 return 0;
203 203
204error_free_dev: 204error_free_dev:
205 iio_free_device(idev); 205 iio_device_free(idev);
206 206
207error_ret: 207error_ret:
208 return ret; 208 return ret;
@@ -211,7 +211,7 @@ error_ret:
211static int __devexit ad9951_remove(struct spi_device *spi) 211static int __devexit ad9951_remove(struct spi_device *spi)
212{ 212{
213 iio_device_unregister(spi_get_drvdata(spi)); 213 iio_device_unregister(spi_get_drvdata(spi));
214 iio_free_device(spi_get_drvdata(spi)); 214 iio_device_free(spi_get_drvdata(spi));
215 215
216 return 0; 216 return 0;
217} 217}
diff --git a/drivers/staging/iio/gyro/adis16060_core.c b/drivers/staging/iio/gyro/adis16060_core.c
index 08aaf2783895..9931e2060e1f 100644
--- a/drivers/staging/iio/gyro/adis16060_core.c
+++ b/drivers/staging/iio/gyro/adis16060_core.c
@@ -152,7 +152,7 @@ static int __devinit adis16060_r_probe(struct spi_device *spi)
152 struct iio_dev *indio_dev; 152 struct iio_dev *indio_dev;
153 153
154 /* setup the industrialio driver allocated elements */ 154 /* setup the industrialio driver allocated elements */
155 indio_dev = iio_allocate_device(sizeof(*st)); 155 indio_dev = iio_device_alloc(sizeof(*st));
156 if (indio_dev == NULL) { 156 if (indio_dev == NULL) {
157 ret = -ENOMEM; 157 ret = -ENOMEM;
158 goto error_ret; 158 goto error_ret;
@@ -178,7 +178,7 @@ static int __devinit adis16060_r_probe(struct spi_device *spi)
178 return 0; 178 return 0;
179 179
180error_free_dev: 180error_free_dev:
181 iio_free_device(indio_dev); 181 iio_device_free(indio_dev);
182error_ret: 182error_ret:
183 return ret; 183 return ret;
184} 184}
@@ -187,7 +187,7 @@ error_ret:
187static int adis16060_r_remove(struct spi_device *spi) 187static int adis16060_r_remove(struct spi_device *spi)
188{ 188{
189 iio_device_unregister(spi_get_drvdata(spi)); 189 iio_device_unregister(spi_get_drvdata(spi));
190 iio_free_device(spi_get_drvdata(spi)); 190 iio_device_free(spi_get_drvdata(spi));
191 191
192 return 0; 192 return 0;
193} 193}
diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c
index 7e3695ba628b..11f1dccd7a0d 100644
--- a/drivers/staging/iio/gyro/adis16080_core.c
+++ b/drivers/staging/iio/gyro/adis16080_core.c
@@ -145,7 +145,7 @@ static int __devinit adis16080_probe(struct spi_device *spi)
145 struct iio_dev *indio_dev; 145 struct iio_dev *indio_dev;
146 146
147 /* setup the industrialio driver allocated elements */ 147 /* setup the industrialio driver allocated elements */
148 indio_dev = iio_allocate_device(sizeof(*st)); 148 indio_dev = iio_device_alloc(sizeof(*st));
149 if (indio_dev == NULL) { 149 if (indio_dev == NULL) {
150 ret = -ENOMEM; 150 ret = -ENOMEM;
151 goto error_ret; 151 goto error_ret;
@@ -171,7 +171,7 @@ static int __devinit adis16080_probe(struct spi_device *spi)
171 return 0; 171 return 0;
172 172
173error_free_dev: 173error_free_dev:
174 iio_free_device(indio_dev); 174 iio_device_free(indio_dev);
175error_ret: 175error_ret:
176 return ret; 176 return ret;
177} 177}
@@ -180,7 +180,7 @@ error_ret:
180static int adis16080_remove(struct spi_device *spi) 180static int adis16080_remove(struct spi_device *spi)
181{ 181{
182 iio_device_unregister(spi_get_drvdata(spi)); 182 iio_device_unregister(spi_get_drvdata(spi));
183 iio_free_device(spi_get_drvdata(spi)); 183 iio_device_free(spi_get_drvdata(spi));
184 184
185 return 0; 185 return 0;
186} 186}
diff --git a/drivers/staging/iio/gyro/adis16130_core.c b/drivers/staging/iio/gyro/adis16130_core.c
index 98aa1b92b9d4..bf61cd0b5bbc 100644
--- a/drivers/staging/iio/gyro/adis16130_core.c
+++ b/drivers/staging/iio/gyro/adis16130_core.c
@@ -123,7 +123,7 @@ static int __devinit adis16130_probe(struct spi_device *spi)
123 struct iio_dev *indio_dev; 123 struct iio_dev *indio_dev;
124 124
125 /* setup the industrialio driver allocated elements */ 125 /* setup the industrialio driver allocated elements */
126 indio_dev = iio_allocate_device(sizeof(*st)); 126 indio_dev = iio_device_alloc(sizeof(*st));
127 if (indio_dev == NULL) { 127 if (indio_dev == NULL) {
128 ret = -ENOMEM; 128 ret = -ENOMEM;
129 goto error_ret; 129 goto error_ret;
@@ -147,7 +147,7 @@ static int __devinit adis16130_probe(struct spi_device *spi)
147 return 0; 147 return 0;
148 148
149error_free_dev: 149error_free_dev:
150 iio_free_device(indio_dev); 150 iio_device_free(indio_dev);
151 151
152error_ret: 152error_ret:
153 return ret; 153 return ret;
@@ -157,7 +157,7 @@ error_ret:
157static int adis16130_remove(struct spi_device *spi) 157static int adis16130_remove(struct spi_device *spi)
158{ 158{
159 iio_device_unregister(spi_get_drvdata(spi)); 159 iio_device_unregister(spi_get_drvdata(spi));
160 iio_free_device(spi_get_drvdata(spi)); 160 iio_device_free(spi_get_drvdata(spi));
161 161
162 return 0; 162 return 0;
163} 163}
diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c
index 15253beab9a0..d7979cf15cd0 100644
--- a/drivers/staging/iio/gyro/adis16260_core.c
+++ b/drivers/staging/iio/gyro/adis16260_core.c
@@ -627,7 +627,7 @@ static int __devinit adis16260_probe(struct spi_device *spi)
627 struct iio_dev *indio_dev; 627 struct iio_dev *indio_dev;
628 628
629 /* setup the industrialio driver allocated elements */ 629 /* setup the industrialio driver allocated elements */
630 indio_dev = iio_allocate_device(sizeof(*st)); 630 indio_dev = iio_device_alloc(sizeof(*st));
631 if (indio_dev == NULL) { 631 if (indio_dev == NULL) {
632 ret = -ENOMEM; 632 ret = -ENOMEM;
633 goto error_ret; 633 goto error_ret;
@@ -712,7 +712,7 @@ error_uninitialize_ring:
712error_unreg_ring_funcs: 712error_unreg_ring_funcs:
713 adis16260_unconfigure_ring(indio_dev); 713 adis16260_unconfigure_ring(indio_dev);
714error_free_dev: 714error_free_dev:
715 iio_free_device(indio_dev); 715 iio_device_free(indio_dev);
716error_ret: 716error_ret:
717 return ret; 717 return ret;
718} 718}
@@ -733,7 +733,7 @@ static int adis16260_remove(struct spi_device *spi)
733 adis16260_remove_trigger(indio_dev); 733 adis16260_remove_trigger(indio_dev);
734 iio_buffer_unregister(indio_dev); 734 iio_buffer_unregister(indio_dev);
735 adis16260_unconfigure_ring(indio_dev); 735 adis16260_unconfigure_ring(indio_dev);
736 iio_free_device(indio_dev); 736 iio_device_free(indio_dev);
737 737
738err_ret: 738err_ret:
739 return ret; 739 return ret;
diff --git a/drivers/staging/iio/gyro/adis16260_trigger.c b/drivers/staging/iio/gyro/adis16260_trigger.c
index dc56f3263762..034559e4d5b9 100644
--- a/drivers/staging/iio/gyro/adis16260_trigger.c
+++ b/drivers/staging/iio/gyro/adis16260_trigger.c
@@ -29,7 +29,7 @@ int adis16260_probe_trigger(struct iio_dev *indio_dev)
29 int ret; 29 int ret;
30 struct adis16260_state *st = iio_priv(indio_dev); 30 struct adis16260_state *st = iio_priv(indio_dev);
31 31
32 st->trig = iio_allocate_trigger("%s-dev%d", 32 st->trig = iio_trigger_alloc("%s-dev%d",
33 spi_get_device_id(st->us)->name, 33 spi_get_device_id(st->us)->name,
34 indio_dev->id); 34 indio_dev->id);
35 if (st->trig == NULL) { 35 if (st->trig == NULL) {
@@ -60,7 +60,7 @@ int adis16260_probe_trigger(struct iio_dev *indio_dev)
60error_free_irq: 60error_free_irq:
61 free_irq(st->us->irq, st->trig); 61 free_irq(st->us->irq, st->trig);
62error_free_trig: 62error_free_trig:
63 iio_free_trigger(st->trig); 63 iio_trigger_free(st->trig);
64error_ret: 64error_ret:
65 return ret; 65 return ret;
66} 66}
@@ -71,5 +71,5 @@ void adis16260_remove_trigger(struct iio_dev *indio_dev)
71 71
72 iio_trigger_unregister(st->trig); 72 iio_trigger_unregister(st->trig);
73 free_irq(st->us->irq, st->trig); 73 free_irq(st->us->irq, st->trig);
74 iio_free_trigger(st->trig); 74 iio_trigger_free(st->trig);
75} 75}
diff --git a/drivers/staging/iio/gyro/adxrs450_core.c b/drivers/staging/iio/gyro/adxrs450_core.c
index 06a9e974f010..6513119b1e90 100644
--- a/drivers/staging/iio/gyro/adxrs450_core.c
+++ b/drivers/staging/iio/gyro/adxrs450_core.c
@@ -372,7 +372,7 @@ static int __devinit adxrs450_probe(struct spi_device *spi)
372 struct iio_dev *indio_dev; 372 struct iio_dev *indio_dev;
373 373
374 /* setup the industrialio driver allocated elements */ 374 /* setup the industrialio driver allocated elements */
375 indio_dev = iio_allocate_device(sizeof(*st)); 375 indio_dev = iio_device_alloc(sizeof(*st));
376 if (indio_dev == NULL) { 376 if (indio_dev == NULL) {
377 ret = -ENOMEM; 377 ret = -ENOMEM;
378 goto error_ret; 378 goto error_ret;
@@ -403,7 +403,7 @@ static int __devinit adxrs450_probe(struct spi_device *spi)
403error_initial: 403error_initial:
404 iio_device_unregister(indio_dev); 404 iio_device_unregister(indio_dev);
405error_free_dev: 405error_free_dev:
406 iio_free_device(indio_dev); 406 iio_device_free(indio_dev);
407 407
408error_ret: 408error_ret:
409 return ret; 409 return ret;
@@ -412,7 +412,7 @@ error_ret:
412static int adxrs450_remove(struct spi_device *spi) 412static int adxrs450_remove(struct spi_device *spi)
413{ 413{
414 iio_device_unregister(spi_get_drvdata(spi)); 414 iio_device_unregister(spi_get_drvdata(spi));
415 iio_free_device(spi_get_drvdata(spi)); 415 iio_device_free(spi_get_drvdata(spi));
416 416
417 return 0; 417 return 0;
418} 418}
diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
index fa4a65329009..3b4513cf5ab9 100644
--- a/drivers/staging/iio/iio_simple_dummy.c
+++ b/drivers/staging/iio/iio_simple_dummy.c
@@ -392,7 +392,7 @@ static int __devinit iio_dummy_probe(int index)
392 * It also has a region (accessed by iio_priv() 392 * It also has a region (accessed by iio_priv()
393 * for chip specific state information. 393 * for chip specific state information.
394 */ 394 */
395 indio_dev = iio_allocate_device(sizeof(*st)); 395 indio_dev = iio_device_alloc(sizeof(*st));
396 if (indio_dev == NULL) { 396 if (indio_dev == NULL) {
397 ret = -ENOMEM; 397 ret = -ENOMEM;
398 goto error_ret; 398 goto error_ret;
@@ -472,7 +472,7 @@ error_unregister_events:
472error_free_device: 472error_free_device:
473 /* Note free device should only be called, before registration 473 /* Note free device should only be called, before registration
474 * has succeeded. */ 474 * has succeeded. */
475 iio_free_device(indio_dev); 475 iio_device_free(indio_dev);
476error_ret: 476error_ret:
477 return ret; 477 return ret;
478} 478}
@@ -509,7 +509,7 @@ static int iio_dummy_remove(int index)
509 goto error_ret; 509 goto error_ret;
510 510
511 /* Free all structures */ 511 /* Free all structures */
512 iio_free_device(indio_dev); 512 iio_device_free(indio_dev);
513 513
514error_ret: 514error_ret:
515 return ret; 515 return ret;
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 9d99a7f67fa4..359a794f684a 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -705,7 +705,7 @@ static int __devinit ad5933_probe(struct i2c_client *client,
705 int ret, voltage_uv = 0; 705 int ret, voltage_uv = 0;
706 struct ad5933_platform_data *pdata = client->dev.platform_data; 706 struct ad5933_platform_data *pdata = client->dev.platform_data;
707 struct ad5933_state *st; 707 struct ad5933_state *st;
708 struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st)); 708 struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
709 if (indio_dev == NULL) 709 if (indio_dev == NULL)
710 return -ENOMEM; 710 return -ENOMEM;
711 711
@@ -784,7 +784,7 @@ error_put_reg:
784 if (!IS_ERR(st->reg)) 784 if (!IS_ERR(st->reg))
785 regulator_put(st->reg); 785 regulator_put(st->reg);
786 786
787 iio_free_device(indio_dev); 787 iio_device_free(indio_dev);
788 788
789 return ret; 789 return ret;
790} 790}
@@ -801,7 +801,7 @@ static __devexit int ad5933_remove(struct i2c_client *client)
801 regulator_disable(st->reg); 801 regulator_disable(st->reg);
802 regulator_put(st->reg); 802 regulator_put(st->reg);
803 } 803 }
804 iio_free_device(indio_dev); 804 iio_device_free(indio_dev);
805 805
806 return 0; 806 return 0;
807} 807}
diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c
index 68ecc1525017..5015f823b65f 100644
--- a/drivers/staging/iio/imu/adis16400_core.c
+++ b/drivers/staging/iio/imu/adis16400_core.c
@@ -1161,7 +1161,7 @@ static int __devinit adis16400_probe(struct spi_device *spi)
1161{ 1161{
1162 int ret; 1162 int ret;
1163 struct adis16400_state *st; 1163 struct adis16400_state *st;
1164 struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st)); 1164 struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
1165 if (indio_dev == NULL) { 1165 if (indio_dev == NULL) {
1166 ret = -ENOMEM; 1166 ret = -ENOMEM;
1167 goto error_ret; 1167 goto error_ret;
@@ -1218,7 +1218,7 @@ error_uninitialize_ring:
1218error_unreg_ring_funcs: 1218error_unreg_ring_funcs:
1219 adis16400_unconfigure_ring(indio_dev); 1219 adis16400_unconfigure_ring(indio_dev);
1220error_free_dev: 1220error_free_dev:
1221 iio_free_device(indio_dev); 1221 iio_device_free(indio_dev);
1222error_ret: 1222error_ret:
1223 return ret; 1223 return ret;
1224} 1224}
@@ -1237,7 +1237,7 @@ static int adis16400_remove(struct spi_device *spi)
1237 adis16400_remove_trigger(indio_dev); 1237 adis16400_remove_trigger(indio_dev);
1238 iio_buffer_unregister(indio_dev); 1238 iio_buffer_unregister(indio_dev);
1239 adis16400_unconfigure_ring(indio_dev); 1239 adis16400_unconfigure_ring(indio_dev);
1240 iio_free_device(indio_dev); 1240 iio_device_free(indio_dev);
1241 1241
1242 return 0; 1242 return 0;
1243 1243
diff --git a/drivers/staging/iio/imu/adis16400_trigger.c b/drivers/staging/iio/imu/adis16400_trigger.c
index bd22e6cc11c3..42a678e92fc6 100644
--- a/drivers/staging/iio/imu/adis16400_trigger.c
+++ b/drivers/staging/iio/imu/adis16400_trigger.c
@@ -29,7 +29,7 @@ int adis16400_probe_trigger(struct iio_dev *indio_dev)
29 int ret; 29 int ret;
30 struct adis16400_state *st = iio_priv(indio_dev); 30 struct adis16400_state *st = iio_priv(indio_dev);
31 31
32 st->trig = iio_allocate_trigger("%s-dev%d", 32 st->trig = iio_trigger_alloc("%s-dev%d",
33 indio_dev->name, 33 indio_dev->name,
34 indio_dev->id); 34 indio_dev->id);
35 if (st->trig == NULL) { 35 if (st->trig == NULL) {
@@ -59,7 +59,7 @@ int adis16400_probe_trigger(struct iio_dev *indio_dev)
59error_free_irq: 59error_free_irq:
60 free_irq(st->us->irq, st->trig); 60 free_irq(st->us->irq, st->trig);
61error_free_trig: 61error_free_trig:
62 iio_free_trigger(st->trig); 62 iio_trigger_free(st->trig);
63error_ret: 63error_ret:
64 return ret; 64 return ret;
65} 65}
@@ -70,5 +70,5 @@ void adis16400_remove_trigger(struct iio_dev *indio_dev)
70 70
71 iio_trigger_unregister(st->trig); 71 iio_trigger_unregister(st->trig);
72 free_irq(st->us->irq, st->trig); 72 free_irq(st->us->irq, st->trig);
73 iio_free_trigger(st->trig); 73 iio_trigger_free(st->trig);
74} 74}
diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
index 92283ebafa55..2d23c6afa286 100644
--- a/drivers/staging/iio/light/isl29018.c
+++ b/drivers/staging/iio/light/isl29018.c
@@ -532,7 +532,7 @@ static int __devinit isl29018_probe(struct i2c_client *client,
532 struct iio_dev *indio_dev; 532 struct iio_dev *indio_dev;
533 int err; 533 int err;
534 534
535 indio_dev = iio_allocate_device(sizeof(*chip)); 535 indio_dev = iio_device_alloc(sizeof(*chip));
536 if (indio_dev == NULL) { 536 if (indio_dev == NULL) {
537 dev_err(&client->dev, "iio allocation fails\n"); 537 dev_err(&client->dev, "iio allocation fails\n");
538 err = -ENOMEM; 538 err = -ENOMEM;
@@ -574,7 +574,7 @@ static int __devinit isl29018_probe(struct i2c_client *client,
574 574
575 return 0; 575 return 0;
576exit_iio_free: 576exit_iio_free:
577 iio_free_device(indio_dev); 577 iio_device_free(indio_dev);
578exit: 578exit:
579 return err; 579 return err;
580} 580}
@@ -585,7 +585,7 @@ static int __devexit isl29018_remove(struct i2c_client *client)
585 585
586 dev_dbg(&client->dev, "%s()\n", __func__); 586 dev_dbg(&client->dev, "%s()\n", __func__);
587 iio_device_unregister(indio_dev); 587 iio_device_unregister(indio_dev);
588 iio_free_device(indio_dev); 588 iio_device_free(indio_dev);
589 589
590 return 0; 590 return 0;
591} 591}
diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c
index 2ada20e65f22..33a4c3f94a14 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -482,7 +482,7 @@ static int __devinit isl29028_probe(struct i2c_client *client,
482 struct iio_dev *indio_dev; 482 struct iio_dev *indio_dev;
483 int ret; 483 int ret;
484 484
485 indio_dev = iio_allocate_device(sizeof(*chip)); 485 indio_dev = iio_device_alloc(sizeof(*chip));
486 if (!indio_dev) { 486 if (!indio_dev) {
487 dev_err(&client->dev, "iio allocation fails\n"); 487 dev_err(&client->dev, "iio allocation fails\n");
488 return -ENOMEM; 488 return -ENOMEM;
@@ -522,7 +522,7 @@ static int __devinit isl29028_probe(struct i2c_client *client,
522 return 0; 522 return 0;
523 523
524exit_iio_free: 524exit_iio_free:
525 iio_free_device(indio_dev); 525 iio_device_free(indio_dev);
526 return ret; 526 return ret;
527} 527}
528 528
@@ -531,7 +531,7 @@ static int __devexit isl29028_remove(struct i2c_client *client)
531 struct iio_dev *indio_dev = i2c_get_clientdata(client); 531 struct iio_dev *indio_dev = i2c_get_clientdata(client);
532 532
533 iio_device_unregister(indio_dev); 533 iio_device_unregister(indio_dev);
534 iio_free_device(indio_dev); 534 iio_device_free(indio_dev);
535 return 0; 535 return 0;
536} 536}
537 537
diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c
index 635136004103..9d740be43a82 100644
--- a/drivers/staging/iio/light/tsl2563.c
+++ b/drivers/staging/iio/light/tsl2563.c
@@ -714,7 +714,7 @@ static int __devinit tsl2563_probe(struct i2c_client *client,
714 int err = 0; 714 int err = 0;
715 u8 id = 0; 715 u8 id = 0;
716 716
717 indio_dev = iio_allocate_device(sizeof(*chip)); 717 indio_dev = iio_device_alloc(sizeof(*chip));
718 if (!indio_dev) 718 if (!indio_dev)
719 return -ENOMEM; 719 return -ENOMEM;
720 720
@@ -801,7 +801,7 @@ fail2:
801 if (client->irq) 801 if (client->irq)
802 free_irq(client->irq, indio_dev); 802 free_irq(client->irq, indio_dev);
803fail1: 803fail1:
804 iio_free_device(indio_dev); 804 iio_device_free(indio_dev);
805 return err; 805 return err;
806} 806}
807 807
@@ -822,7 +822,7 @@ static int tsl2563_remove(struct i2c_client *client)
822 if (client->irq) 822 if (client->irq)
823 free_irq(client->irq, indio_dev); 823 free_irq(client->irq, indio_dev);
824 824
825 iio_free_device(indio_dev); 825 iio_device_free(indio_dev);
826 826
827 return 0; 827 return 0;
828} 828}
diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
index 51b636241d97..5ff391e8c18b 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -815,7 +815,7 @@ static int __devinit taos_probe(struct i2c_client *clientp,
815 return -EOPNOTSUPP; 815 return -EOPNOTSUPP;
816 } 816 }
817 817
818 indio_dev = iio_allocate_device(sizeof(*chip)); 818 indio_dev = iio_device_alloc(sizeof(*chip));
819 if (indio_dev == NULL) { 819 if (indio_dev == NULL) {
820 ret = -ENOMEM; 820 ret = -ENOMEM;
821 dev_err(&clientp->dev, "iio allocation failed\n"); 821 dev_err(&clientp->dev, "iio allocation failed\n");
@@ -879,7 +879,7 @@ static int __devinit taos_probe(struct i2c_client *clientp,
879 dev_info(&clientp->dev, "Light sensor found.\n"); 879 dev_info(&clientp->dev, "Light sensor found.\n");
880 return 0; 880 return 0;
881fail1: 881fail1:
882 iio_free_device(indio_dev); 882 iio_device_free(indio_dev);
883fail2: 883fail2:
884 return ret; 884 return ret;
885} 885}
@@ -926,7 +926,7 @@ static SIMPLE_DEV_PM_OPS(taos_pm_ops, taos_suspend, taos_resume);
926static int __devexit taos_remove(struct i2c_client *client) 926static int __devexit taos_remove(struct i2c_client *client)
927{ 927{
928 iio_device_unregister(i2c_get_clientdata(client)); 928 iio_device_unregister(i2c_get_clientdata(client));
929 iio_free_device(i2c_get_clientdata(client)); 929 iio_device_free(i2c_get_clientdata(client));
930 930
931 return 0; 931 return 0;
932} 932}
diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c
index dfc3da6e92e9..efbc4d27e794 100755
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -1906,7 +1906,7 @@ static int __devinit tsl2x7x_probe(struct i2c_client *clientp,
1906 struct iio_dev *indio_dev; 1906 struct iio_dev *indio_dev;
1907 struct tsl2X7X_chip *chip; 1907 struct tsl2X7X_chip *chip;
1908 1908
1909 indio_dev = iio_allocate_device(sizeof(*chip)); 1909 indio_dev = iio_device_alloc(sizeof(*chip));
1910 if (!indio_dev) 1910 if (!indio_dev)
1911 return -ENOMEM; 1911 return -ENOMEM;
1912 1912
@@ -1986,7 +1986,7 @@ fail1:
1986 if (clientp->irq) 1986 if (clientp->irq)
1987 free_irq(clientp->irq, indio_dev); 1987 free_irq(clientp->irq, indio_dev);
1988fail2: 1988fail2:
1989 iio_free_device(indio_dev); 1989 iio_device_free(indio_dev);
1990 1990
1991 return ret; 1991 return ret;
1992} 1992}
@@ -2038,7 +2038,7 @@ static int __devexit tsl2x7x_remove(struct i2c_client *client)
2038 if (client->irq) 2038 if (client->irq)
2039 free_irq(client->irq, chip->client->name); 2039 free_irq(client->irq, chip->client->name);
2040 2040
2041 iio_free_device(indio_dev); 2041 iio_device_free(indio_dev);
2042 2042
2043 return 0; 2043 return 0;
2044} 2044}
diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c
index d088548c2fa8..ea2f91859ce4 100644
--- a/drivers/staging/iio/magnetometer/ak8975.c
+++ b/drivers/staging/iio/magnetometer/ak8975.c
@@ -504,7 +504,7 @@ static int ak8975_probe(struct i2c_client *client,
504 } 504 }
505 505
506 /* Register with IIO */ 506 /* Register with IIO */
507 indio_dev = iio_allocate_device(sizeof(*data)); 507 indio_dev = iio_device_alloc(sizeof(*data));
508 if (indio_dev == NULL) { 508 if (indio_dev == NULL) {
509 err = -ENOMEM; 509 err = -ENOMEM;
510 goto exit_gpio; 510 goto exit_gpio;
@@ -535,7 +535,7 @@ static int ak8975_probe(struct i2c_client *client,
535 return 0; 535 return 0;
536 536
537exit_free_iio: 537exit_free_iio:
538 iio_free_device(indio_dev); 538 iio_device_free(indio_dev);
539exit_gpio: 539exit_gpio:
540 if (gpio_is_valid(eoc_gpio)) 540 if (gpio_is_valid(eoc_gpio))
541 gpio_free(eoc_gpio); 541 gpio_free(eoc_gpio);
@@ -553,7 +553,7 @@ static int ak8975_remove(struct i2c_client *client)
553 if (gpio_is_valid(data->eoc_gpio)) 553 if (gpio_is_valid(data->eoc_gpio))
554 gpio_free(data->eoc_gpio); 554 gpio_free(data->eoc_gpio);
555 555
556 iio_free_device(indio_dev); 556 iio_device_free(indio_dev);
557 557
558 return 0; 558 return 0;
559} 559}
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
index 3433c41fe548..e7cc9e04998e 100644
--- a/drivers/staging/iio/magnetometer/hmc5843.c
+++ b/drivers/staging/iio/magnetometer/hmc5843.c
@@ -544,7 +544,7 @@ static int hmc5843_probe(struct i2c_client *client,
544 struct iio_dev *indio_dev; 544 struct iio_dev *indio_dev;
545 int err = 0; 545 int err = 0;
546 546
547 indio_dev = iio_allocate_device(sizeof(*data)); 547 indio_dev = iio_device_alloc(sizeof(*data));
548 if (indio_dev == NULL) { 548 if (indio_dev == NULL) {
549 err = -ENOMEM; 549 err = -ENOMEM;
550 goto exit; 550 goto exit;
@@ -572,7 +572,7 @@ static int hmc5843_probe(struct i2c_client *client,
572 goto exit_free2; 572 goto exit_free2;
573 return 0; 573 return 0;
574exit_free2: 574exit_free2:
575 iio_free_device(indio_dev); 575 iio_device_free(indio_dev);
576exit: 576exit:
577 return err; 577 return err;
578} 578}
@@ -584,7 +584,7 @@ static int hmc5843_remove(struct i2c_client *client)
584 iio_device_unregister(indio_dev); 584 iio_device_unregister(indio_dev);
585 /* sleep mode to save power */ 585 /* sleep mode to save power */
586 hmc5843_configure(client, MODE_SLEEP); 586 hmc5843_configure(client, MODE_SLEEP);
587 iio_free_device(indio_dev); 587 iio_device_free(indio_dev);
588 588
589 return 0; 589 return 0;
590} 590}
diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c
index 9b26ae1f23b7..280331b664f4 100644
--- a/drivers/staging/iio/meter/ade7753.c
+++ b/drivers/staging/iio/meter/ade7753.c
@@ -517,7 +517,7 @@ static int __devinit ade7753_probe(struct spi_device *spi)
517 struct iio_dev *indio_dev; 517 struct iio_dev *indio_dev;
518 518
519 /* setup the industrialio driver allocated elements */ 519 /* setup the industrialio driver allocated elements */
520 indio_dev = iio_allocate_device(sizeof(*st)); 520 indio_dev = iio_device_alloc(sizeof(*st));
521 if (indio_dev == NULL) { 521 if (indio_dev == NULL) {
522 ret = -ENOMEM; 522 ret = -ENOMEM;
523 goto error_ret; 523 goto error_ret;
@@ -546,7 +546,7 @@ static int __devinit ade7753_probe(struct spi_device *spi)
546 return 0; 546 return 0;
547 547
548error_free_dev: 548error_free_dev:
549 iio_free_device(indio_dev); 549 iio_device_free(indio_dev);
550 550
551error_ret: 551error_ret:
552 return ret; 552 return ret;
@@ -564,7 +564,7 @@ static int ade7753_remove(struct spi_device *spi)
564 if (ret) 564 if (ret)
565 goto err_ret; 565 goto err_ret;
566 566
567 iio_free_device(indio_dev); 567 iio_device_free(indio_dev);
568err_ret: 568err_ret:
569 return ret; 569 return ret;
570} 570}
diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c
index 02d10dfe8ac5..59a2e3ef72b5 100644
--- a/drivers/staging/iio/meter/ade7754.c
+++ b/drivers/staging/iio/meter/ade7754.c
@@ -540,7 +540,7 @@ static int __devinit ade7754_probe(struct spi_device *spi)
540 struct iio_dev *indio_dev; 540 struct iio_dev *indio_dev;
541 541
542 /* setup the industrialio driver allocated elements */ 542 /* setup the industrialio driver allocated elements */
543 indio_dev = iio_allocate_device(sizeof(*st)); 543 indio_dev = iio_device_alloc(sizeof(*st));
544 if (indio_dev == NULL) { 544 if (indio_dev == NULL) {
545 ret = -ENOMEM; 545 ret = -ENOMEM;
546 goto error_ret; 546 goto error_ret;
@@ -568,7 +568,7 @@ static int __devinit ade7754_probe(struct spi_device *spi)
568 return 0; 568 return 0;
569 569
570error_free_dev: 570error_free_dev:
571 iio_free_device(indio_dev); 571 iio_device_free(indio_dev);
572 572
573error_ret: 573error_ret:
574 return ret; 574 return ret;
@@ -585,7 +585,7 @@ static int ade7754_remove(struct spi_device *spi)
585 if (ret) 585 if (ret)
586 goto err_ret; 586 goto err_ret;
587 587
588 iio_free_device(indio_dev); 588 iio_device_free(indio_dev);
589 589
590err_ret: 590err_ret:
591 return ret; 591 return ret;
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index 4a3b429003f1..1a5c9c408141 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -885,7 +885,7 @@ static int __devinit ade7758_probe(struct spi_device *spi)
885{ 885{
886 int i, ret; 886 int i, ret;
887 struct ade7758_state *st; 887 struct ade7758_state *st;
888 struct iio_dev *indio_dev = iio_allocate_device(sizeof(*st)); 888 struct iio_dev *indio_dev = iio_device_alloc(sizeof(*st));
889 889
890 if (indio_dev == NULL) { 890 if (indio_dev == NULL) {
891 ret = -ENOMEM; 891 ret = -ENOMEM;
@@ -962,7 +962,7 @@ error_free_tx:
962error_free_rx: 962error_free_rx:
963 kfree(st->rx); 963 kfree(st->rx);
964error_free_dev: 964error_free_dev:
965 iio_free_device(indio_dev); 965 iio_device_free(indio_dev);
966error_ret: 966error_ret:
967 return ret; 967 return ret;
968} 968}
@@ -984,7 +984,7 @@ static int ade7758_remove(struct spi_device *spi)
984 kfree(st->tx); 984 kfree(st->tx);
985 kfree(st->rx); 985 kfree(st->rx);
986 986
987 iio_free_device(indio_dev); 987 iio_device_free(indio_dev);
988 988
989err_ret: 989err_ret:
990 return ret; 990 return ret;
diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c
index 5c48d382dfdb..f9c6a340092b 100644
--- a/drivers/staging/iio/meter/ade7758_trigger.c
+++ b/drivers/staging/iio/meter/ade7758_trigger.c
@@ -63,7 +63,7 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev)
63 struct ade7758_state *st = iio_priv(indio_dev); 63 struct ade7758_state *st = iio_priv(indio_dev);
64 int ret; 64 int ret;
65 65
66 st->trig = iio_allocate_trigger("%s-dev%d", 66 st->trig = iio_trigger_alloc("%s-dev%d",
67 spi_get_device_id(st->us)->name, 67 spi_get_device_id(st->us)->name,
68 indio_dev->id); 68 indio_dev->id);
69 if (st->trig == NULL) { 69 if (st->trig == NULL) {
@@ -94,7 +94,7 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev)
94error_free_irq: 94error_free_irq:
95 free_irq(st->us->irq, st->trig); 95 free_irq(st->us->irq, st->trig);
96error_free_trig: 96error_free_trig:
97 iio_free_trigger(st->trig); 97 iio_trigger_free(st->trig);
98error_ret: 98error_ret:
99 return ret; 99 return ret;
100} 100}
@@ -105,5 +105,5 @@ void ade7758_remove_trigger(struct iio_dev *indio_dev)
105 105
106 iio_trigger_unregister(st->trig); 106 iio_trigger_unregister(st->trig);
107 free_irq(st->us->irq, st->trig); 107 free_irq(st->us->irq, st->trig);
108 iio_free_trigger(st->trig); 108 iio_trigger_free(st->trig);
109} 109}
diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c
index 1f2b74add572..91add54af111 100644
--- a/drivers/staging/iio/meter/ade7759.c
+++ b/drivers/staging/iio/meter/ade7759.c
@@ -463,7 +463,7 @@ static int __devinit ade7759_probe(struct spi_device *spi)
463 struct iio_dev *indio_dev; 463 struct iio_dev *indio_dev;
464 464
465 /* setup the industrialio driver allocated elements */ 465 /* setup the industrialio driver allocated elements */
466 indio_dev = iio_allocate_device(sizeof(*st)); 466 indio_dev = iio_device_alloc(sizeof(*st));
467 if (indio_dev == NULL) { 467 if (indio_dev == NULL) {
468 ret = -ENOMEM; 468 ret = -ENOMEM;
469 goto error_ret; 469 goto error_ret;
@@ -491,7 +491,7 @@ static int __devinit ade7759_probe(struct spi_device *spi)
491 return 0; 491 return 0;
492 492
493error_free_dev: 493error_free_dev:
494 iio_free_device(indio_dev); 494 iio_device_free(indio_dev);
495error_ret: 495error_ret:
496 return ret; 496 return ret;
497} 497}
@@ -507,7 +507,7 @@ static int ade7759_remove(struct spi_device *spi)
507 if (ret) 507 if (ret)
508 goto err_ret; 508 goto err_ret;
509 509
510 iio_free_device(indio_dev); 510 iio_device_free(indio_dev);
511 511
512err_ret: 512err_ret:
513 return ret; 513 return ret;
diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c
index c87c86b095e0..527aa97c74ae 100644
--- a/drivers/staging/iio/meter/ade7854-i2c.c
+++ b/drivers/staging/iio/meter/ade7854-i2c.c
@@ -208,7 +208,7 @@ static int __devinit ade7854_i2c_probe(struct i2c_client *client,
208 struct ade7854_state *st; 208 struct ade7854_state *st;
209 struct iio_dev *indio_dev; 209 struct iio_dev *indio_dev;
210 210
211 indio_dev = iio_allocate_device(sizeof(*st)); 211 indio_dev = iio_device_alloc(sizeof(*st));
212 if (indio_dev == NULL) 212 if (indio_dev == NULL)
213 return -ENOMEM; 213 return -ENOMEM;
214 st = iio_priv(indio_dev); 214 st = iio_priv(indio_dev);
@@ -226,7 +226,7 @@ static int __devinit ade7854_i2c_probe(struct i2c_client *client,
226 226
227 ret = ade7854_probe(indio_dev, &client->dev); 227 ret = ade7854_probe(indio_dev, &client->dev);
228 if (ret) 228 if (ret)
229 iio_free_device(indio_dev); 229 iio_device_free(indio_dev);
230 230
231 return ret; 231 return ret;
232} 232}
diff --git a/drivers/staging/iio/meter/ade7854-spi.c b/drivers/staging/iio/meter/ade7854-spi.c
index 11c2cef0e73b..eaafaef9caec 100644
--- a/drivers/staging/iio/meter/ade7854-spi.c
+++ b/drivers/staging/iio/meter/ade7854-spi.c
@@ -306,7 +306,7 @@ static int __devinit ade7854_spi_probe(struct spi_device *spi)
306 struct ade7854_state *st; 306 struct ade7854_state *st;
307 struct iio_dev *indio_dev; 307 struct iio_dev *indio_dev;
308 308
309 indio_dev = iio_allocate_device(sizeof(*st)); 309 indio_dev = iio_device_alloc(sizeof(*st));
310 if (indio_dev == NULL) 310 if (indio_dev == NULL)
311 return -ENOMEM; 311 return -ENOMEM;
312 st = iio_priv(indio_dev); 312 st = iio_priv(indio_dev);
@@ -325,7 +325,7 @@ static int __devinit ade7854_spi_probe(struct spi_device *spi)
325 325
326 ret = ade7854_probe(indio_dev, &spi->dev); 326 ret = ade7854_probe(indio_dev, &spi->dev);
327 if (ret) 327 if (ret)
328 iio_free_device(indio_dev); 328 iio_device_free(indio_dev);
329 329
330 return 0; 330 return 0;
331} 331}
diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c
index 2f3c1e2a4b14..fa3ba01af41d 100644
--- a/drivers/staging/iio/meter/ade7854.c
+++ b/drivers/staging/iio/meter/ade7854.c
@@ -581,7 +581,7 @@ int ade7854_probe(struct iio_dev *indio_dev, struct device *dev)
581error_unreg_dev: 581error_unreg_dev:
582 iio_device_unregister(indio_dev); 582 iio_device_unregister(indio_dev);
583error_free_dev: 583error_free_dev:
584 iio_free_device(indio_dev); 584 iio_device_free(indio_dev);
585 585
586 return ret; 586 return ret;
587} 587}
@@ -590,7 +590,7 @@ EXPORT_SYMBOL(ade7854_probe);
590int ade7854_remove(struct iio_dev *indio_dev) 590int ade7854_remove(struct iio_dev *indio_dev)
591{ 591{
592 iio_device_unregister(indio_dev); 592 iio_device_unregister(indio_dev);
593 iio_free_device(indio_dev); 593 iio_device_free(indio_dev);
594 594
595 return 0; 595 return 0;
596} 596}
diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c
index 48e70e9effd5..8b71eb0e16f5 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -112,7 +112,7 @@ static int __devinit ad2s1200_probe(struct spi_device *spi)
112 DRV_NAME, pins[pn]); 112 DRV_NAME, pins[pn]);
113 goto error_ret; 113 goto error_ret;
114 } 114 }
115 indio_dev = iio_allocate_device(sizeof(*st)); 115 indio_dev = iio_device_alloc(sizeof(*st));
116 if (indio_dev == NULL) { 116 if (indio_dev == NULL) {
117 ret = -ENOMEM; 117 ret = -ENOMEM;
118 goto error_ret; 118 goto error_ret;
@@ -142,7 +142,7 @@ static int __devinit ad2s1200_probe(struct spi_device *spi)
142 return 0; 142 return 0;
143 143
144error_free_dev: 144error_free_dev:
145 iio_free_device(indio_dev); 145 iio_device_free(indio_dev);
146error_ret: 146error_ret:
147 for (--pn; pn >= 0; pn--) 147 for (--pn; pn >= 0; pn--)
148 gpio_free(pins[pn]); 148 gpio_free(pins[pn]);
@@ -152,7 +152,7 @@ error_ret:
152static int __devexit ad2s1200_remove(struct spi_device *spi) 152static int __devexit ad2s1200_remove(struct spi_device *spi)
153{ 153{
154 iio_device_unregister(spi_get_drvdata(spi)); 154 iio_device_unregister(spi_get_drvdata(spi));
155 iio_free_device(spi_get_drvdata(spi)); 155 iio_device_free(spi_get_drvdata(spi));
156 156
157 return 0; 157 return 0;
158} 158}
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 4d580e238eb8..a236ddbee372 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -690,7 +690,7 @@ static int __devinit ad2s1210_probe(struct spi_device *spi)
690 if (spi->dev.platform_data == NULL) 690 if (spi->dev.platform_data == NULL)
691 return -EINVAL; 691 return -EINVAL;
692 692
693 indio_dev = iio_allocate_device(sizeof(*st)); 693 indio_dev = iio_device_alloc(sizeof(*st));
694 if (indio_dev == NULL) { 694 if (indio_dev == NULL) {
695 ret = -ENOMEM; 695 ret = -ENOMEM;
696 goto error_ret; 696 goto error_ret;
@@ -731,7 +731,7 @@ static int __devinit ad2s1210_probe(struct spi_device *spi)
731error_free_gpios: 731error_free_gpios:
732 ad2s1210_free_gpios(st); 732 ad2s1210_free_gpios(st);
733error_free_dev: 733error_free_dev:
734 iio_free_device(indio_dev); 734 iio_device_free(indio_dev);
735error_ret: 735error_ret:
736 return ret; 736 return ret;
737} 737}
@@ -742,7 +742,7 @@ static int __devexit ad2s1210_remove(struct spi_device *spi)
742 742
743 iio_device_unregister(indio_dev); 743 iio_device_unregister(indio_dev);
744 ad2s1210_free_gpios(iio_priv(indio_dev)); 744 ad2s1210_free_gpios(iio_priv(indio_dev));
745 iio_free_device(indio_dev); 745 iio_device_free(indio_dev);
746 746
747 return 0; 747 return 0;
748} 748}
diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c
index cb689104937f..a8057228dca1 100644
--- a/drivers/staging/iio/resolver/ad2s90.c
+++ b/drivers/staging/iio/resolver/ad2s90.c
@@ -64,7 +64,7 @@ static int __devinit ad2s90_probe(struct spi_device *spi)
64 struct ad2s90_state *st; 64 struct ad2s90_state *st;
65 int ret = 0; 65 int ret = 0;
66 66
67 indio_dev = iio_allocate_device(sizeof(*st)); 67 indio_dev = iio_device_alloc(sizeof(*st));
68 if (indio_dev == NULL) { 68 if (indio_dev == NULL) {
69 ret = -ENOMEM; 69 ret = -ENOMEM;
70 goto error_ret; 70 goto error_ret;
@@ -93,7 +93,7 @@ static int __devinit ad2s90_probe(struct spi_device *spi)
93 return 0; 93 return 0;
94 94
95error_free_dev: 95error_free_dev:
96 iio_free_device(indio_dev); 96 iio_device_free(indio_dev);
97error_ret: 97error_ret:
98 return ret; 98 return ret;
99} 99}
@@ -101,7 +101,7 @@ error_ret:
101static int __devexit ad2s90_remove(struct spi_device *spi) 101static int __devexit ad2s90_remove(struct spi_device *spi)
102{ 102{
103 iio_device_unregister(spi_get_drvdata(spi)); 103 iio_device_unregister(spi_get_drvdata(spi));
104 iio_free_device(spi_get_drvdata(spi)); 104 iio_device_free(spi_get_drvdata(spi));
105 105
106 return 0; 106 return 0;
107} 107}
diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
index 999fd2e00e81..f85734d212bb 100644
--- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
+++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
@@ -172,7 +172,7 @@ static int __devinit iio_bfin_tmr_trigger_probe(struct platform_device *pdev)
172 st->timer_num = ret; 172 st->timer_num = ret;
173 st->t = &iio_bfin_timer_code[st->timer_num]; 173 st->t = &iio_bfin_timer_code[st->timer_num];
174 174
175 st->trig = iio_allocate_trigger("bfintmr%d", st->timer_num); 175 st->trig = iio_trigger_alloc("bfintmr%d", st->timer_num);
176 if (!st->trig) { 176 if (!st->trig) {
177 ret = -ENOMEM; 177 ret = -ENOMEM;
178 goto out1; 178 goto out1;
@@ -203,7 +203,7 @@ static int __devinit iio_bfin_tmr_trigger_probe(struct platform_device *pdev)
203out4: 203out4:
204 iio_trigger_unregister(st->trig); 204 iio_trigger_unregister(st->trig);
205out2: 205out2:
206 iio_put_trigger(st->trig); 206 iio_trigger_put(st->trig);
207out1: 207out1:
208 kfree(st); 208 kfree(st);
209out: 209out:
@@ -217,7 +217,7 @@ static int __devexit iio_bfin_tmr_trigger_remove(struct platform_device *pdev)
217 disable_gptimers(st->t->bit); 217 disable_gptimers(st->t->bit);
218 free_irq(st->irq, st); 218 free_irq(st->irq, st);
219 iio_trigger_unregister(st->trig); 219 iio_trigger_unregister(st->trig);
220 iio_put_trigger(st->trig); 220 iio_trigger_put(st->trig);
221 kfree(st); 221 kfree(st);
222 222
223 return 0; 223 return 0;
diff --git a/drivers/staging/iio/trigger/iio-trig-gpio.c b/drivers/staging/iio/trigger/iio-trig-gpio.c
index 95fd2f780f52..90b26846fc6b 100644
--- a/drivers/staging/iio/trigger/iio-trig-gpio.c
+++ b/drivers/staging/iio/trigger/iio-trig-gpio.c
@@ -72,7 +72,7 @@ static int iio_gpio_trigger_probe(struct platform_device *pdev)
72 72
73 for (irq = irq_res->start; irq <= irq_res->end; irq++) { 73 for (irq = irq_res->start; irq <= irq_res->end; irq++) {
74 74
75 trig = iio_allocate_trigger("irqtrig%d", irq); 75 trig = iio_trigger_alloc("irqtrig%d", irq);
76 if (!trig) { 76 if (!trig) {
77 ret = -ENOMEM; 77 ret = -ENOMEM;
78 goto error_free_completed_registrations; 78 goto error_free_completed_registrations;
@@ -114,7 +114,7 @@ error_release_irq:
114error_free_trig_info: 114error_free_trig_info:
115 kfree(trig_info); 115 kfree(trig_info);
116error_put_trigger: 116error_put_trigger:
117 iio_put_trigger(trig); 117 iio_trigger_put(trig);
118error_free_completed_registrations: 118error_free_completed_registrations:
119 /* The rest should have been added to the iio_gpio_trigger_list */ 119 /* The rest should have been added to the iio_gpio_trigger_list */
120 list_for_each_entry_safe(trig, 120 list_for_each_entry_safe(trig,
@@ -144,7 +144,7 @@ static int iio_gpio_trigger_remove(struct platform_device *pdev)
144 iio_trigger_unregister(trig); 144 iio_trigger_unregister(trig);
145 free_irq(trig_info->irq, trig); 145 free_irq(trig_info->irq, trig);
146 kfree(trig_info); 146 kfree(trig_info);
147 iio_put_trigger(trig); 147 iio_trigger_put(trig);
148 } 148 }
149 mutex_unlock(&iio_gpio_trigger_list_lock); 149 mutex_unlock(&iio_gpio_trigger_list_lock);
150 150
diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
index 2c3ccda745eb..9f2d055524a3 100644
--- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
+++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
@@ -112,7 +112,7 @@ static int iio_trig_periodic_rtc_probe(struct platform_device *dev)
112 for (i = 0;; i++) { 112 for (i = 0;; i++) {
113 if (pdata[i] == NULL) 113 if (pdata[i] == NULL)
114 break; 114 break;
115 trig = iio_allocate_trigger("periodic%s", pdata[i]); 115 trig = iio_trigger_alloc("periodic%s", pdata[i]);
116 if (!trig) { 116 if (!trig) {
117 ret = -ENOMEM; 117 ret = -ENOMEM;
118 goto error_free_completed_registrations; 118 goto error_free_completed_registrations;
@@ -152,7 +152,7 @@ error_free_trig_info:
152 kfree(trig_info); 152 kfree(trig_info);
153error_put_trigger_and_remove_from_list: 153error_put_trigger_and_remove_from_list:
154 list_del(&trig->alloc_list); 154 list_del(&trig->alloc_list);
155 iio_put_trigger(trig); 155 iio_trigger_put(trig);
156error_free_completed_registrations: 156error_free_completed_registrations:
157 list_for_each_entry_safe(trig, 157 list_for_each_entry_safe(trig,
158 trig2, 158 trig2,
diff --git a/drivers/staging/iio/trigger/iio-trig-sysfs.c b/drivers/staging/iio/trigger/iio-trig-sysfs.c
index 404ef192f89f..552763bb3d4c 100644
--- a/drivers/staging/iio/trigger/iio-trig-sysfs.c
+++ b/drivers/staging/iio/trigger/iio-trig-sysfs.c
@@ -139,7 +139,7 @@ static int iio_sysfs_trigger_probe(int id)
139 goto out1; 139 goto out1;
140 } 140 }
141 t->id = id; 141 t->id = id;
142 t->trig = iio_allocate_trigger("sysfstrig%d", id); 142 t->trig = iio_trigger_alloc("sysfstrig%d", id);
143 if (!t->trig) { 143 if (!t->trig) {
144 ret = -ENOMEM; 144 ret = -ENOMEM;
145 goto free_t; 145 goto free_t;
@@ -158,7 +158,7 @@ static int iio_sysfs_trigger_probe(int id)
158 return 0; 158 return 0;
159 159
160out2: 160out2:
161 iio_put_trigger(t->trig); 161 iio_trigger_put(t->trig);
162free_t: 162free_t:
163 kfree(t); 163 kfree(t);
164out1: 164out1:
@@ -182,7 +182,7 @@ static int iio_sysfs_trigger_remove(int id)
182 } 182 }
183 183
184 iio_trigger_unregister(t->trig); 184 iio_trigger_unregister(t->trig);
185 iio_free_trigger(t->trig); 185 iio_trigger_free(t->trig);
186 186
187 list_del(&t->l); 187 list_del(&t->l);
188 kfree(t); 188 kfree(t);
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 9c0908a70466..d21833909327 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -400,10 +400,10 @@ int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
400extern struct bus_type iio_bus_type; 400extern struct bus_type iio_bus_type;
401 401
402/** 402/**
403 * iio_put_device() - reference counted deallocation of struct device 403 * iio_device_put() - reference counted deallocation of struct device
404 * @dev: the iio_device containing the device 404 * @dev: the iio_device containing the device
405 **/ 405 **/
406static inline void iio_put_device(struct iio_dev *indio_dev) 406static inline void iio_device_put(struct iio_dev *indio_dev)
407{ 407{
408 if (indio_dev) 408 if (indio_dev)
409 put_device(&indio_dev->dev); 409 put_device(&indio_dev->dev);
@@ -412,10 +412,10 @@ static inline void iio_put_device(struct iio_dev *indio_dev)
412/* Can we make this smaller? */ 412/* Can we make this smaller? */
413#define IIO_ALIGN L1_CACHE_BYTES 413#define IIO_ALIGN L1_CACHE_BYTES
414/** 414/**
415 * iio_allocate_device() - allocate an iio_dev from a driver 415 * iio_device_alloc() - allocate an iio_dev from a driver
416 * @sizeof_priv: Space to allocate for private structure. 416 * @sizeof_priv: Space to allocate for private structure.
417 **/ 417 **/
418struct iio_dev *iio_allocate_device(int sizeof_priv); 418struct iio_dev *iio_device_alloc(int sizeof_priv);
419 419
420static inline void *iio_priv(const struct iio_dev *indio_dev) 420static inline void *iio_priv(const struct iio_dev *indio_dev)
421{ 421{
@@ -429,10 +429,10 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv)
429} 429}
430 430
431/** 431/**
432 * iio_free_device() - free an iio_dev from a driver 432 * iio_device_free() - free an iio_dev from a driver
433 * @dev: the iio_dev associated with the device 433 * @dev: the iio_dev associated with the device
434 **/ 434 **/
435void iio_free_device(struct iio_dev *indio_dev); 435void iio_device_free(struct iio_dev *indio_dev);
436 436
437/** 437/**
438 * iio_buffer_enabled() - helper function to test if the buffer is enabled 438 * iio_buffer_enabled() - helper function to test if the buffer is enabled
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 1cfca231db8f..a9819940a84c 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -78,13 +78,13 @@ static inline struct iio_trigger *to_iio_trigger(struct device *d)
78 return container_of(d, struct iio_trigger, dev); 78 return container_of(d, struct iio_trigger, dev);
79}; 79};
80 80
81static inline void iio_put_trigger(struct iio_trigger *trig) 81static inline void iio_trigger_put(struct iio_trigger *trig)
82{ 82{
83 module_put(trig->ops->owner); 83 module_put(trig->ops->owner);
84 put_device(&trig->dev); 84 put_device(&trig->dev);
85}; 85};
86 86
87static inline void iio_get_trigger(struct iio_trigger *trig) 87static inline void iio_trigger_get(struct iio_trigger *trig)
88{ 88{
89 get_device(&trig->dev); 89 get_device(&trig->dev);
90 __module_get(trig->ops->owner); 90 __module_get(trig->ops->owner);
@@ -113,7 +113,7 @@ void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time);
113 113
114irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private); 114irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
115 115
116__printf(1, 2) struct iio_trigger *iio_allocate_trigger(const char *fmt, ...); 116__printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...);
117void iio_free_trigger(struct iio_trigger *trig); 117void iio_trigger_free(struct iio_trigger *trig);
118 118
119#endif /* _IIO_TRIGGER_H_ */ 119#endif /* _IIO_TRIGGER_H_ */