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_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_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>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20260302151132.3302993-1-jkoolstra@xs4all.nl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jori Koolstra and committed by
Greg Kroah-Hartman
c230ae1f f7a1fec4

+14 -10
+14 -10
drivers/pps/pps.c
··· 26 26 */ 27 27 28 28 static int pps_major; 29 - static struct class *pps_class; 29 + static const struct class pps_class = { 30 + .name = "pps", 31 + .dev_groups = pps_groups 32 + }; 30 33 31 34 static DEFINE_MUTEX(pps_idr_lock); 32 35 static DEFINE_IDR(pps_idr); ··· 382 379 } 383 380 pps->id = err; 384 381 385 - pps->dev.class = pps_class; 382 + pps->dev.class = &pps_class; 386 383 pps->dev.parent = pps->info.dev; 387 384 pps->dev.devt = MKDEV(pps_major, pps->id); 388 385 dev_set_drvdata(&pps->dev, pps); ··· 411 408 { 412 409 pr_debug("unregistering pps%d\n", pps->id); 413 410 pps->lookup_cookie = NULL; 414 - device_destroy(pps_class, pps->dev.devt); 411 + device_destroy(&pps_class, pps->dev.devt); 415 412 416 413 /* Now we can release the ID for re-use */ 417 414 mutex_lock(&pps_idr_lock); ··· 463 460 464 461 static void __exit pps_exit(void) 465 462 { 466 - class_destroy(pps_class); 463 + class_unregister(&pps_class); 467 464 __unregister_chrdev(pps_major, 0, PPS_MAX_SOURCES, "pps"); 468 465 } 469 466 470 467 static int __init pps_init(void) 471 468 { 472 - pps_class = class_create("pps"); 473 - if (IS_ERR(pps_class)) { 474 - pr_err("failed to allocate class\n"); 475 - return PTR_ERR(pps_class); 469 + int err; 470 + 471 + err = class_register(&pps_class); 472 + if (err) { 473 + pr_err("failed to register class\n"); 474 + return err; 476 475 } 477 - pps_class->dev_groups = pps_groups; 478 476 479 477 pps_major = __register_chrdev(0, 0, PPS_MAX_SOURCES, "pps", 480 478 &pps_cdev_fops); ··· 491 487 return 0; 492 488 493 489 remove_class: 494 - class_destroy(pps_class); 490 + class_unregister(&pps_class); 495 491 return pps_major; 496 492 } 497 493