public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs: make kobj_type structures constant
@ 2023-02-09  3:21 Thomas Weißschuh
  2023-02-09  3:22 ` Gao Xiang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2023-02-09  3:21 UTC (permalink / raw)
  To: Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu
  Cc: linux-erofs, 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 definitions to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 fs/erofs/sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
index fd476961f742..435e515c0792 100644
--- a/fs/erofs/sysfs.c
+++ b/fs/erofs/sysfs.c
@@ -179,13 +179,13 @@ static const struct sysfs_ops erofs_attr_ops = {
 	.store	= erofs_attr_store,
 };
 
-static struct kobj_type erofs_sb_ktype = {
+static const struct kobj_type erofs_sb_ktype = {
 	.default_groups = erofs_groups,
 	.sysfs_ops	= &erofs_attr_ops,
 	.release	= erofs_sb_release,
 };
 
-static struct kobj_type erofs_ktype = {
+static const struct kobj_type erofs_ktype = {
 	.sysfs_ops	= &erofs_attr_ops,
 };
 
@@ -193,7 +193,7 @@ static struct kset erofs_root = {
 	.kobj	= {.ktype = &erofs_ktype},
 };
 
-static struct kobj_type erofs_feat_ktype = {
+static const struct kobj_type erofs_feat_ktype = {
 	.default_groups = erofs_feat_groups,
 	.sysfs_ops	= &erofs_attr_ops,
 };

---
base-commit: 0983f6bf2bfc0789b51ddf7315f644ff4da50acb
change-id: 20230209-kobj_type-erofs-0f0f4c901045

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


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

* Re: [PATCH] erofs: make kobj_type structures constant
  2023-02-09  3:21 [PATCH] erofs: make kobj_type structures constant Thomas Weißschuh
@ 2023-02-09  3:22 ` Gao Xiang
  2023-02-09  3:55 ` Jingbo Xu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gao Xiang @ 2023-02-09  3:22 UTC (permalink / raw)
  To: Thomas Weißschuh, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu
  Cc: linux-erofs, linux-kernel



On 2023/2/9 11:21, 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 definitions to prevent
> modification at runtime.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Acked-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

> ---
>   fs/erofs/sysfs.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
> index fd476961f742..435e515c0792 100644
> --- a/fs/erofs/sysfs.c
> +++ b/fs/erofs/sysfs.c
> @@ -179,13 +179,13 @@ static const struct sysfs_ops erofs_attr_ops = {
>   	.store	= erofs_attr_store,
>   };
>   
> -static struct kobj_type erofs_sb_ktype = {
> +static const struct kobj_type erofs_sb_ktype = {
>   	.default_groups = erofs_groups,
>   	.sysfs_ops	= &erofs_attr_ops,
>   	.release	= erofs_sb_release,
>   };
>   
> -static struct kobj_type erofs_ktype = {
> +static const struct kobj_type erofs_ktype = {
>   	.sysfs_ops	= &erofs_attr_ops,
>   };
>   
> @@ -193,7 +193,7 @@ static struct kset erofs_root = {
>   	.kobj	= {.ktype = &erofs_ktype},
>   };
>   
> -static struct kobj_type erofs_feat_ktype = {
> +static const struct kobj_type erofs_feat_ktype = {
>   	.default_groups = erofs_feat_groups,
>   	.sysfs_ops	= &erofs_attr_ops,
>   };
> 
> ---
> base-commit: 0983f6bf2bfc0789b51ddf7315f644ff4da50acb
> change-id: 20230209-kobj_type-erofs-0f0f4c901045
> 
> Best regards,

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

* Re: [PATCH] erofs: make kobj_type structures constant
  2023-02-09  3:21 [PATCH] erofs: make kobj_type structures constant Thomas Weißschuh
  2023-02-09  3:22 ` Gao Xiang
@ 2023-02-09  3:55 ` Jingbo Xu
  2023-02-09  5:54 ` Yue Hu
  2023-02-14 14:47 ` Chao Yu
  3 siblings, 0 replies; 5+ messages in thread
From: Jingbo Xu @ 2023-02-09  3:55 UTC (permalink / raw)
  To: Thomas Weißschuh, Gao Xiang, Chao Yu, Yue Hu
  Cc: linux-erofs, linux-kernel



On 2/9/23 11:21 AM, 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 definitions to prevent
> modification at runtime.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>


> ---
>  fs/erofs/sysfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
> index fd476961f742..435e515c0792 100644
> --- a/fs/erofs/sysfs.c
> +++ b/fs/erofs/sysfs.c
> @@ -179,13 +179,13 @@ static const struct sysfs_ops erofs_attr_ops = {
>  	.store	= erofs_attr_store,
>  };
>  
> -static struct kobj_type erofs_sb_ktype = {
> +static const struct kobj_type erofs_sb_ktype = {
>  	.default_groups = erofs_groups,
>  	.sysfs_ops	= &erofs_attr_ops,
>  	.release	= erofs_sb_release,
>  };
>  
> -static struct kobj_type erofs_ktype = {
> +static const struct kobj_type erofs_ktype = {
>  	.sysfs_ops	= &erofs_attr_ops,
>  };
>  
> @@ -193,7 +193,7 @@ static struct kset erofs_root = {
>  	.kobj	= {.ktype = &erofs_ktype},
>  };
>  
> -static struct kobj_type erofs_feat_ktype = {
> +static const struct kobj_type erofs_feat_ktype = {
>  	.default_groups = erofs_feat_groups,
>  	.sysfs_ops	= &erofs_attr_ops,
>  };
> 
> ---
> base-commit: 0983f6bf2bfc0789b51ddf7315f644ff4da50acb
> change-id: 20230209-kobj_type-erofs-0f0f4c901045
> 
> Best regards,

-- 
Thanks,
Jingbo

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

* Re: [PATCH] erofs: make kobj_type structures constant
  2023-02-09  3:21 [PATCH] erofs: make kobj_type structures constant Thomas Weißschuh
  2023-02-09  3:22 ` Gao Xiang
  2023-02-09  3:55 ` Jingbo Xu
@ 2023-02-09  5:54 ` Yue Hu
  2023-02-14 14:47 ` Chao Yu
  3 siblings, 0 replies; 5+ messages in thread
From: Yue Hu @ 2023-02-09  5:54 UTC (permalink / raw)
  To: Thomas =?GB18030?B?V2VpgTCJOHNjaHVo?=
  Cc: Gao Xiang, Chao Yu, Jeffle Xu, linux-erofs, linux-kernel, huyue2,
	zhangwen

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=GB18030, Size: 1545 bytes --]

On Thu, 09 Feb 2023 03:21:13 +0000
Thomas Wei0‰8schuh <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 definitions to prevent
> modification at runtime.
> 
> Signed-off-by: Thomas Wei0‰8schuh <linux@weissschuh.net>

Reviewed-by: Yue Hu <huyue2@coolpad.com>

> ---
>  fs/erofs/sysfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c
> index fd476961f742..435e515c0792 100644
> --- a/fs/erofs/sysfs.c
> +++ b/fs/erofs/sysfs.c
> @@ -179,13 +179,13 @@ static const struct sysfs_ops erofs_attr_ops = {
>  	.store	= erofs_attr_store,
>  };
>  
> -static struct kobj_type erofs_sb_ktype = {
> +static const struct kobj_type erofs_sb_ktype = {
>  	.default_groups = erofs_groups,
>  	.sysfs_ops	= &erofs_attr_ops,
>  	.release	= erofs_sb_release,
>  };
>  
> -static struct kobj_type erofs_ktype = {
> +static const struct kobj_type erofs_ktype = {
>  	.sysfs_ops	= &erofs_attr_ops,
>  };
>  
> @@ -193,7 +193,7 @@ static struct kset erofs_root = {
>  	.kobj	= {.ktype = &erofs_ktype},
>  };
>  
> -static struct kobj_type erofs_feat_ktype = {
> +static const struct kobj_type erofs_feat_ktype = {
>  	.default_groups = erofs_feat_groups,
>  	.sysfs_ops	= &erofs_attr_ops,
>  };
> 
> ---
> base-commit: 0983f6bf2bfc0789b51ddf7315f644ff4da50acb
> change-id: 20230209-kobj_type-erofs-0f0f4c901045
> 
> Best regards,


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

* Re: [PATCH] erofs: make kobj_type structures constant
  2023-02-09  3:21 [PATCH] erofs: make kobj_type structures constant Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2023-02-09  5:54 ` Yue Hu
@ 2023-02-14 14:47 ` Chao Yu
  3 siblings, 0 replies; 5+ messages in thread
From: Chao Yu @ 2023-02-14 14:47 UTC (permalink / raw)
  To: Thomas Weißschuh, Gao Xiang, Yue Hu, Jeffle Xu
  Cc: linux-erofs, linux-kernel

On 2023/2/9 11:21, 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 definitions to prevent
> modification at runtime.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-09  3:21 [PATCH] erofs: make kobj_type structures constant Thomas Weißschuh
2023-02-09  3:22 ` Gao Xiang
2023-02-09  3:55 ` Jingbo Xu
2023-02-09  5:54 ` Yue Hu
2023-02-14 14:47 ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox