Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.
Take advantage of this to constify the structure definition to prevent
modification at runtime.
Signed-off-by: Thomas Weißschuh <[email protected]>
---
kernel/sched/cpufreq_schedutil.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 1207c78f85c1..4c073bd9b001 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -543,7 +543,7 @@ static void sugov_tunables_free(struct kobject *kobj)
kfree(to_sugov_tunables(attr_set));
}
-static struct kobj_type sugov_tunables_ktype = {
+static const struct kobj_type sugov_tunables_ktype = {
.default_groups = sugov_groups,
.sysfs_ops = &governor_sysfs_ops,
.release = &sugov_tunables_free,
---
base-commit: 5b0ed5964928b0aaf0d644c17c886c7f5ea4bb3f
change-id: 20230220-kobj_type-cpufreq-schedutil-783c6be6ff14
Best regards,
--
Thomas Weißschuh <[email protected]>
On 20-02-23, 23:28, Thomas Wei?schuh wrote:
> Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
> the driver core allows the usage of const struct kobj_type.
>
> Take advantage of this to constify the structure definition to prevent
> modification at runtime.
>
> Signed-off-by: Thomas Wei?schuh <[email protected]>
> ---
> kernel/sched/cpufreq_schedutil.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 1207c78f85c1..4c073bd9b001 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -543,7 +543,7 @@ static void sugov_tunables_free(struct kobject *kobj)
> kfree(to_sugov_tunables(attr_set));
> }
>
> -static struct kobj_type sugov_tunables_ktype = {
> +static const struct kobj_type sugov_tunables_ktype = {
> .default_groups = sugov_groups,
> .sysfs_ops = &governor_sysfs_ops,
> .release = &sugov_tunables_free,
>
> ---
> base-commit: 5b0ed5964928b0aaf0d644c17c886c7f5ea4bb3f
> change-id: 20230220-kobj_type-cpufreq-schedutil-783c6be6ff14
Acked-by: Viresh Kumar <[email protected]>
--
viresh
On Tue, Feb 21, 2023 at 5:37 AM Viresh Kumar <[email protected]> wrote:
>
> On 20-02-23, 23:28, Thomas Weißschuh wrote:
> > Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
> > the driver core allows the usage of const struct kobj_type.
> >
> > Take advantage of this to constify the structure definition to prevent
> > modification at runtime.
> >
> > Signed-off-by: Thomas Weißschuh <[email protected]>
> > ---
> > kernel/sched/cpufreq_schedutil.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> > index 1207c78f85c1..4c073bd9b001 100644
> > --- a/kernel/sched/cpufreq_schedutil.c
> > +++ b/kernel/sched/cpufreq_schedutil.c
> > @@ -543,7 +543,7 @@ static void sugov_tunables_free(struct kobject *kobj)
> > kfree(to_sugov_tunables(attr_set));
> > }
> >
> > -static struct kobj_type sugov_tunables_ktype = {
> > +static const struct kobj_type sugov_tunables_ktype = {
> > .default_groups = sugov_groups,
> > .sysfs_ops = &governor_sysfs_ops,
> > .release = &sugov_tunables_free,
> >
> > ---
> > base-commit: 5b0ed5964928b0aaf0d644c17c886c7f5ea4bb3f
> > change-id: 20230220-kobj_type-cpufreq-schedutil-783c6be6ff14
>
> Acked-by: Viresh Kumar <[email protected]>
Applied as 6.3-rc material, thanks!