Re: [PATCH] virt: coco: change tsm_class to a const struct
From: Thomas Weißschuh
Date: Wed Mar 04 2026 - 02:15:43 EST
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.
> }
(...)