dma-buf: remove pci-p2pdma include from dma-buf.h v2
PATCH 1/1 dma-buf: remove pci-p2pdma include from dma-buf.h v2
That is unecessary here and creates an unwanted dependency to the PCI subsystem.
Use forward declare in dma-buf-mapping.h instead.
v2: switch to forward declare
--- include/linux/dma-buf-mapping.h | 2 ++ include/linux/dma-buf.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
include/linux/dma-buf-mapping.h +2 -0
@@ -7,6 +7,8 @@#define __DMA_BUF_MAPPING_H__#include <linux/dma-buf.h> +struct p2pdma_provider ; + struct sg_table *dma_buf_phys_vec_to_sgt(struct dma_buf_attachment *attach, struct p2pdma_provider *provider, struct phys_vec *phys_vec,
include/linux/dma-buf.h +0 -1
@@ -22,7 +22,6 @@#include <linux/fs.h> #include <linux/dma-fence.h> #include <linux/wait.h> -#include <linux/pci-p2pdma.h> struct device ;struct dma_buf ;
Signature · 1 line
2.43.0
Quoted 5 lines · Christian König
That is unecessary here and creates an unwanted dependency to the PCI subsystem.
Use forward declare in
dma-buf-mapping.hinstead.
Quoted 7 lines
v2: switch to forward declare
Signed-off-by Christian König <[email protected]>--- include/linux/dma-buf-mapping.h | 2 ++ include/linux/dma-buf.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
Jason
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] dma-buf: build failure in dma-buf-mapping.c due to missing pci-p2pdma include --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dma-buf: build failure in dma-buf-mapping.c due to missing pci-p2pdma include --
commit 8de2b0ebefc837cd0e3d5d4be72922d840602ba3
Author: Christian König <[email protected]>
dma-buf: remove pci-p2pdma include from dma-buf.h v2
This commit removes the <linux/pci-p2pdma.h> include from <linux/dma-buf.h> to eliminate an unwanted dependency on the PCI subsystem. It uses a forward declaration in <linux/dma-buf-mapping.h> instead.
include/linux/dma-buf.h line 25
Quoted 9 lines
include/linux/dma-buf.h +0
-1@@ -22,7 +22,6 @@#include <linux/fs.h> #include <linux/dma-fence.h> #include <linux/wait.h> -#include <linux/pci-p2pdma.h>
[Severity: Low]
Does removing this include break the build fordrivers/dma-buf/dma-buf-mapping.c?
That file unconditionally uses functions and enum values from the pci-p2pdma header without explicitly including it, relying on this transitive inclusion. For example:
drivers/dma-buf/dma-buf-mapping.c:dma_buf_phys_vec_to_sgt() {
...
switch (pci_p2pdma_map_type(provider, attach->dev)) {
case PCI_P2PDMA_MAP_BUS_ADDR:...
}
Will this lead to a compile-time failure for drivers/dma-buf/dma-buf-mapping.c due to undeclared identifiers?
Quoted 3 lines
include/linux/dma-buf.h +0
-0struct device ;struct dma_buf ;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 9 lines · Christian König
That is unecessary here and creates an unwanted dependency to the PCI subsystem.
Use forward declare in
dma-buf-mapping.hinstead.v2: switch to forward declare
Signed-off-by Christian König <[email protected]>---
It is better to put the changelog below the --- line, as this information does not add anything useful for readers of the Git log.
Quoted 3 lines
include/linux/dma-buf-mapping.h | 2 ++ include/linux/dma-buf.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
I would expect #include <linux/pci-p2pdma.h> to be in drivers/dma-buf/dma-buf-mapping.c instead.
Thanks
Quoted 29 lines
include/linux/dma-buf-mapping.h +2
-0@@ -7,6 +7,8 @@#define __DMA_BUF_MAPPING_H__#include <linux/dma-buf.h> +struct p2pdma_provider ; + struct sg_table *dma_buf_phys_vec_to_sgt(struct dma_buf_attachment *attach, struct p2pdma_provider *provider, struct phys_vec *phys_vec,include/linux/dma-buf.h +0
-1@@ -22,7 +22,6 @@#include <linux/fs.h> #include <linux/dma-fence.h> #include <linux/wait.h> -#include <linux/pci-p2pdma.h> struct device ;struct dma_buf ;Signature · 1 line
2.43.0