public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dibs: change dibs_class to a const struct
@ 2026-03-02 16:31 Jori Koolstra
  2026-03-02 22:54 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Jori Koolstra @ 2026-03-02 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.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
 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] 7+ messages in thread

* Re: [PATCH] dibs: change dibs_class to a const struct
  2026-03-02 16:31 [PATCH] dibs: change dibs_class to a const struct Jori Koolstra
@ 2026-03-02 22:54 ` Greg Kroah-Hartman
  2026-03-03 13:07   ` Alexandra Winter
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-03-02 22:54 UTC (permalink / raw)
  To: Jori Koolstra
  Cc: Alexandra Winter, open list:DIBS (DIRECT INTERNAL BUFFER SHARING),
	open list

On Mon, Mar 02, 2026 at 05:31:03PM +0100, Jori Koolstra 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.
> 
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
> ---
>  drivers/dibs/dibs_main.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dibs: change dibs_class to a const struct
  2026-03-02 22:54 ` Greg Kroah-Hartman
@ 2026-03-03 13:07   ` Alexandra Winter
  2026-03-03 13:23     ` Jori Koolstra
  0 siblings, 1 reply; 7+ messages in thread
From: Alexandra Winter @ 2026-03-03 13:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jori Koolstra
  Cc: open list:DIBS (DIRECT INTERNAL BUFFER SHARING), open list



On 02.03.26 23:54, Greg Kroah-Hartman wrote:
> On Mon, Mar 02, 2026 at 05:31:03PM +0100, Jori Koolstra 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.
>>
>> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
>> ---
>>  drivers/dibs/dibs_main.c | 14 ++++++++------
>>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>

Thank you for the patch Jori.
Would you mind adding a link to explain the "as the driver core now allows"?
Maybe
Link: https://lore.kernel.org/all/2023040248-outrage-obsolete-5a9a@gregkh/


For my education: How could I have noticed that class_create() call has been deprecated?
Is that marked somewhere somehow?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dibs: change dibs_class to a const struct
  2026-03-03 13:07   ` Alexandra Winter
@ 2026-03-03 13:23     ` Jori Koolstra
  2026-03-03 13:38       ` Alexandra Winter
  0 siblings, 1 reply; 7+ messages in thread
From: Jori Koolstra @ 2026-03-03 13:23 UTC (permalink / raw)
  To: Alexandra Winter, Greg Kroah-Hartman
  Cc: open list:DIBS (DIRECT INTERNAL BUFFER SHARING), open list

Hi Alexandra,

> 
> Thank you for the patch Jori.
> Would you mind adding a link to explain the "as the driver core now allows"?
> Maybe
> Link: https://lore.kernel.org/all/2023040248-outrage-obsolete-5a9a@gregkh/
> 

Yes, see this one indeed:
https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/

> 
> For my education: How could I have noticed that class_create() call has been deprecated?
> Is that marked somewhere somehow?
>

I think this is for Greg to answer, but my guess would be that you maybe could
not have. I don't know if there is a formal deprecation procedure.

This is just cleanup work that has been laying around for a
while and some beginners like me have progressed this to gain kernel patching
experience. I see that this was already being worked on in 2023. I am now
removing the last references to class_create() in drivers so that the API
can finally be retired.

Thanks,
Jori.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dibs: change dibs_class to a const struct
  2026-03-03 13:23     ` Jori Koolstra
@ 2026-03-03 13:38       ` Alexandra Winter
  2026-03-03 13:47         ` Jori Koolstra
  0 siblings, 1 reply; 7+ messages in thread
From: Alexandra Winter @ 2026-03-03 13:38 UTC (permalink / raw)
  To: Jori Koolstra, Greg Kroah-Hartman
  Cc: open list:DIBS (DIRECT INTERNAL BUFFER SHARING), open list



On 03.03.26 14:23, Jori Koolstra wrote:
> Hi Alexandra,
> 
>>
>> Thank you for the patch Jori.
>> Would you mind adding a link to explain the "as the driver core now allows"?
>> Maybe
>> Link: https://lore.kernel.org/all/2023040248-outrage-obsolete-5a9a@gregkh/
>>
> 
> Yes, see this one indeed:
> https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/
> 

Thank you.
Would you mind sending a quick v2 with the link, so netdev maintainers can take this?

But I'm also fine with taking this version.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dibs: change dibs_class to a const struct
  2026-03-03 13:38       ` Alexandra Winter
@ 2026-03-03 13:47         ` Jori Koolstra
  2026-03-03 14:47           ` Alexandra Winter
  0 siblings, 1 reply; 7+ messages in thread
From: Jori Koolstra @ 2026-03-03 13:47 UTC (permalink / raw)
  To: Alexandra Winter, Greg Kroah-Hartman
  Cc: open list:DIBS (DIRECT INTERNAL BUFFER SHARING), open list


> 
> Thank you.
> Would you mind sending a quick v2 with the link, so netdev maintainers can take this?
> 

Sure. How does that work with the reviewed-by tags? Do I have to add them
manually to v2, or ... ?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dibs: change dibs_class to a const struct
  2026-03-03 13:47         ` Jori Koolstra
@ 2026-03-03 14:47           ` Alexandra Winter
  0 siblings, 0 replies; 7+ messages in thread
From: Alexandra Winter @ 2026-03-03 14:47 UTC (permalink / raw)
  To: Jori Koolstra, Greg Kroah-Hartman
  Cc: open list:DIBS (DIRECT INTERNAL BUFFER SHARING), open list



On 03.03.26 14:47, Jori Koolstra wrote:
> 
>>
>> Thank you.
>> Would you mind sending a quick v2 with the link, so netdev maintainers can take this?
>>
> 
> Sure. How does that work with the reviewed-by tags? Do I have to add them
> manually to v2, or ... ?

Yes, that is my understanding.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-03 14:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-02 16:31 [PATCH] dibs: change dibs_class to a const struct Jori Koolstra
2026-03-02 22:54 ` Greg Kroah-Hartman
2026-03-03 13:07   ` Alexandra Winter
2026-03-03 13:23     ` Jori Koolstra
2026-03-03 13:38       ` Alexandra Winter
2026-03-03 13:47         ` Jori Koolstra
2026-03-03 14:47           ` Alexandra Winter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox