git: 1fe7cd024342 - main - LinuxKPI: Remove owner argument from class_create function on KBI layer

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Sun, 21 Jul 2024 13:14:55 UTC
The branch main has been updated by wulf:

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

commit 1fe7cd02434257692100c484cd345566c9dba528
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2024-07-21 13:09:58 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-07-21 13:09:58 +0000

    LinuxKPI: Remove owner argument from class_create function on KBI layer
    
    To chase Linux 6.4
    
    Sponsored by:   Serenity Cyber Security, LLC
    Differential Revision:  https://reviews.freebsd.org/D45849
---
 sys/compat/linuxkpi/common/include/linux/device.h | 7 ++++---
 sys/compat/linuxkpi/common/src/linux_compat.c     | 3 +--
 sys/ofed/drivers/infiniband/core/ib_cm.c          | 1 -
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h
index 912be8fbae8b..f56a39e904c8 100644
--- a/sys/compat/linuxkpi/common/include/linux/device.h
+++ b/sys/compat/linuxkpi/common/include/linux/device.h
@@ -57,7 +57,6 @@ struct device;
 
 struct class {
 	const char	*name;
-	struct module	*owner;
 	struct kobject	kobj;
 	devclass_t	bsdclass;
 	const struct dev_pm_ops *pm;
@@ -342,9 +341,11 @@ put_device(struct device *dev)
 		kobject_put(&dev->kobj);
 }
 
-struct class *class_create(struct module *owner, const char *name);
+struct class *lkpi_class_create(const char *name);
 #if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 60400
-#define	class_create(name)	class_create(NULL, name)
+#define	class_create(name)		lkpi_class_create(name)
+#else
+#define	class_create(owner, name)	lkpi_class_create(name)
 #endif
 
 static inline int
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index ec4e59f66e7f..9962154cffd9 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -342,13 +342,12 @@ error:
 }
 
 struct class *
-class_create(struct module *owner, const char *name)
+lkpi_class_create(const char *name)
 {
 	struct class *class;
 	int error;
 
 	class = kzalloc(sizeof(*class), M_WAITOK);
-	class->owner = owner;
 	class->name = name;
 	class->class_release = linux_class_kfree;
 	error = class_register(class);
diff --git a/sys/ofed/drivers/infiniband/core/ib_cm.c b/sys/ofed/drivers/infiniband/core/ib_cm.c
index 7ace287b1c88..046f10e085c7 100644
--- a/sys/ofed/drivers/infiniband/core/ib_cm.c
+++ b/sys/ofed/drivers/infiniband/core/ib_cm.c
@@ -4008,7 +4008,6 @@ static char *cm_devnode(struct device *dev, umode_t *mode)
 }
 
 struct class cm_class = {
-	.owner   = THIS_MODULE,
 	.name    = "infiniband_cm",
 	.devnode = cm_devnode,
 };