git: d3113190ddf6 - releng/13.1 - linuxkpi: move kobject_create to .c file

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 06 Apr 2022 17:46:03 UTC
The branch releng/13.1 has been updated by imp:

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

commit d3113190ddf610fe9263efa2d01cc6725cd67d75
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-05 05:05:26 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-06 17:45:15 +0000

    linuxkpi: move kobject_create to .c file
    
    kobject_create knows the size of struct kobject. Move it to
    linux_compat.c so this knowledge is confined to the loadable module and
    not the clients.
    
    Approved by:            re@ (gjb)
    Sponsored by:           Netflix
    Reviewed by:            hselasky, emaste
    Differential Revision:  https://reviews.freebsd.org/D34767
    
    (cherry picked from commit 36929b55849c8f553a744d6e4fbc8b1a5ff73f66)
    (cherry picked from commit 2f3d11894be6fb727be77184d232de24bf5551ba)
---
 sys/compat/linuxkpi/common/include/linux/kobject.h | 14 +-------------
 sys/compat/linuxkpi/common/src/linux_compat.c      | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/kobject.h b/sys/compat/linuxkpi/common/include/linux/kobject.h
index e6f716254c93..ad25058028fc 100644
--- a/sys/compat/linuxkpi/common/include/linux/kobject.h
+++ b/sys/compat/linuxkpi/common/include/linux/kobject.h
@@ -107,23 +107,11 @@ kobject_get(struct kobject *kobj)
 	return kobj;
 }
 
+struct kobject *kobject_create(void);
 int	kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list);
 int	kobject_add(struct kobject *kobj, struct kobject *parent,
 	    const char *fmt, ...);
 
-static inline struct kobject *
-kobject_create(void)
-{
-	struct kobject *kobj;
-
-	kobj = kzalloc(sizeof(*kobj), GFP_KERNEL);
-	if (kobj == NULL)
-		return (NULL);
-	kobject_init(kobj, &linux_kfree_type);
-
-	return (kobj);
-}
-
 static inline struct kobject *
 kobject_create_and_add(const char *name, struct kobject *parent)
 {
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 666a1bd07970..88bc1dd355ac 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -155,6 +155,20 @@ RB_GENERATE(linux_root, rb_node, __entry, panic_cmp);
 INTERVAL_TREE_DEFINE(struct interval_tree_node, rb, unsigned long,, START,
     LAST,, lkpi_interval_tree)
 
+struct kobject *
+kobject_create(void)
+{
+	struct kobject *kobj;
+
+	kobj = kzalloc(sizeof(*kobj), GFP_KERNEL);
+	if (kobj == NULL)
+		return (NULL);
+	kobject_init(kobj, &linux_kfree_type);
+
+	return (kobj);
+}
+
+
 int
 kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list args)
 {