mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02: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:
parent
d37f53822c
commit
ad3dfa80be
|
|
@ -19,7 +19,9 @@
|
||||||
MODULE_DESCRIPTION("Direct Internal Buffer Sharing class");
|
MODULE_DESCRIPTION("Direct Internal Buffer Sharing class");
|
||||||
MODULE_LICENSE("GPL");
|
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: */
|
/* use an array rather a list for fast mapping: */
|
||||||
static struct dibs_client *clients[MAX_DIBS_CLIENTS];
|
static struct dibs_client *clients[MAX_DIBS_CLIENTS];
|
||||||
|
|
@ -137,7 +139,7 @@ struct dibs_dev *dibs_dev_alloc(void)
|
||||||
if (!dibs)
|
if (!dibs)
|
||||||
return dibs;
|
return dibs;
|
||||||
dibs->dev.release = dibs_dev_release;
|
dibs->dev.release = dibs_dev_release;
|
||||||
dibs->dev.class = dibs_class;
|
dibs->dev.class = &dibs_class;
|
||||||
device_initialize(&dibs->dev);
|
device_initialize(&dibs->dev);
|
||||||
|
|
||||||
return dibs;
|
return dibs;
|
||||||
|
|
@ -253,9 +255,9 @@ static int __init dibs_init(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
dibs_class = class_create("dibs");
|
rc = class_register(&dibs_class);
|
||||||
if (IS_ERR(dibs_class))
|
if (rc)
|
||||||
return PTR_ERR(dibs_class);
|
return rc;
|
||||||
|
|
||||||
rc = dibs_loopback_init();
|
rc = dibs_loopback_init();
|
||||||
if (rc)
|
if (rc)
|
||||||
|
|
@ -267,7 +269,7 @@ static int __init dibs_init(void)
|
||||||
static void __exit dibs_exit(void)
|
static void __exit dibs_exit(void)
|
||||||
{
|
{
|
||||||
dibs_loopback_exit();
|
dibs_loopback_exit();
|
||||||
class_destroy(dibs_class);
|
class_unregister(&dibs_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
subsys_initcall(dibs_init);
|
subsys_initcall(dibs_init);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user