alistair23-linux/include
Lars-Peter Clausen 9e69c935fa iio: Add reference counting for buffers
Since the buffer is accessed by userspace we can not just free the buffers
memory once we are done with it in kernel space. There might still be open file
descriptors and userspace still might be accessing the buffer. This patch adds
support for reference counting to the IIO buffers. When a buffer is created and
initialized its initial reference count is set to 1. Instead of freeing the
memory of the buffer the buffer's _free() function will drop that reference
again. But only after the last reference to the buffer has been dropped the
buffer the buffer's memory will be freed. The IIO device will take a reference
to its primary buffer. The patch adds a small helper function for this called
iio_device_attach_buffer() which will get a reference to the buffer and assign
the buffer to the IIO device. This function must be used instead of assigning
the buffer to the device by hand. The reference is only dropped once the IIO
device is freed and we can be sure that there are no more open file handles. A
reference to a buffer will also be taken whenever the buffer is active to avoid
the buffer being freed while data is still being send to it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-12 12:04:01 +01:00
..
acpi
asm-generic mm: Fix generic hugetlb pte check return type. 2013-10-02 20:02:35 -04:00
clocksource ARM: SoC cleanups for 3.12 2013-09-06 13:21:16 -07:00
crypto
drm Revert "drm: mark context support as a legacy subsystem" 2013-09-20 08:32:59 +10:00
dt-bindings Device tree core updates for v3.12 2013-09-10 13:53:52 -07:00
keys
kvm
linux iio: Add reference counting for buffers 2013-10-12 12:04:01 +01:00
math-emu
media Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-09-05 14:54:29 -07:00
memory
misc
net Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf 2013-10-01 12:39:35 -04:00
pcmcia
ras
rdma
rxrpc
scsi Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2013-09-12 16:11:45 -07:00
sound sound fixes for 3.12-rc1 2013-09-12 08:52:41 -07:00
target target/iscsi: Bump versions to v4.1.0 2013-09-10 20:23:37 -07:00
trace Merge branch 'for-3.12/core' of git://git.kernel.dk/linux-block 2013-09-22 15:00:11 -07:00
uapi Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux 2013-09-29 10:02:40 -07:00
video fbdev changes for 3.12: 2013-09-05 09:49:32 -07:00
xen Features: 2013-09-04 17:45:39 -07:00
Kbuild