git: 91e54839545f - main - linuxkpi: Document why <linux/pci.h> can't include <linux/ioport.h>

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Mon, 06 Apr 2026 19:55:34 UTC
The branch main has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=91e54839545f6cb91bb1a5f768ddd6c1e2420b48

commit 91e54839545f6cb91bb1a5f768ddd6c1e2420b48
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-03-08 09:45:48 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-04-06 19:28:10 +0000

    linuxkpi: Document why <linux/pci.h> can't include <linux/ioport.h>
    
    Reviewed by:    bz, emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D55738
---
 sys/compat/linuxkpi/common/include/linux/pci.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index ccbd425de5da..ba68a9ee0dc3 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -60,6 +60,17 @@
 #include <linux/pci_ids.h>
 #include <linux/pm.h>
 
+/*
+ * <linux/ioport.h> should be included here, like Linux, but we can't have that
+ * because Linux `struct resource` definition would conflict with FreeBSD
+ * native definition.
+ *
+ * At least the amdgpu DRM driver (amdgpu_isp.c at the time of this writing)
+ * relies on this indirect include to get the definition of Linux `struct
+ * resource`. As a workaround, we include <linux/ioport.h> from
+ * <linux/mfd/core.h>.
+ */
+
 #include <linux/kernel.h>	/* pr_debug */
 
 struct pci_device_id {