dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma-buf: remove pci-p2pdma include from dma-buf.h v2
@ 2026-09-21 12:36 Christian König
  2026-09-21 12:37 ` Jason Gunthorpe
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christian König @ 2026-09-21 12:36 UTC (permalink / raw)
  To: kevin.tian, jgg, nicolinc, leonro, leon, dri-devel; +Cc: Christian König

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

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 include/linux/dma-buf-mapping.h | 2 ++
 include/linux/dma-buf.h         | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/dma-buf-mapping.h b/include/linux/dma-buf-mapping.h
index 09bde3f748e4..64c03608cce7 100644
--- a/include/linux/dma-buf-mapping.h
+++ b/include/linux/dma-buf-mapping.h
@@ -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,
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index d15b2b31d3c9..159271fcf3d2 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -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;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-buf: remove pci-p2pdma include from dma-buf.h v2
  2026-09-21 12:36 [PATCH] dma-buf: remove pci-p2pdma include from dma-buf.h v2 Christian König
@ 2026-09-21 12:37 ` Jason Gunthorpe
  2026-09-21 12:43 ` sashiko-bot
  2026-09-22 12:36 ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2026-09-21 12:37 UTC (permalink / raw)
  To: Christian König
  Cc: kevin.tian, nicolinc, leonro, leon, dri-devel,
	Christian König

On Mon, Sep 21, 2026 at 02:36:13PM +0200, Christian König wrote:
> 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
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  include/linux/dma-buf-mapping.h | 2 ++
>  include/linux/dma-buf.h         | 1 -
>  2 files changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-buf: remove pci-p2pdma include from dma-buf.h v2
  2026-09-21 12:36 [PATCH] dma-buf: remove pci-p2pdma include from dma-buf.h v2 Christian König
  2026-09-21 12:37 ` Jason Gunthorpe
@ 2026-09-21 12:43 ` sashiko-bot
  2026-09-22 12:36 ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-09-21 12:43 UTC (permalink / raw)
  To: Christian König; +Cc: dri-devel

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 <ckoenig.leichtzumerken@gmail.com>
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.

> diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
> index d15b2b31d3c91..159271fcf3d2e 100644
> --- a/include/linux/dma-buf.h
> +++ b/include/linux/dma-buf.h
> @@ -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 for
drivers/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?

>  
>  struct device;
>  struct dma_buf;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260921123613.683042-1-christian.koenig@amd.com?part=1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dma-buf: remove pci-p2pdma include from dma-buf.h v2
  2026-09-21 12:36 [PATCH] dma-buf: remove pci-p2pdma include from dma-buf.h v2 Christian König
  2026-09-21 12:37 ` Jason Gunthorpe
  2026-09-21 12:43 ` sashiko-bot
@ 2026-09-22 12:36 ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2026-09-22 12:36 UTC (permalink / raw)
  To: Christian König
  Cc: kevin.tian, jgg, nicolinc, dri-devel, Christian König

On Mon, Sep 21, 2026 at 02:36:13PM +0200, Christian König wrote:
> 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
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---

It is better to put the changelog below the `---` line, as this information
does not add anything useful for readers of the Git log.

>  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

> 
> diff --git a/include/linux/dma-buf-mapping.h b/include/linux/dma-buf-mapping.h
> index 09bde3f748e4..64c03608cce7 100644
> --- a/include/linux/dma-buf-mapping.h
> +++ b/include/linux/dma-buf-mapping.h
> @@ -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,
> diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
> index d15b2b31d3c9..159271fcf3d2 100644
> --- a/include/linux/dma-buf.h
> +++ b/include/linux/dma-buf.h
> @@ -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;
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-22 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-21 12:36 [PATCH] dma-buf: remove pci-p2pdma include from dma-buf.h v2 Christian König
2026-09-21 12:37 ` Jason Gunthorpe
2026-09-21 12:43 ` sashiko-bot
2026-09-22 12:36 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox