Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pps: change pps_gen_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 pps_gen_class to be a const struct class and drop the
class_create() call.

Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Link: https://patch.msgid.link/20260302142436.3292766-1-jkoolstra@xs4all.nl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jori Koolstra and committed by
Greg Kroah-Hartman
4dc0c899 9aad7114

+12 -10
+12 -10
drivers/pps/generators/pps_gen.c
··· 26 26 */ 27 27 28 28 static dev_t pps_gen_devt; 29 - static struct class *pps_gen_class; 29 + static const struct class pps_gen_class = { 30 + .name = "pps-gen", 31 + .dev_groups = pps_gen_groups 32 + }; 30 33 31 34 static DEFINE_IDA(pps_gen_ida); 32 35 ··· 186 183 MAJOR(pps_gen_devt), pps_gen->id); 187 184 goto free_ida; 188 185 } 189 - pps_gen->dev = device_create(pps_gen_class, pps_gen->info->parent, devt, 186 + pps_gen->dev = device_create(&pps_gen_class, pps_gen->info->parent, devt, 190 187 pps_gen, "pps-gen%d", pps_gen->id); 191 188 if (IS_ERR(pps_gen->dev)) { 192 189 err = PTR_ERR(pps_gen->dev); ··· 210 207 static void pps_gen_unregister_cdev(struct pps_gen_device *pps_gen) 211 208 { 212 209 pr_debug("unregistering pps-gen%d\n", pps_gen->id); 213 - device_destroy(pps_gen_class, pps_gen->dev->devt); 210 + device_destroy(&pps_gen_class, pps_gen->dev->devt); 214 211 } 215 212 216 213 /* ··· 310 307 311 308 static void __exit pps_gen_exit(void) 312 309 { 313 - class_destroy(pps_gen_class); 310 + class_unregister(&pps_gen_class); 314 311 unregister_chrdev_region(pps_gen_devt, PPS_GEN_MAX_SOURCES); 315 312 } 316 313 ··· 318 315 { 319 316 int err; 320 317 321 - pps_gen_class = class_create("pps-gen"); 322 - if (IS_ERR(pps_gen_class)) { 323 - pr_err("failed to allocate class\n"); 324 - return PTR_ERR(pps_gen_class); 318 + err = class_register(&pps_gen_class); 319 + if (err) { 320 + pr_err("failed to register class\n"); 321 + return err; 325 322 } 326 - pps_gen_class->dev_groups = pps_gen_groups; 327 323 328 324 err = alloc_chrdev_region(&pps_gen_devt, 0, 329 325 PPS_GEN_MAX_SOURCES, "pps-gen"); ··· 334 332 return 0; 335 333 336 334 remove_class: 337 - class_destroy(pps_gen_class); 335 + class_unregister(&pps_gen_class); 338 336 return err; 339 337 } 340 338