* [PATCH v2] dibs: change dibs_class to a const struct
@ 2026-03-03 16:31 Jori Koolstra
2026-03-05 3:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Jori Koolstra @ 2026-03-03 16:31 UTC (permalink / raw)
To: Alexandra Winter
Cc: Jori Koolstra, Greg Kroah-Hartman,
open list:DIBS (DIRECT INTERNAL BUFFER SHARING), open list
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>
---
drivers/dibs/dibs_main.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/dibs/dibs_main.c b/drivers/dibs/dibs_main.c
index f1816361b74d..14c3e2d84902 100644
--- a/drivers/dibs/dibs_main.c
+++ b/drivers/dibs/dibs_main.c
@@ -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
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] dibs: change dibs_class to a const struct
2026-03-03 16:31 [PATCH v2] dibs: change dibs_class to a const struct Jori Koolstra
@ 2026-03-05 3:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-05 3:00 UTC (permalink / raw)
To: Jori Koolstra; +Cc: wintera, gregkh, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 3 Mar 2026 17:31:04 +0100 you wrote:
> 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/
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-05 3:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-03 16:31 [PATCH v2] dibs: change dibs_class to a const struct Jori Koolstra
2026-03-05 3:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox