* [PATCH] pps: change pps_class to a const struct
@ 2026-03-02 15:11 Jori Koolstra
2026-03-02 15:24 ` Rodolfo Giometti
2026-03-02 16:42 ` Greg Kroah-Hartman
0 siblings, 2 replies; 7+ messages in thread
From: Jori Koolstra @ 2026-03-02 15:11 UTC (permalink / raw)
To: giometti, linux-kernel; +Cc: Jori Koolstra, Greg Kroah-Hartman
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>
---
drivers/pps/pps.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index c6b8b6478276..de1122bb69ea 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -26,7 +26,10 @@
*/
static int pps_major;
-static struct class *pps_class;
+static const struct class pps_class = {
+ .name = "pps",
+ .dev_groups = pps_groups
+};
static DEFINE_MUTEX(pps_idr_lock);
static DEFINE_IDR(pps_idr);
@@ -379,7 +382,7 @@ int pps_register_cdev(struct pps_device *pps)
}
pps->id = err;
- pps->dev.class = pps_class;
+ pps->dev.class = &pps_class;
pps->dev.parent = pps->info.dev;
pps->dev.devt = MKDEV(pps_major, pps->id);
dev_set_drvdata(&pps->dev, pps);
@@ -408,7 +411,7 @@ void pps_unregister_cdev(struct pps_device *pps)
{
pr_debug("unregistering pps%d\n", pps->id);
pps->lookup_cookie = NULL;
- device_destroy(pps_class, pps->dev.devt);
+ device_destroy(&pps_class, pps->dev.devt);
/* Now we can release the ID for re-use */
mutex_lock(&pps_idr_lock);
@@ -460,18 +463,19 @@ EXPORT_SYMBOL(pps_lookup_dev);
static void __exit pps_exit(void)
{
- class_destroy(pps_class);
+ class_unregister(&pps_class);
__unregister_chrdev(pps_major, 0, PPS_MAX_SOURCES, "pps");
}
static int __init pps_init(void)
{
- pps_class = class_create("pps");
- if (IS_ERR(pps_class)) {
- pr_err("failed to allocate class\n");
- return PTR_ERR(pps_class);
+ int err;
+
+ err = class_register(&pps_class);
+ if (err) {
+ pr_err("failed to register class\n");
+ return err;
}
- pps_class->dev_groups = pps_groups;
pps_major = __register_chrdev(0, 0, PPS_MAX_SOURCES, "pps",
&pps_cdev_fops);
@@ -487,7 +491,7 @@ static int __init pps_init(void)
return 0;
remove_class:
- class_destroy(pps_class);
+ class_unregister(&pps_class);
return pps_major;
}
base-commit: d466c332e106fe666d1e2f5a24d08e308bebbfa1
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] pps: change pps_class to a const struct
2026-03-02 15:11 [PATCH] pps: change pps_class to a const struct Jori Koolstra
@ 2026-03-02 15:24 ` Rodolfo Giometti
2026-03-02 16:43 ` Greg Kroah-Hartman
2026-03-02 16:42 ` Greg Kroah-Hartman
1 sibling, 1 reply; 7+ messages in thread
From: Rodolfo Giometti @ 2026-03-02 15:24 UTC (permalink / raw)
To: Jori Koolstra, linux-kernel; +Cc: Greg Kroah-Hartman
On 3/2/26 16:11, 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 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>
> ---
> drivers/pps/pps.c | 24 ++++++++++++++----------
> 1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
> index c6b8b6478276..de1122bb69ea 100644
> --- a/drivers/pps/pps.c
> +++ b/drivers/pps/pps.c
> @@ -26,7 +26,10 @@
> */
>
> static int pps_major;
> -static struct class *pps_class;
> +static const struct class pps_class = {
> + .name = "pps",
> + .dev_groups = pps_groups
> +};
>
> static DEFINE_MUTEX(pps_idr_lock);
> static DEFINE_IDR(pps_idr);
> @@ -379,7 +382,7 @@ int pps_register_cdev(struct pps_device *pps)
> }
> pps->id = err;
>
> - pps->dev.class = pps_class;
> + pps->dev.class = &pps_class;
> pps->dev.parent = pps->info.dev;
> pps->dev.devt = MKDEV(pps_major, pps->id);
> dev_set_drvdata(&pps->dev, pps);
> @@ -408,7 +411,7 @@ void pps_unregister_cdev(struct pps_device *pps)
> {
> pr_debug("unregistering pps%d\n", pps->id);
> pps->lookup_cookie = NULL;
> - device_destroy(pps_class, pps->dev.devt);
> + device_destroy(&pps_class, pps->dev.devt);
>
> /* Now we can release the ID for re-use */
> mutex_lock(&pps_idr_lock);
> @@ -460,18 +463,19 @@ EXPORT_SYMBOL(pps_lookup_dev);
>
> static void __exit pps_exit(void)
> {
> - class_destroy(pps_class);
> + class_unregister(&pps_class);
> __unregister_chrdev(pps_major, 0, PPS_MAX_SOURCES, "pps");
> }
>
> static int __init pps_init(void)
> {
> - pps_class = class_create("pps");
> - if (IS_ERR(pps_class)) {
> - pr_err("failed to allocate class\n");
> - return PTR_ERR(pps_class);
> + int err;
> +
> + err = class_register(&pps_class);
> + if (err) {
> + pr_err("failed to register class\n");
> + return err;
> }
> - pps_class->dev_groups = pps_groups;
>
> pps_major = __register_chrdev(0, 0, PPS_MAX_SOURCES, "pps",
> &pps_cdev_fops);
> @@ -487,7 +491,7 @@ static int __init pps_init(void)
> return 0;
>
> remove_class:
> - class_destroy(pps_class);
> + class_unregister(&pps_class);
> return pps_major;
> }
>
>
> base-commit: d466c332e106fe666d1e2f5a24d08e308bebbfa1
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pps: change pps_class to a const struct
2026-03-02 15:11 [PATCH] pps: change pps_class to a const struct Jori Koolstra
2026-03-02 15:24 ` Rodolfo Giometti
@ 2026-03-02 16:42 ` Greg Kroah-Hartman
1 sibling, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-03-02 16:42 UTC (permalink / raw)
To: Jori Koolstra; +Cc: giometti, linux-kernel
On Mon, Mar 02, 2026 at 04:11:32PM +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 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>
> ---
> drivers/pps/pps.c | 24 ++++++++++++++----------
> 1 file changed, 14 insertions(+), 10 deletions(-)
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pps: change pps_class to a const struct
2026-03-02 15:24 ` Rodolfo Giometti
@ 2026-03-02 16:43 ` Greg Kroah-Hartman
2026-03-02 17:03 ` Rodolfo Giometti
0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-03-02 16:43 UTC (permalink / raw)
To: Rodolfo Giometti; +Cc: Jori Koolstra, linux-kernel
On Mon, Mar 02, 2026 at 04:24:40PM +0100, Rodolfo Giometti wrote:
> On 3/2/26 16:11, 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 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>
Wait, want me to pick these up through my tree? no objection if you
want me to, just need to know.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pps: change pps_class to a const struct
2026-03-02 16:43 ` Greg Kroah-Hartman
@ 2026-03-02 17:03 ` Rodolfo Giometti
2026-03-02 19:09 ` Greg Kroah-Hartman
2026-04-01 17:01 ` Jori Koolstra
0 siblings, 2 replies; 7+ messages in thread
From: Rodolfo Giometti @ 2026-03-02 17:03 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jori Koolstra, linux-kernel, Andrew Morton
On 3/2/26 17:43, Greg Kroah-Hartman wrote:
> On Mon, Mar 02, 2026 at 04:24:40PM +0100, Rodolfo Giometti wrote:
>> On 3/2/26 16:11, 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 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>
>
> Wait, want me to pick these up through my tree? no objection if you
> want me to, just need to know.
Andrew usually adds the PPS patches, but we can use your tree too. :)
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pps: change pps_class to a const struct
2026-03-02 17:03 ` Rodolfo Giometti
@ 2026-03-02 19:09 ` Greg Kroah-Hartman
2026-04-01 17:01 ` Jori Koolstra
1 sibling, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-03-02 19:09 UTC (permalink / raw)
To: Rodolfo Giometti; +Cc: Jori Koolstra, linux-kernel, Andrew Morton
On Mon, Mar 02, 2026 at 06:03:40PM +0100, Rodolfo Giometti wrote:
> On 3/2/26 17:43, Greg Kroah-Hartman wrote:
> > On Mon, Mar 02, 2026 at 04:24:40PM +0100, Rodolfo Giometti wrote:
> > > On 3/2/26 16:11, 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 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>
> >
> > Wait, want me to pick these up through my tree? no objection if you
> > want me to, just need to know.
>
> Andrew usually adds the PPS patches, but we can use your tree too. :)
Which ever you want is easiest for me, your call.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pps: change pps_class to a const struct
2026-03-02 17:03 ` Rodolfo Giometti
2026-03-02 19:09 ` Greg Kroah-Hartman
@ 2026-04-01 17:01 ` Jori Koolstra
1 sibling, 0 replies; 7+ messages in thread
From: Jori Koolstra @ 2026-04-01 17:01 UTC (permalink / raw)
To: Rodolfo Giometti, Greg Kroah-Hartman; +Cc: linux-kernel, Andrew Morton
> Op 02-03-2026 18:03 CET schreef Rodolfo Giometti <giometti@enneenne.com>:
>
>
> On 3/2/26 17:43, Greg Kroah-Hartman wrote:
> > On Mon, Mar 02, 2026 at 04:24:40PM +0100, Rodolfo Giometti wrote:
> >> On 3/2/26 16:11, 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 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>
> >
> > Wait, want me to pick these up through my tree? no objection if you
> > want me to, just need to know.
>
> Andrew usually adds the PPS patches, but we can use your tree too. :)
>
> Ciao,
>
> Rodolfo
Have you already applied this to your tree Greg?
Thanks, Jori.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-04-01 17:01 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-02 15:11 [PATCH] pps: change pps_class to a const struct Jori Koolstra
2026-03-02 15:24 ` Rodolfo Giometti
2026-03-02 16:43 ` Greg Kroah-Hartman
2026-03-02 17:03 ` Rodolfo Giometti
2026-03-02 19:09 ` Greg Kroah-Hartman
2026-04-01 17:01 ` Jori Koolstra
2026-03-02 16:42 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox