qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware: qemu_fw_cfg: make kobj_type structure constant
@ 2023-02-27  3:19 Thomas Weißschuh
  2023-03-03 19:38 ` Gabriel L. Somlo
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2023-02-27  3:19 UTC (permalink / raw)
  To: Gabriel Somlo, Michael S. Tsirkin
  Cc: qemu-devel, 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>
---
 drivers/firmware/qemu_fw_cfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
index a69399a6b7c0..f41de793f41b 100644
--- a/drivers/firmware/qemu_fw_cfg.c
+++ b/drivers/firmware/qemu_fw_cfg.c
@@ -452,7 +452,7 @@ static void fw_cfg_sysfs_release_entry(struct kobject *kobj)
 }
 
 /* kobj_type: ties together all properties required to register an entry */
-static struct kobj_type fw_cfg_sysfs_entry_ktype = {
+static const struct kobj_type fw_cfg_sysfs_entry_ktype = {
 	.default_groups = fw_cfg_sysfs_entry_groups,
 	.sysfs_ops = &fw_cfg_sysfs_attr_ops,
 	.release = fw_cfg_sysfs_release_entry,

---
base-commit: 2fcd07b7ccd5fd10b2120d298363e4e6c53ccf9c
change-id: 20230227-kobj_type-firmware-qemu-7746b6320db0

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



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

* Re: [PATCH] firmware: qemu_fw_cfg: make kobj_type structure constant
  2023-02-27  3:19 [PATCH] firmware: qemu_fw_cfg: make kobj_type structure constant Thomas Weißschuh
@ 2023-03-03 19:38 ` Gabriel L. Somlo
  0 siblings, 0 replies; 2+ messages in thread
From: Gabriel L. Somlo @ 2023-03-03 19:38 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: Michael S. Tsirkin, qemu-devel, linux-kernel

On Mon, Feb 27, 2023 at 03:19:56AM +0000, 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 <linux@weissschuh.net>
> ---
>  drivers/firmware/qemu_fw_cfg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
> index a69399a6b7c0..f41de793f41b 100644
> --- a/drivers/firmware/qemu_fw_cfg.c
> +++ b/drivers/firmware/qemu_fw_cfg.c
> @@ -452,7 +452,7 @@ static void fw_cfg_sysfs_release_entry(struct kobject *kobj)
>  }
>  
>  /* kobj_type: ties together all properties required to register an entry */
> -static struct kobj_type fw_cfg_sysfs_entry_ktype = {
> +static const struct kobj_type fw_cfg_sysfs_entry_ktype = {

Reviewed-by: Gabriel L. Somlo <somlo@cmu.edu>

Thanks,
--Gabriel

>  	.default_groups = fw_cfg_sysfs_entry_groups,
>  	.sysfs_ops = &fw_cfg_sysfs_attr_ops,
>  	.release = fw_cfg_sysfs_release_entry,
> 
> ---
> base-commit: 2fcd07b7ccd5fd10b2120d298363e4e6c53ccf9c
> change-id: 20230227-kobj_type-firmware-qemu-7746b6320db0
> 
> Best regards,
> -- 
> Thomas Weißschuh <linux@weissschuh.net>
> 


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

end of thread, other threads:[~2023-03-03 19:39 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:19 [PATCH] firmware: qemu_fw_cfg: make kobj_type structure constant Thomas Weißschuh
2023-03-03 19:38 ` Gabriel L. Somlo

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).