* [PATCH] 9p: Constify static struct v9fs_attr_group
@ 2021-01-08 22:46 Rikard Falkeborn
2021-01-08 23:15 ` Dominique Martinet
0 siblings, 1 reply; 2+ messages in thread
From: Rikard Falkeborn @ 2021-01-08 22:46 UTC (permalink / raw)
To: ric Van Hensbergen, Latchesar Ionkov, Dominique Martinet
Cc: v9fs-developer, linux-kernel, Rikard Falkeborn
The only usage of v9fs_attr_group is to pass its address to
sysfs_create_group() and sysfs_create_group(), both which takes pointers
to const struct attribute_group. Make it const to allow the compiler to
put it in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
fs/9p/v9fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 39def020a074..cdb99507ef33 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -583,7 +583,7 @@ static struct attribute *v9fs_attrs[] = {
NULL,
};
-static struct attribute_group v9fs_attr_group = {
+static const struct attribute_group v9fs_attr_group = {
.attrs = v9fs_attrs,
};
--
2.30.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] 9p: Constify static struct v9fs_attr_group
2021-01-08 22:46 [PATCH] 9p: Constify static struct v9fs_attr_group Rikard Falkeborn
@ 2021-01-08 23:15 ` Dominique Martinet
0 siblings, 0 replies; 2+ messages in thread
From: Dominique Martinet @ 2021-01-08 23:15 UTC (permalink / raw)
To: Rikard Falkeborn
Cc: ric Van Hensbergen, Latchesar Ionkov, v9fs-developer, linux-kernel
Rikard Falkeborn wrote on Fri, Jan 08, 2021 at 11:46:50PM +0100:
> The only usage of v9fs_attr_group is to pass its address to
> sysfs_create_group() and sysfs_create_group(), both which takes pointers
> to const struct attribute_group. Make it const to allow the compiler to
> put it in read-only memory.
>
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Thanks, taking it.
--
Dominique
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-08 23:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 22:46 [PATCH] 9p: Constify static struct v9fs_attr_group Rikard Falkeborn
2021-01-08 23:15 ` Dominique Martinet
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).