dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-buf: make kobj_type structure constant
@ 2023-02-17  3:13 Thomas Weißschuh
  2023-02-17  9:47 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2023-02-17  3:13 UTC (permalink / raw)
  To: Sumit Semwal, Christian König
  Cc: linaro-mm-sig, Thomas Weißschuh, linux-kernel, dri-devel,
	linux-media

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/dma-buf/dma-buf-sysfs-stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/dma-buf-sysfs-stats.c b/drivers/dma-buf/dma-buf-sysfs-stats.c
index fbf725fae7c1..6cfbbf0720bd 100644
--- a/drivers/dma-buf/dma-buf-sysfs-stats.c
+++ b/drivers/dma-buf/dma-buf-sysfs-stats.c
@@ -112,7 +112,7 @@ static void dma_buf_sysfs_release(struct kobject *kobj)
 	kfree(sysfs_entry);
 }
 
-static struct kobj_type dma_buf_ktype = {
+static const struct kobj_type dma_buf_ktype = {
 	.sysfs_ops = &dma_buf_stats_sysfs_ops,
 	.release = dma_buf_sysfs_release,
 	.default_groups = dma_buf_stats_default_groups,

---
base-commit: 3ac88fa4605ec98e545fb3ad0154f575fda2de5f
change-id: 20230217-kobj_type-dma-buf-a2ea6a8a1de3

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


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

* Re: [PATCH] dma-buf: make kobj_type structure constant
  2023-02-17  3:13 [PATCH] dma-buf: make kobj_type structure constant Thomas Weißschuh
@ 2023-02-17  9:47 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2023-02-17  9:47 UTC (permalink / raw)
  To: Thomas Weißschuh, Sumit Semwal
  Cc: linaro-mm-sig, linux-kernel, dri-devel, linux-media

Am 17.02.23 um 04:13 schrieb 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>

Reviewed-by: Christian König <christian.koenig@amd.com>

I will pick this up for upstreaming through drm-misc-next.

Thanks,
Christian.

> ---
>   drivers/dma-buf/dma-buf-sysfs-stats.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/dma-buf-sysfs-stats.c b/drivers/dma-buf/dma-buf-sysfs-stats.c
> index fbf725fae7c1..6cfbbf0720bd 100644
> --- a/drivers/dma-buf/dma-buf-sysfs-stats.c
> +++ b/drivers/dma-buf/dma-buf-sysfs-stats.c
> @@ -112,7 +112,7 @@ static void dma_buf_sysfs_release(struct kobject *kobj)
>   	kfree(sysfs_entry);
>   }
>   
> -static struct kobj_type dma_buf_ktype = {
> +static const struct kobj_type dma_buf_ktype = {
>   	.sysfs_ops = &dma_buf_stats_sysfs_ops,
>   	.release = dma_buf_sysfs_release,
>   	.default_groups = dma_buf_stats_default_groups,
>
> ---
> base-commit: 3ac88fa4605ec98e545fb3ad0154f575fda2de5f
> change-id: 20230217-kobj_type-dma-buf-a2ea6a8a1de3
>
> Best regards,


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

end of thread, other threads:[~2023-02-17  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-17  3:13 [PATCH] dma-buf: make kobj_type structure constant Thomas Weißschuh
2023-02-17  9:47 ` Christian König

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