All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: Constify static attribute_group structs
@ 2021-01-08 23:41 ` Rikard Falkeborn
  0 siblings, 0 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2021-01-08 23:41 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	James Smart, Chaitanya Kulkarni
  Cc: linux-nvme, linux-kernel, Rikard Falkeborn

The only usage of these is to put their addresses in arrays of pointers
to const attribute_groups. Make them const to allow the compiler to put
them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/nvme/host/core.c     | 4 ++--
 drivers/nvme/host/fc.c       | 2 +-
 drivers/nvme/target/fcloop.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ce1b61519441..fc3743de53be 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2849,7 +2849,7 @@ static struct attribute *nvme_subsys_attrs[] = {
 	NULL,
 };
 
-static struct attribute_group nvme_subsys_attrs_group = {
+static const struct attribute_group nvme_subsys_attrs_group = {
 	.attrs = nvme_subsys_attrs,
 };
 
@@ -3679,7 +3679,7 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
 	return a->mode;
 }
 
-static struct attribute_group nvme_dev_attrs_group = {
+static const struct attribute_group nvme_dev_attrs_group = {
 	.attrs		= nvme_dev_attrs,
 	.is_visible	= nvme_dev_attrs_are_visible,
 };
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 38373a0e86ef..5d3976116558 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -3776,7 +3776,7 @@ static struct attribute *nvme_fc_attrs[] = {
 	NULL
 };
 
-static struct attribute_group nvme_fc_attr_group = {
+static const struct attribute_group nvme_fc_attr_group = {
 	.attrs = nvme_fc_attrs,
 };
 
diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c
index 733d9363900e..9a0bd9af3f9a 100644
--- a/drivers/nvme/target/fcloop.c
+++ b/drivers/nvme/target/fcloop.c
@@ -1544,7 +1544,7 @@ static struct attribute *fcloop_dev_attrs[] = {
 	NULL
 };
 
-static struct attribute_group fclopp_dev_attrs_group = {
+static const struct attribute_group fclopp_dev_attrs_group = {
 	.attrs		= fcloop_dev_attrs,
 };
 
-- 
2.30.0


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

* [PATCH] nvme: Constify static attribute_group structs
@ 2021-01-08 23:41 ` Rikard Falkeborn
  0 siblings, 0 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2021-01-08 23:41 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	James Smart, Chaitanya Kulkarni
  Cc: Rikard Falkeborn, linux-kernel, linux-nvme

The only usage of these is to put their addresses in arrays of pointers
to const attribute_groups. Make them const to allow the compiler to put
them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/nvme/host/core.c     | 4 ++--
 drivers/nvme/host/fc.c       | 2 +-
 drivers/nvme/target/fcloop.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ce1b61519441..fc3743de53be 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2849,7 +2849,7 @@ static struct attribute *nvme_subsys_attrs[] = {
 	NULL,
 };
 
-static struct attribute_group nvme_subsys_attrs_group = {
+static const struct attribute_group nvme_subsys_attrs_group = {
 	.attrs = nvme_subsys_attrs,
 };
 
@@ -3679,7 +3679,7 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
 	return a->mode;
 }
 
-static struct attribute_group nvme_dev_attrs_group = {
+static const struct attribute_group nvme_dev_attrs_group = {
 	.attrs		= nvme_dev_attrs,
 	.is_visible	= nvme_dev_attrs_are_visible,
 };
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 38373a0e86ef..5d3976116558 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -3776,7 +3776,7 @@ static struct attribute *nvme_fc_attrs[] = {
 	NULL
 };
 
-static struct attribute_group nvme_fc_attr_group = {
+static const struct attribute_group nvme_fc_attr_group = {
 	.attrs = nvme_fc_attrs,
 };
 
diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c
index 733d9363900e..9a0bd9af3f9a 100644
--- a/drivers/nvme/target/fcloop.c
+++ b/drivers/nvme/target/fcloop.c
@@ -1544,7 +1544,7 @@ static struct attribute *fcloop_dev_attrs[] = {
 	NULL
 };
 
-static struct attribute_group fclopp_dev_attrs_group = {
+static const struct attribute_group fclopp_dev_attrs_group = {
 	.attrs		= fcloop_dev_attrs,
 };
 
-- 
2.30.0


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvme: Constify static attribute_group structs
  2021-01-08 23:41 ` Rikard Falkeborn
@ 2021-01-12  8:27   ` Christoph Hellwig
  -1 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-01-12  8:27 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	James Smart, Chaitanya Kulkarni, linux-nvme, linux-kernel

Thanks,

applied to nvme-5.11.

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

* Re: [PATCH] nvme: Constify static attribute_group structs
@ 2021-01-12  8:27   ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-01-12  8:27 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: Sagi Grimberg, Chaitanya Kulkarni, James Smart, linux-nvme,
	linux-kernel, Jens Axboe, Keith Busch, Christoph Hellwig

Thanks,

applied to nvme-5.11.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvme: Constify static attribute_group structs
  2021-01-08 23:41 ` Rikard Falkeborn
@ 2021-01-13 23:22   ` Sagi Grimberg
  -1 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2021-01-13 23:22 UTC (permalink / raw)
  To: Rikard Falkeborn, Keith Busch, Jens Axboe, Christoph Hellwig,
	James Smart, Chaitanya Kulkarni
  Cc: linux-nvme, linux-kernel

FWIW,

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

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

* Re: [PATCH] nvme: Constify static attribute_group structs
@ 2021-01-13 23:22   ` Sagi Grimberg
  0 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2021-01-13 23:22 UTC (permalink / raw)
  To: Rikard Falkeborn, Keith Busch, Jens Axboe, Christoph Hellwig,
	James Smart, Chaitanya Kulkarni
  Cc: linux-kernel, linux-nvme

FWIW,

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2021-01-13 23:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 23:41 [PATCH] nvme: Constify static attribute_group structs Rikard Falkeborn
2021-01-08 23:41 ` Rikard Falkeborn
2021-01-12  8:27 ` Christoph Hellwig
2021-01-12  8:27   ` Christoph Hellwig
2021-01-13 23:22 ` Sagi Grimberg
2021-01-13 23:22   ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.