git: 4e94b3542dd6 - stable/13 - linuxkpi: move io_mapping_create_wc to .c

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 05 Apr 2022 14:42:35 UTC
The branch stable/13 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=4e94b3542dd6a5c3f60431e811013f4dbf603227

commit 4e94b3542dd6a5c3f60431e811013f4dbf603227
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-05 05:06:37 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-05 14:40:11 +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
    
    (cherry picked from commit 132b00f90613d8cc797137d4c3d2dcb99ba3c690)
---
 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 a146b7bc9aa0..a574f8bad0f1 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -86,6 +86,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>
@@ -2717,6 +2718,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