mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 02:01:18 -04:00
dibs: change dibs_class to a const struct
The class_create() call has been deprecated in favor of class_register() as the driver core now allows for a struct class to be in read-only memory. Change dibs_class to be a const struct class and drop the class_create() call. Link: https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/ Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Alexandra Winter <wintera@linux.ibm.com> Link: https://patch.msgid.link/20260303163104.3749311-1-jkoolstra@xs4all.nl Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
d37f53822c
commit
ad3dfa80be
@@ -19,7 +19,9 @@
|
||||
MODULE_DESCRIPTION("Direct Internal Buffer Sharing class");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static struct class *dibs_class;
|
||||
static const struct class dibs_class = {
|
||||
.name = "dibs",
|
||||
};
|
||||
|
||||
/* use an array rather a list for fast mapping: */
|
||||
static struct dibs_client *clients[MAX_DIBS_CLIENTS];
|
||||
@@ -137,7 +139,7 @@ struct dibs_dev *dibs_dev_alloc(void)
|
||||
if (!dibs)
|
||||
return dibs;
|
||||
dibs->dev.release = dibs_dev_release;
|
||||
dibs->dev.class = dibs_class;
|
||||
dibs->dev.class = &dibs_class;
|
||||
device_initialize(&dibs->dev);
|
||||
|
||||
return dibs;
|
||||
@@ -253,9 +255,9 @@ static int __init dibs_init(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
dibs_class = class_create("dibs");
|
||||
if (IS_ERR(dibs_class))
|
||||
return PTR_ERR(dibs_class);
|
||||
rc = class_register(&dibs_class);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = dibs_loopback_init();
|
||||
if (rc)
|
||||
@@ -267,7 +269,7 @@ static int __init dibs_init(void)
|
||||
static void __exit dibs_exit(void)
|
||||
{
|
||||
dibs_loopback_exit();
|
||||
class_destroy(dibs_class);
|
||||
class_unregister(&dibs_class);
|
||||
}
|
||||
|
||||
subsys_initcall(dibs_init);
|
||||
|
||||
Reference in New Issue
Block a user