git: 36929b55849c - main - linuxkpi: move kobject_create to .c file

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

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

commit 36929b55849c8f553a744d6e4fbc8b1a5ff73f66
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-05 05:05:26 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-05 05:05:26 +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.
    
    Sponsored by:           Netflix
    Reviewed by:            hselasky, emaste
    Differential Revision:  https://reviews.freebsd.org/D34767
---
 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 4159cef9ffba..37294230c62e 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -156,6 +156,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)
 {