Re: [PATCH] ACPI: make kobj_type structures constant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 14, 2023 at 4:23 AM Thomas Weißschuh <linux@xxxxxxxxxxxxxx> 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 definitions to prevent
> modification at runtime.
>
> Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
> ---
>  drivers/acpi/cppc_acpi.c    | 2 +-
>  drivers/acpi/device_sysfs.c | 2 +-
>  drivers/acpi/sysfs.c        | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index 0f17b1c32718..a8f58b32d66f 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -193,7 +193,7 @@ static struct attribute *cppc_attrs[] = {
>  };
>  ATTRIBUTE_GROUPS(cppc);
>
> -static struct kobj_type cppc_ktype = {
> +static const struct kobj_type cppc_ktype = {
>         .sysfs_ops = &kobj_sysfs_ops,
>         .default_groups = cppc_groups,
>  };
> diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
> index 120873dad2cc..c3aa15571f16 100644
> --- a/drivers/acpi/device_sysfs.c
> +++ b/drivers/acpi/device_sysfs.c
> @@ -78,7 +78,7 @@ static void acpi_data_node_release(struct kobject *kobj)
>         complete(&dn->kobj_done);
>  }
>
> -static struct kobj_type acpi_data_node_ktype = {
> +static const struct kobj_type acpi_data_node_ktype = {
>         .sysfs_ops = &acpi_data_node_sysfs_ops,
>         .default_groups = acpi_data_node_default_groups,
>         .release = acpi_data_node_release,
> diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
> index 7db3b530279b..7f4ff56c9d42 100644
> --- a/drivers/acpi/sysfs.c
> +++ b/drivers/acpi/sysfs.c
> @@ -953,7 +953,7 @@ static struct attribute *hotplug_profile_attrs[] = {
>  };
>  ATTRIBUTE_GROUPS(hotplug_profile);
>
> -static struct kobj_type acpi_hotplug_profile_ktype = {
> +static const struct kobj_type acpi_hotplug_profile_ktype = {
>         .sysfs_ops = &kobj_sysfs_ops,
>         .default_groups = hotplug_profile_groups,
>  };
>
> ---

Applied as 6.3 material, thanks!



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux