diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2010-03-02 13:35:35 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-11 11:35:32 -0700 |
commit | 6f2dfb3101bb431ae9adc827fa8526d699e9dbd0 (patch) | |
tree | 8d94b43bf5855ed8d240b6183cff6ffbc5f71c6b /drivers/staging/iio/ring_generic.h | |
parent | 3e18951955797872558dad615851a4ca63b2770e (diff) |
staging: IIO: Fix uses of spinlocks prior to init in ring implementations
Some confusion was caused by the ___iio_init_ring_buffer and equivalent
in ring_sw handling both init of spin locks etc and allocation and
of the actual buffer. This resulted in ring->use_lock being held
before it was initialized and actually during the initialization.
Some of the recent cleanups in the spin lock code seem to have triggered
the bug actually causing traceable crashes.
The following patch should fix this but hasn't been extensively tested
as of yet and there may well be some side effects I haven't thought of.
Just wanted to get this out there before anyone else runs into it!
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/ring_generic.h')
-rw-r--r-- | drivers/staging/iio/ring_generic.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/staging/iio/ring_generic.h b/drivers/staging/iio/ring_generic.h index 09044adf732..75e0fc078d6 100644 --- a/drivers/staging/iio/ring_generic.h +++ b/drivers/staging/iio/ring_generic.h @@ -134,19 +134,17 @@ void iio_ring_buffer_init(struct iio_ring_buffer *ring, struct iio_dev *dev_info); /** - * __iio_init_ring_buffer() - initialize common elements of ring buffers + * __iio_update_ring_buffer() - update common elements of ring buffers * @ring: ring buffer that is the event source * @bytes_per_datum: size of individual datum including timestamp * @length: number of datums in ring **/ -static inline void __iio_init_ring_buffer(struct iio_ring_buffer *ring, - int bytes_per_datum, int length) +static inline void __iio_update_ring_buffer(struct iio_ring_buffer *ring, + int bytes_per_datum, int length) { ring->bpd = bytes_per_datum; ring->length = length; ring->loopcount = 0; - ring->shared_ev_pointer.ev_p = 0; - spin_lock_init(&ring->shared_ev_pointer.lock); } /** |