linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ubifs: make kobj_type structures constant
@ 2023-02-10  2:16 Thomas Weißschuh
  2023-02-11  7:17 ` Zhihao Cheng
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2023-02-10  2:16 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd, 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/ubifs/sysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ubifs/sysfs.c b/fs/ubifs/sysfs.c
index 06ad8fa1fcfb..4404ca4f2ce9 100644
--- a/fs/ubifs/sysfs.c
+++ b/fs/ubifs/sysfs.c
@@ -74,13 +74,13 @@ static const struct sysfs_ops ubifs_attr_ops = {
 	.show	= ubifs_attr_show,
 };
 
-static struct kobj_type ubifs_sb_ktype = {
+static const struct kobj_type ubifs_sb_ktype = {
 	.default_groups	= ubifs_groups,
 	.sysfs_ops	= &ubifs_attr_ops,
 	.release	= ubifs_sb_release,
 };
 
-static struct kobj_type ubifs_ktype = {
+static const struct kobj_type ubifs_ktype = {
 	.sysfs_ops	= &ubifs_attr_ops,
 };
 

---
base-commit: e544a07438522ab3688416e6e2e34bf0ee6d8755
change-id: 20230210-kobj_type-ubifs-5790a3d46e97

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


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

* Re: [PATCH] ubifs: make kobj_type structures constant
  2023-02-10  2:16 [PATCH] ubifs: make kobj_type structures constant Thomas Weißschuh
@ 2023-02-11  7:17 ` Zhihao Cheng
  0 siblings, 0 replies; 2+ messages in thread
From: Zhihao Cheng @ 2023-02-11  7:17 UTC (permalink / raw)
  To: Thomas Weißschuh, Richard Weinberger; +Cc: linux-mtd, linux-kernel

在 2023/2/10 10:16, 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/ubifs/sysfs.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>

> diff --git a/fs/ubifs/sysfs.c b/fs/ubifs/sysfs.c
> index 06ad8fa1fcfb..4404ca4f2ce9 100644
> --- a/fs/ubifs/sysfs.c
> +++ b/fs/ubifs/sysfs.c
> @@ -74,13 +74,13 @@ static const struct sysfs_ops ubifs_attr_ops = {
>   	.show	= ubifs_attr_show,
>   };
>   
> -static struct kobj_type ubifs_sb_ktype = {
> +static const struct kobj_type ubifs_sb_ktype = {
>   	.default_groups	= ubifs_groups,
>   	.sysfs_ops	= &ubifs_attr_ops,
>   	.release	= ubifs_sb_release,
>   };
>   
> -static struct kobj_type ubifs_ktype = {
> +static const struct kobj_type ubifs_ktype = {
>   	.sysfs_ops	= &ubifs_attr_ops,
>   };
>   
> 
> ---
> base-commit: e544a07438522ab3688416e6e2e34bf0ee6d8755
> change-id: 20230210-kobj_type-ubifs-5790a3d46e97
> 
> Best regards,
> 

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10  2:16 [PATCH] ubifs: make kobj_type structures constant Thomas Weißschuh
2023-02-11  7:17 ` Zhihao Cheng

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