diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-24 11:01:31 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-24 15:34:18 +0100 |
commit | dcfbb67e48a2becfce7990386e985b9c45098ee5 (patch) | |
tree | 8554801058a1ccb137047ffee73ed998f35a4194 /include/linux/device | |
parent | 5b9ff0ba11042096bfb396e506fa9038e6a61de7 (diff) | |
download | linux-stable-dcfbb67e48a2becfce7990386e985b9c45098ee5.tar.gz linux-stable-dcfbb67e48a2becfce7990386e985b9c45098ee5.tar.bz2 linux-stable-dcfbb67e48a2becfce7990386e985b9c45098ee5.zip |
driver core: class: use lock_class_key already present in struct subsys_private
In commit 37e98d9bedb5 ("driver core: bus: move lock_class_key into
dynamic structure"), we moved the lock_class_key into the internal
structure shared by busses and classes, but only used it for buses.
Move the class code to use this structure as it is already present and
being allocated, instead of the statically allocated on-the-stack
variable that class_create() was using as part of a macro wrapper around
the core function call.
Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/20230324100132.1633647-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.h | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/include/linux/device/class.h b/include/linux/device/class.h index 75c1451fcc63..03d2f99f84c5 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -82,18 +82,9 @@ 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 lock_class_key *key); +extern int __must_check class_register(struct class *class); 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); \ -}) - struct class_compat; struct class_compat *class_compat_register(const char *name); void class_compat_unregister(struct class_compat *cls); @@ -246,30 +237,7 @@ struct class_interface { extern int __must_check class_interface_register(struct class_interface *); extern void class_interface_unregister(struct class_interface *); -extern struct class * __must_check __class_create(const char *name, - struct lock_class_key *key); +extern struct class * __must_check class_create(const char *name); extern void class_destroy(struct class *cls); -/* This is a #define to keep the compiler from merging different - * instances of the __key variable */ - -/** - * class_create - create a struct class structure - * @name: pointer to a string for the name of this class. - * - * This is used to create a struct class pointer that can then be used - * in calls to device_create(). - * - * Returns &struct class pointer on success, or ERR_PTR() on error. - * - * Note, the pointer created here is to be destroyed when finished by - * making a call to class_destroy(). - */ -#define class_create(name) \ -({ \ - static struct lock_class_key __key; \ - __class_create(name, &__key); \ -}) - - #endif /* _DEVICE_CLASS_H_ */ |