git: 132b00f90613 - main - linuxkpi: move io_mapping_create_wc to .c

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 05 Apr 2022 05:10:08 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=132b00f90613d8cc797137d4c3d2dcb99ba3c690

commit 132b00f90613d8cc797137d4c3d2dcb99ba3c690
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-05 05:06:37 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-05 05:06:37 +0000

    linuxkpi: move io_mapping_create_wc to .c
    
    Move io_mapping_create_wc to .c because it encodes the size of struct
    io_mapping so we move this from the client module to the linuxkpi
    module.
    
    Sponsored by:           Netflix
    Reviewed by:            hselasky, emaste
    Differential Revision:  https://reviews.freebsd.org/D34776
---
 sys/compat/linuxkpi/common/include/linux/io-mapping.h | 13 ++-----------
 sys/compat/linuxkpi/common/src/linux_compat.c         | 12 ++++++++++++
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/io-mapping.h b/sys/compat/linuxkpi/common/include/linux/io-mapping.h
index 9c7ad5095bf3..5c24f1ff8659 100644
--- a/sys/compat/linuxkpi/common/include/linux/io-mapping.h
+++ b/sys/compat/linuxkpi/common/include/linux/io-mapping.h
@@ -46,6 +46,8 @@ struct io_mapping {
 	vm_memattr_t attr;
 };
 
+struct io_mapping *io_mapping_create_wc(resource_size_t base, unsigned long size);
+
 static inline struct io_mapping *
 io_mapping_init_wc(struct io_mapping *mapping, resource_size_t base,
     unsigned long size)
@@ -63,17 +65,6 @@ io_mapping_init_wc(struct io_mapping *mapping, resource_size_t base,
 	return (mapping);
 }
 
-static inline struct io_mapping *
-io_mapping_create_wc(resource_size_t base, unsigned long size)
-{
-	struct io_mapping *mapping;
-
-	mapping = kmalloc(sizeof(*mapping), GFP_KERNEL);
-	if (mapping == NULL)
-		return (NULL);
-	return (io_mapping_init_wc(mapping, base, size));
-}
-
 static inline void
 io_mapping_fini(struct io_mapping *mapping)
 {
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 52dc010b100f..8644f67762d9 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$");
 #include <linux/kthread.h>
 #include <linux/kernel.h>
 #include <linux/compat.h>
+#include <linux/io-mapping.h>
 #include <linux/poll.h>
 #include <linux/smp.h>
 #include <linux/wait_bit.h>
@@ -2716,6 +2717,17 @@ linuxkpi_net_ratelimit(void)
 	   lkpi_net_maxpps));
 }
 
+struct io_mapping *
+io_mapping_create_wc(resource_size_t base, unsigned long size)
+{
+	struct io_mapping *mapping;
+
+	mapping = kmalloc(sizeof(*mapping), GFP_KERNEL);
+	if (mapping == NULL)
+		return (NULL);
+	return (io_mapping_init_wc(mapping, base, size));
+}
+
 #if defined(__i386__) || defined(__amd64__)
 bool linux_cpu_has_clflush;
 #endif