Skip to contentSkip to conversation

staging:iio: Remove declaration for non existing function

PATCH In review Lars-Peter Clausen 2 participants 4 messages Feb 10, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 staging:iio: Remove declaration for non existing function

The declaration for iio_buffer_deinit has been around for quite some time, but the function itself has never been added. So remove the declaration.

---
 drivers/staging/iio/buffer.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/staging/iio/buffer.h +0 -2
index 6fb6e64..df2046d 100644
@@ -91,8 +91,6 @@ struct iio_buffer {
  **/
 void iio_buffer_init(struct iio_buffer *buffer);
 
-void iio_buffer_deinit(struct iio_buffer *buffer);
-
 /**
  * __iio_update_buffer() - update common elements of buffers
  * @buffer:		buffer that is the event source
Signature · 1 line
1.7.9
#1 lore raw

PATCH 2/2 staging:iio: Remove noop calls to __iio_update_buffer

__iio_update_buffer updates the buffer's bytes_per_datum and length attributes. But in these two cases we indirectly just pass the existing values, so the call becomes a noop and can be removed.

---
We might as well also remove the function itself, since these are the only two users. What do you think?

---
 drivers/staging/iio/kfifo_buf.c |    1 -
 drivers/staging/iio/ring_sw.c   |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)
drivers/staging/iio/kfifo_buf.c +0 -1
index 9f3bd59..468e202 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(&buf->kf, bytes_per_datum*length, GFP_KERNEL);
 }
 
drivers/staging/iio/ring_sw.c +0 -1
index eeac0da..5664372 100644
@@ -46,7 +46,6 @@ static inline int __iio_allocate_sw_ring_buffer(struct iio_sw_ring_buffer *ring,
 {
 	if ((length == 0) || (bytes_per_datum == 0))
 		return -EINVAL;
-	__iio_update_buffer(&ring->buf, bytes_per_datum, length);
 	ring->data = kmalloc(length*ring->buf.bytes_per_datum, GFP_ATOMIC);
 	ring->read_p = NULL;
 	ring->write_p = NULL;
Signature · 1 line
1.7.9
maintainer Acked-by on v1 1/2
#3 lore raw
In reply to Lars-Peter Clausen
Quoted 3 lines · Lars-Peter Clausen

The declaration for iio_buffer_deinit has been around for quite some time, but the function itself has never been added. So remove the declaration.

oops

Quoted 1 line
Quoted 17 lines
---
 drivers/staging/iio/buffer.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/staging/iio/buffer.h +0 -2
index 6fb6e64..df2046d 100644
@@ -91,8 +91,6 @@ struct iio_buffer {
  **/
 void iio_buffer_init(struct iio_buffer *buffer);
 
-void iio_buffer_deinit(struct iio_buffer *buffer);
-
 /**
  * __iio_update_buffer() - update common elements of buffers
  * @buffer:		buffer that is the event source
maintainer Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] staging:iio: Remove noop calls to __iio_update_buffer

In reply to Lars-Peter Clausen
Quoted 3 lines · Lars-Peter Clausen

__iio_update_buffer updates the buffer's bytes_per_datum and length attributes. But in these two cases we indirectly just pass the existing values, so the call becomes a noop and can be removed.

That is novel. I hope if I looked back at the history that would make sense at somepoint and it's just gotten like this via refactoring... Feel free to drop the function as the __ marks it as very much internal only and it clearly isn't used internally for anything useful.

Good catch. Ack is for version with function also removed.

Quoted 2 lines
Quoted 32 lines

---
We might as well also remove the function itself, since these are the only two users. What do you think?

---
 drivers/staging/iio/kfifo_buf.c |    1 -
 drivers/staging/iio/ring_sw.c   |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)
drivers/staging/iio/kfifo_buf.c +0 -1
index 9f3bd59..468e202 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(&buf->kf, bytes_per_datum*length, GFP_KERNEL);
 }
 
drivers/staging/iio/ring_sw.c +0 -1
index eeac0da..5664372 100644
@@ -46,7 +46,6 @@ static inline int __iio_allocate_sw_ring_buffer(struct iio_sw_ring_buffer *ring,
 {
 	if ((length == 0) || (bytes_per_datum == 0))
 		return -EINVAL;
-	__iio_update_buffer(&ring->buf, bytes_per_datum, length);
 	ring->data = kmalloc(length*ring->buf.bytes_per_datum, GFP_ATOMIC);
 	ring->read_p = NULL;
 	ring->write_p = NULL;