linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efi: x86: make kobj_type structure constant
@ 2023-02-27  3:09 Thomas Weißschuh
  2023-02-27 16:34 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2023-02-27  3:09 UTC (permalink / raw)
  To: Ard Biesheuvel, Darren Hart, Andy Shevchenko, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin
  Cc: linux-efi, platform-driver-x86, linux-kernel, Thomas Weißschuh

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 <linux@weissschuh.net>
---
 arch/x86/platform/efi/runtime-map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/platform/efi/runtime-map.c b/arch/x86/platform/efi/runtime-map.c
index bbee682ef8cd..a6f02cef3ca2 100644
--- a/arch/x86/platform/efi/runtime-map.c
+++ b/arch/x86/platform/efi/runtime-map.c
@@ -93,7 +93,7 @@ static void map_release(struct kobject *kobj)
 	kfree(entry);
 }
 
-static struct kobj_type __refdata map_ktype = {
+static const struct kobj_type __refconst map_ktype = {
 	.sysfs_ops	= &map_attr_ops,
 	.default_groups	= def_groups,
 	.release	= map_release,

---
base-commit: 2fcd07b7ccd5fd10b2120d298363e4e6c53ccf9c
change-id: 20230227-kobj_type-x86-efi-7591b1343b08

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] efi: x86: make kobj_type structure constant
  2023-02-27  3:09 [PATCH] efi: x86: make kobj_type structure constant Thomas Weißschuh
@ 2023-02-27 16:34 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2023-02-27 16:34 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Darren Hart, Andy Shevchenko, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, linux-efi,
	platform-driver-x86, linux-kernel

On Mon, 27 Feb 2023 at 04:09, Thomas Weißschuh <linux@weissschuh.net> 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 <linux@weissschuh.net>

Thanks, I'll queue these up after the merge window.

> ---
>  arch/x86/platform/efi/runtime-map.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/platform/efi/runtime-map.c b/arch/x86/platform/efi/runtime-map.c
> index bbee682ef8cd..a6f02cef3ca2 100644
> --- a/arch/x86/platform/efi/runtime-map.c
> +++ b/arch/x86/platform/efi/runtime-map.c
> @@ -93,7 +93,7 @@ static void map_release(struct kobject *kobj)
>         kfree(entry);
>  }
>
> -static struct kobj_type __refdata map_ktype = {
> +static const struct kobj_type __refconst map_ktype = {
>         .sysfs_ops      = &map_attr_ops,
>         .default_groups = def_groups,
>         .release        = map_release,
>
> ---
> base-commit: 2fcd07b7ccd5fd10b2120d298363e4e6c53ccf9c
> change-id: 20230227-kobj_type-x86-efi-7591b1343b08
>
> Best regards,
> --
> Thomas Weißschuh <linux@weissschuh.net>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-27 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27  3:09 [PATCH] efi: x86: make kobj_type structure constant Thomas Weißschuh
2023-02-27 16:34 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).