Skip to contentSkip to conversation

staging:iio: Remove noop call to __iio_update_buffer

PATCH In review Lars-Peter Clausen 2 participants 2 messages Jan 28, 2013 – Jan 30, 2013 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging:iio: Remove noop call to __iio_update_buffer

__iio_update_buffer updates the buffer's bytes_per_datum and length fields. But the only user of this function just passes in these exact fields, so the call basically looks like this:

	buffer->bytes_per_datum = buffer->bytes_per_datum;
	buffer->length = buffer->length;

Which means it is a noop and can be removed. Also remove the function itself, since it is now unused.

---
 drivers/iio/kfifo_buf.c    |  1 -
 include/linux/iio/buffer.h | 13 -------------
 2 files changed, 14 deletions(-)
drivers/iio/kfifo_buf.c +0 -1
index 5bc5c86..a923c78 100644
@@ -22,7 +22,6 @@ static inline int __iio_allocate_kfifo(struct iio_kfifo *buf,
 	if ((length == 0) || (bytes_per_datum == 0))
 		return -EINVAL;
 
-	__iio_update_buffer(&buf->buffer, bytes_per_datum, length);
 	return __kfifo_alloc((struct __kfifo *)&buf->kf, length,
 			     bytes_per_datum, GFP_KERNEL);
 }
include/linux/iio/buffer.h +0 -13
index f3eea18..2bac0eb 100644
@@ -103,19 +103,6 @@ int iio_update_buffers(struct iio_dev *indio_dev,
  **/
 void iio_buffer_init(struct iio_buffer *buffer);
 
-/**
- * __iio_update_buffer() - update common elements of buffers
- * @buffer:		buffer that is the event source
- * @bytes_per_datum:	size of individual datum including timestamp
- * @length:		number of datums in buffer
- **/
-static inline void __iio_update_buffer(struct iio_buffer *buffer,
-				       int bytes_per_datum, int length)
-{
-	buffer->bytes_per_datum = bytes_per_datum;
-	buffer->length = length;
-}
-
 int iio_scan_mask_query(struct iio_dev *indio_dev,
 			struct iio_buffer *buffer, int bit);
 
Signature · 1 line
1.8.0
maintainer
#1 lore raw
Quoted 9 lines · Lars-Peter Clausen

__iio_update_buffer updates the buffer's bytes_per_datum and length fields. But the only user of this function just passes in these exact fields, so the call basically looks like this:

	buffer->bytes_per_datum = buffer->bytes_per_datum;
	buffer->length = buffer->length;

Which means it is a noop and can be removed. Also remove the function itself, since it is now unused.

Good spot.

Quoted 2 lines

added to togreg branch of iio.git

Quoted 42 lines
---
 drivers/iio/kfifo_buf.c    |  1 -
 include/linux/iio/buffer.h | 13 -------------
 2 files changed, 14 deletions(-)
drivers/iio/kfifo_buf.c +0 -1
index 5bc5c86..a923c78 100644
@@ -22,7 +22,6 @@ static inline int __iio_allocate_kfifo(struct iio_kfifo *buf,
 	if ((length == 0) || (bytes_per_datum == 0))
 		return -EINVAL;
 
-	__iio_update_buffer(&buf->buffer, bytes_per_datum, length);
 	return __kfifo_alloc((struct __kfifo *)&buf->kf, length,
 			     bytes_per_datum, GFP_KERNEL);
 }
include/linux/iio/buffer.h +0 -13
index f3eea18..2bac0eb 100644
@@ -103,19 +103,6 @@ int iio_update_buffers(struct iio_dev *indio_dev,
  **/
 void iio_buffer_init(struct iio_buffer *buffer);
 
-/**
- * __iio_update_buffer() - update common elements of buffers
- * @buffer:		buffer that is the event source
- * @bytes_per_datum:	size of individual datum including timestamp
- * @length:		number of datums in buffer
- **/
-static inline void __iio_update_buffer(struct iio_buffer *buffer,
-				       int bytes_per_datum, int length)
-{
-	buffer->bytes_per_datum = bytes_per_datum;
-	buffer->length = length;
-}
-
 int iio_scan_mask_query(struct iio_dev *indio_dev,
 			struct iio_buffer *buffer, int bit);