diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-04 22:33:27 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-11 11:36:11 -0700 |
commit | 19ca92e0bca3499a12eb9b612b90bbe90d2cc895 (patch) | |
tree | 4ecf950ebf9bb42e6d9bfdc71d05c5159eb5843e /drivers | |
parent | 0deebb4fc4784699afec04231f981aaad3126ff9 (diff) |
Staging: iio: ring_sw.c: fix up sparse warnings
NULL usage, static stuff, etc.
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/iio/ring_sw.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/staging/iio/ring_sw.c b/drivers/staging/iio/ring_sw.c index 5ee3e4533515..1f14cd4770e7 100644 --- a/drivers/staging/iio/ring_sw.c +++ b/drivers/staging/iio/ring_sw.c @@ -21,10 +21,10 @@ static inline int __iio_allocate_sw_ring_buffer(struct iio_sw_ring_buffer *ring, return -EINVAL; __iio_update_ring_buffer(&ring->buf, bytes_per_datum, length); ring->data = kmalloc(length*ring->buf.bpd, GFP_KERNEL); - ring->read_p = 0; - ring->write_p = 0; - ring->last_written_p = 0; - ring->half_p = 0; + ring->read_p = NULL; + ring->write_p = NULL; + ring->last_written_p = NULL; + ring->half_p = NULL; return ring->data ? 0 : -ENOMEM; } @@ -62,16 +62,15 @@ EXPORT_SYMBOL(iio_unmark_sw_rb_in_use); * in the device driver */ /* Lock always held if their is a chance this may be called */ /* Only one of these per ring may run concurrently - enforced by drivers */ -int iio_store_to_sw_ring(struct iio_sw_ring_buffer *ring, - unsigned char *data, - s64 timestamp) +static int iio_store_to_sw_ring(struct iio_sw_ring_buffer *ring, + unsigned char *data, s64 timestamp) { int ret = 0; int code; unsigned char *temp_ptr, *change_test_ptr; /* initial store */ - if (unlikely(ring->write_p == 0)) { + if (unlikely(ring->write_p == NULL)) { ring->write_p = ring->data; /* Doesn't actually matter if this is out of the set * as long as the read pointer is valid before this @@ -102,7 +101,7 @@ int iio_store_to_sw_ring(struct iio_sw_ring_buffer *ring, */ ring->write_p = temp_ptr; - if (ring->read_p == 0) + if (ring->read_p == NULL) ring->read_p = ring->data; /* Buffer full - move the read pointer and create / escalate * ring event */ @@ -182,7 +181,7 @@ int iio_rip_sw_rb(struct iio_ring_buffer *r, /* build local copy */ initial_read_p = ring->read_p; - if (unlikely(initial_read_p == 0)) { /* No data here as yet */ + if (unlikely(initial_read_p == NULL)) { /* No data here as yet */ ret = 0; goto error_free_data_cpy; } @@ -280,8 +279,8 @@ int iio_store_to_sw_rb(struct iio_ring_buffer *r, u8 *data, s64 timestamp) } EXPORT_SYMBOL(iio_store_to_sw_rb); -int iio_read_last_from_sw_ring(struct iio_sw_ring_buffer *ring, - unsigned char *data) +static int iio_read_last_from_sw_ring(struct iio_sw_ring_buffer *ring, + unsigned char *data) { unsigned char *last_written_p_copy; @@ -291,7 +290,7 @@ again: last_written_p_copy = ring->last_written_p; barrier(); /*unnessecary? */ /* Check there is anything here */ - if (last_written_p_copy == 0) + if (last_written_p_copy == NULL) return -EAGAIN; memcpy(data, last_written_p_copy, ring->buf.bpd); @@ -412,7 +411,7 @@ struct iio_ring_buffer *iio_sw_rb_allocate(struct iio_dev *indio_dev) ring = kzalloc(sizeof *ring, GFP_KERNEL); if (!ring) - return 0; + return NULL; buf = &ring->buf; iio_ring_buffer_init(buf, indio_dev); __iio_init_sw_ring_buffer(ring); |