aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2026-03-08 09:40:38 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2026-04-06 19:28:09 +0000
commit356d6f47d3b54b34aaba9e60aa551f3d615d0e2f (patch)
tree2138eedcf5e1a9526ad0cc0ed8213d3cd28717bd
parentca6ea6df1f9241346d043a2091484ac9ced6580e (diff)
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
-rw-r--r--sys/compat/linuxkpi/common/include/linux/mfd/core.h49
-rw-r--r--sys/compat/linuxkpi/dummy/include/linux/mfd/core.h0
2 files changed, 49 insertions, 0 deletions
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
--- a/sys/compat/linuxkpi/dummy/include/linux/mfd/core.h
+++ /dev/null