git: 356d6f47d3b5 - main - linuxkpi: Add <linux/mfd/core.h>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=356d6f47d3b54b34aaba9e60aa551f3d615d0e2f

commit 356d6f47d3b54b34aaba9e60aa551f3d615d0e2f
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-03-08 09:40:38 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-04-06 19:28:09 +0000

    linuxkpi: Add <linux/mfd/core.h>
    
    To be exact, there was a dummy file with no content before. This commit
    defines `struct mfd_cell` and adds two function stubs.
    
    The function stubs are not implemented but still return success. They
    log a message to indicate they need to be implemented.
    
    Also, unlike Linux, <linux/mfd/core.h> includes <linux/ioport.h>. This
    works around the fact that we can't include <linux/ioport.h> from
    <linux/pci.h>, due to a conflict with the FreeBSD-native `struct
    resource`.
    
    The amdgpu DRM driver started to use it in Linux 6.11.
    
    Reviewed by:    bz, emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D55736
---
 .../linuxkpi/common/include/linux/mfd/core.h       | 49 ++++++++++++++++++++++
 sys/compat/linuxkpi/dummy/include/linux/mfd/core.h |  0
 2 files changed, 49 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/mfd/core.h b/sys/compat/linuxkpi/common/include/linux/mfd/core.h
new file mode 100644
index 000000000000..1a69a3803b5d
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/mfd/core.h
@@ -0,0 +1,49 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 The FreeBSD Foundation
+ */
+
+#ifndef	_LINUXKPI_LINUX_MFD_CORE_H_
+#define	_LINUXKPI_LINUX_MFD_CORE_H_
+
+#include <linux/platform_device.h>
+
+/*
+ * <linux/ioport.h> is not included by Linux, but we need it here to get the
+ * definition of `struct resource`.
+ *
+ * At least the amdgpu DRM driver (amdgpu_isp.c at the time of this writing)
+ * needs the structure without including this header: it relies on an implicit
+ * include of <linux/ioport.h> from <linux/pci.h>, which we can't have due to
+ * conflict with the FreeBSD native `struct resource`.
+ */
+#include <linux/ioport.h>
+
+#include <linux/kernel.h> /* pr_debug */
+
+struct resource;
+struct mfd_cell {
+	const char		*name;
+	void			*platform_data;
+	size_t			 pdata_size;
+	int			 num_resources;
+	const struct resource	*resources;
+};
+
+static inline int
+mfd_add_hotplug_devices(struct device *parent,
+    const struct mfd_cell *cells, int n_devs)
+{
+	pr_debug("%s: TODO\n", __func__);
+
+	return (0);
+}
+
+static inline void
+mfd_remove_devices(struct device *parent)
+{
+	pr_debug("%s: TODO\n", __func__);
+}
+
+#endif /* _LINUXKPI_LINUX_MFD_CORE_H_ */
diff --git a/sys/compat/linuxkpi/dummy/include/linux/mfd/core.h b/sys/compat/linuxkpi/dummy/include/linux/mfd/core.h
deleted file mode 100644
index e69de29bb2d1..000000000000