Re: [PATCH] virt: coco: change tsm_class to a const struct

From: Jori Koolstra

Date: Wed Apr 01 2026 - 13:18:12 EST



> Op 04-03-2026 08:12 CET schreef Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>:
>
>
> On Tue, Mar 03, 2026 at 08:05:55PM +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 tsm_class to be a const struct class and drop the
> > class_create() call. Compile tested only.
> >
> > Link: https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/
> >
> > Suggested-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Jori Koolstra <jkoolstra@xxxxxxxxx>
>
> A small nitpick below, but in any case:
>
> Reviewed-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
>
> (...)
>
> > @@ -114,18 +118,16 @@ static void tsm_release(struct device *dev)
> >
> > static int __init tsm_init(void)
> > {
> > - tsm_class = class_create("tsm");
> > - if (IS_ERR(tsm_class))
> > - return PTR_ERR(tsm_class);
> > + int err;
> >
> > - tsm_class->dev_release = tsm_release;
> > - return 0;
> > + err = class_register(&tsm_class);
> > + return err;
>
> 'err' looks to be unnecessary now.
>
> > }
>
> (...)

Hi Thomas,

I sent a v2 a while ago; I am not sure how to check if it has been applied.
Just going over the remaining class_create() patches again.

Thanks,
Jori.