dibs: change dibs_class to a const struct
Subsystems (3)
PATCH v2 1/1 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.
--- drivers/dibs/dibs_main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/dibs/dibs_main.c +8 -6
@@ -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);
base-commit: d466c332e106fe666d1e2f5a24d08e308bebbfa1
Signature · 1 line
2.53.0
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 3 Mar 2026 17:31:04 +0100 you wrote:
The
class_create()call has been deprecated in favor ofclass_register()as the driver core now allows for a struct class to be in read-only memory. Changedibs_classto be a const struct class and drop theclass_create()call.[...]
Here is the summary with links:
- [v2] dibs: change dibs_class to a const struct
https://git.kernel.org/netdev/net-next/c/ad3dfa80be76
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html