Skip to contentSkip to conversation

iio: dma-buffer: Cleanup buffer.h/buffer_impl.h includes

PATCH Applied Lars-Peter Clausen 3 participants 4 messages Apr 1, 2020 – Apr 5, 2020 IIO

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iio: dma-buffer: Cleanup buffer.h/buffer_impl.h includes

The IIO DMA buffer is a DMA buffer implementation. As such it should include buffer_impl.h rather than buffer.h.

The include to buffer.h in buffer-dma.h should be buffer_impl.h so it has access to the struct iio_buffer definition. The code currently only works because all places that use buffer-dma.h include buffer_impl.h before it.

The include to buffer.h in industrialio-buffer-dma.c can be removed since those file does not reference any of buffer consumer functions.

---
Changes since v1:
* Don't remove buffer.h include in buffer-dma.h since it is needed after all.

---
 drivers/iio/buffer/industrialio-buffer-dma.c | 1 -
 include/linux/iio/buffer-dma.h               | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/iio/buffer/industrialio-buffer-dma.c +0 -1
index a74bd9c0587c..d348af8b9705 100644
@@ -12,7 +12,6 @@
 #include <linux/mutex.h>
 #include <linux/sched.h>
 #include <linux/poll.h>
-#include <linux/iio/buffer.h>
 #include <linux/iio/buffer_impl.h>
 #include <linux/iio/buffer-dma.h>
 #include <linux/dma-mapping.h>
include/linux/iio/buffer-dma.h +1 -1
index 016d8a068353..ff15c61bf319 100644
@@ -11,7 +11,7 @@
 #include <linux/kref.h>
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
-#include <linux/iio/buffer.h>
+#include <linux/iio/buffer_impl.h>
 
 struct iio_dma_buffer_queue;
 struct iio_dma_buffer_ops;
Signature · 1 line
2.20.1
Tested-by on v2 1/1
#1 lore raw
Quoted 5 lines · Lars-Peter Clausen

[External]

The IIO DMA buffer is a DMA buffer implementation. As such it should include buffer_impl.h rather than buffer.h.

Quoted 7 lines

The include to buffer.h in buffer-dma.h should be buffer_impl.h so it has access to the struct iio_buffer definition. The code currently only works because all places that use buffer-dma.h include buffer_impl.h before it.

The include to buffer.h in industrialio-buffer-dma.c can be removed since those file does not reference any of buffer consumer functions.

Quoted 36 lines

---
Changes since v1:
* Don't remove buffer.h include in buffer-dma.h since it is needed after all.

---
 drivers/iio/buffer/industrialio-buffer-dma.c | 1 -
 include/linux/iio/buffer-dma.h               | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/iio/buffer/industrialio-buffer-dma.c +0 -1
index a74bd9c0587c..d348af8b9705 100644
@@ -12,7 +12,6 @@
 #include <linux/mutex.h>
 #include <linux/sched.h>
 #include <linux/poll.h>
-#include <linux/iio/buffer.h>
 #include <linux/iio/buffer_impl.h>
 #include <linux/iio/buffer-dma.h>
 #include <linux/dma-mapping.h>
include/linux/iio/buffer-dma.h +1 -1
index 016d8a068353..ff15c61bf319 100644
@@ -11,7 +11,7 @@
 #include <linux/kref.h>
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
-#include <linux/iio/buffer.h>
+#include <linux/iio/buffer_impl.h>
 
 struct iio_dma_buffer_queue;
 struct iio_dma_buffer_ops;
maintainer
#2 lore raw
Quoted 10 lines · Alexandru
Quoted 9 lines · Lars-Peter Clausen

[External]

The IIO DMA buffer is a DMA buffer implementation. As such it should include buffer_impl.h rather than buffer.h.

The include to buffer.h in buffer-dma.h should be buffer_impl.h so it has access to the struct iio_buffer definition. The code currently only works because all places that use buffer-dma.h include buffer_impl.h before it.

Quoted 5 lines
Quoted 3 lines

The include to buffer.h in industrialio-buffer-dma.c can be removed since those file does not reference any of buffer consumer functions.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 37 lines
Quoted 37 lines

---
Changes since v1:
* Don't remove buffer.h include in buffer-dma.h since it is needed after all.

---
 drivers/iio/buffer/industrialio-buffer-dma.c | 1 -
 include/linux/iio/buffer-dma.h               | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/iio/buffer/industrialio-buffer-dma.c +0 -1
index a74bd9c0587c..d348af8b9705 100644
@@ -12,7 +12,6 @@
 #include <linux/mutex.h>
 #include <linux/sched.h>
 #include <linux/poll.h>
-#include <linux/iio/buffer.h>
 #include <linux/iio/buffer_impl.h>
 #include <linux/iio/buffer-dma.h>
 #include <linux/dma-mapping.h>
include/linux/iio/buffer-dma.h +1 -1
index 016d8a068353..ff15c61bf319 100644
@@ -11,7 +11,7 @@
 #include <linux/kref.h>
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
-#include <linux/iio/buffer.h>
+#include <linux/iio/buffer_impl.h>
 
 struct iio_dma_buffer_queue;
 struct iio_dma_buffer_ops;  
maintainer Applied
#3 lore raw
In reply to Lars-Peter Clausen
Quoted 11 lines · On Wed, 1 Apr 2020 18:57:06 +0200 Lars-Peter Clausen <[email protected]> wrote:

The IIO DMA buffer is a DMA buffer implementation. As such it should include buffer_impl.h rather than buffer.h.

The include to buffer.h in buffer-dma.h should be buffer_impl.h so it has access to the struct iio_buffer definition. The code currently only works because all places that use buffer-dma.h include buffer_impl.h before it.

The include to buffer.h in industrialio-buffer-dma.c can be removed since those file does not reference any of buffer consumer functions.

Applied.

Thanks,

Jonathan

Quoted 34 lines

---
Changes since v1:
* Don't remove buffer.h include in buffer-dma.h since it is needed after all.

---
 drivers/iio/buffer/industrialio-buffer-dma.c | 1 -
 include/linux/iio/buffer-dma.h               | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/iio/buffer/industrialio-buffer-dma.c +0 -1
index a74bd9c0587c..d348af8b9705 100644
@@ -12,7 +12,6 @@
 #include <linux/mutex.h>
 #include <linux/sched.h>
 #include <linux/poll.h>
-#include <linux/iio/buffer.h>
 #include <linux/iio/buffer_impl.h>
 #include <linux/iio/buffer-dma.h>
 #include <linux/dma-mapping.h>
include/linux/iio/buffer-dma.h +1 -1
index 016d8a068353..ff15c61bf319 100644
@@ -11,7 +11,7 @@
 #include <linux/kref.h>
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
-#include <linux/iio/buffer.h>
+#include <linux/iio/buffer_impl.h>
 
 struct iio_dma_buffer_queue;
 struct iio_dma_buffer_ops;