iio: core: implement devm_iio_device_alloc/devm_iio_device_free
authorGrygorii Strashko <grygorii.strashko@ti.com>
Thu, 18 Jul 2013 10:19:00 +0000 (11:19 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 3 Aug 2013 17:40:37 +0000 (18:40 +0100)
commit9dabaf5eddbafa21aded7c063cb38d2e8936c237
tree2f2d04842bc15b761d48f51603e511f7e2a2b946
parent60b188f0d679656a1a2603d3bc1fa005373f4b9c
iio: core: implement devm_iio_device_alloc/devm_iio_device_free

Add a resource managed devm_iio_device_alloc()/devm_iio_device_free()
to automatically clean up any allocations made by IIO drivers,
thus leading to simplified IIO drivers code.

In addition, this will allow IIO drivers to use other devm_*() API
(like devm_request_irq) and don't care about the race between
iio_device_free() and the release of resources by Device core
during driver removing.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Tested-by: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/industrialio-core.c
include/linux/iio/iio.h