Skip to contentSkip to conversation

swiotlb: Make linux/swiotlb.h standalone includable

PATCH Superseded Thierry Reding 2 participants 2 messages Aug 5, 2014 DMA mapping helpers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 swiotlb: Make linux/swiotlb.h standalone includable

From: Thierry Reding <[email protected]>

This header file uses the enum dma_data_direction and struct page types without explicitly including the corresponding header files. This makes it rely on the includer to have included the proper headers before.

To fix this, include linux/dma-direction.h and forward-declare struct page. The swiotlb_free() function is also annotated __init, therefore requires linux/init.h to be included as well.

---
Alternatively rather than include linux/init.h for swiotlb_free() it should be possible to simply remove the annotation in the header since the implementation already has it and that's where it matters.

 include/linux/swiotlb.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/swiotlb.h +3 -0
index e7a018eaf3a2..017fced60242 100644
@@ -1,10 +1,13 @@
 #ifndef __LINUX_SWIOTLB_H
 #define __LINUX_SWIOTLB_H
 
+#include <linux/dma-direction.h>
+#include <linux/init.h>
 #include <linux/types.h>
 
 struct device;
 struct dma_attrs;
+struct page;
 struct scatterlist;
 
 extern int swiotlb_force;
Signature · 1 line
2.0.4
#1 lore raw
Quoted 10 lines · Thierry Reding

From: Thierry Reding <[email protected]>

This header file uses the enum dma_data_direction and struct page types without explicitly including the corresponding header files. This makes it rely on the includer to have included the proper headers before.

To fix this, include linux/dma-direction.h and forward-declare struct page. The swiotlb_free() function is also annotated __init, therefore requires linux/init.h to be included as well.

Quoted 5 lines

---
Alternatively rather than include linux/init.h for swiotlb_free() it should be possible to simply remove the annotation in the header since the implementation already has it and that's where it matters.

This is fine. Will queue it up for 3.17. Thanks!

Quoted 25 lines
 include/linux/swiotlb.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/swiotlb.h +3 -0
index e7a018eaf3a2..017fced60242 100644
@@ -1,10 +1,13 @@
 #ifndef __LINUX_SWIOTLB_H
 #define __LINUX_SWIOTLB_H
 
+#include <linux/dma-direction.h>
+#include <linux/init.h>
 #include <linux/types.h>
 
 struct device;
 struct dma_attrs;
+struct page;
 struct scatterlist;
 
 extern int swiotlb_force;
Signature · 1 line
2.0.4