summaryrefslogtreecommitdiff
path: root/include/linux/device
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-13 19:18:32 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-17 15:16:24 +0100
commit4a46ac9d64030d9f6f18baaf115a3558880c1ae2 (patch)
tree909068a609afcf90dda1dffb1a9246ced45e0164 /include/linux/device
parent64414da25baf3acf31350f75fdd10514bd8390b1 (diff)
driver core: class: specify the module owner in __class_register()
There's no need to manually have to set the module owner of a class, the compiler should do it automatically for you, so add a module * to the __class_register() function and allow it to set the module owner automatically. This will let us move the module pointer out of struct class eventually, as it should not be embedded in there if we wish for it to be a read-only structure eventually. And, funny story, this module pointer isn't even being used for anything, so while we will keep it around for now, it's not like it even matters. Cc: "Rafael J. Wysocki" <rafael@kernel.org> Link: https://lore.kernel.org/r/20230313181843.1207845-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/device')
-rw-r--r--include/linux/device/class.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/linux/device/class.h b/include/linux/device/class.h
index 42cc3fb44a84..d1ba4ee235dc 100644
--- a/include/linux/device/class.h
+++ b/include/linux/device/class.h
@@ -85,15 +85,16 @@ struct class_dev_iter {
extern struct kobject *sysfs_dev_block_kobj;
extern struct kobject *sysfs_dev_char_kobj;
extern int __must_check __class_register(struct class *class,
+ struct module *owner,
struct lock_class_key *key);
extern void class_unregister(struct class *class);
/* This is a #define to keep the compiler from merging different
* instances of the __key variable */
-#define class_register(class) \
-({ \
- static struct lock_class_key __key; \
- __class_register(class, &__key); \
+#define class_register(class) \
+({ \
+ static struct lock_class_key __key; \
+ __class_register(class, THIS_MODULE, &__key); \
})
struct class_compat;