mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rikard Falkeborn <rikard.falkeborn@gmail.com>
To: Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Ben Widawsky <ben.widawsky@intel.com>,
	Dan Williams <dan.j.williams@intel.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rikard Falkeborn <rikard.falkeborn@gmail.com>
Subject: [PATCH] cxl/core: Constify static attribute_group structs
Date: Fri, 11 Feb 2022 00:02:35 +0100	[thread overview]
Message-ID: <20220210230235.4463-1-rikard.falkeborn@gmail.com> (raw)

The only usage of these is to put their address in arrays of pointers to
const struct attribute_group, so make them const to allow the compiler
to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/cxl/core/bus.c    | 8 ++++----
 drivers/cxl/core/core.h   | 2 +-
 drivers/cxl/core/memdev.c | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/cxl/core/bus.c b/drivers/cxl/core/bus.c
index 3f9b98ecd18b..4532ef8b806f 100644
--- a/drivers/cxl/core/bus.c
+++ b/drivers/cxl/core/bus.c
@@ -38,7 +38,7 @@ static struct attribute *cxl_base_attributes[] = {
 	NULL,
 };
 
-struct attribute_group cxl_base_attribute_group = {
+const struct attribute_group cxl_base_attribute_group = {
 	.attrs = cxl_base_attributes,
 };
 
@@ -136,7 +136,7 @@ static struct attribute *cxl_decoder_base_attrs[] = {
 	NULL,
 };
 
-static struct attribute_group cxl_decoder_base_attribute_group = {
+static const struct attribute_group cxl_decoder_base_attribute_group = {
 	.attrs = cxl_decoder_base_attrs,
 };
 
@@ -148,7 +148,7 @@ static struct attribute *cxl_decoder_root_attrs[] = {
 	NULL,
 };
 
-static struct attribute_group cxl_decoder_root_attribute_group = {
+static const struct attribute_group cxl_decoder_root_attribute_group = {
 	.attrs = cxl_decoder_root_attrs,
 };
 
@@ -164,7 +164,7 @@ static struct attribute *cxl_decoder_switch_attrs[] = {
 	NULL,
 };
 
-static struct attribute_group cxl_decoder_switch_attribute_group = {
+static const struct attribute_group cxl_decoder_switch_attribute_group = {
 	.attrs = cxl_decoder_switch_attrs,
 };
 
diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h
index e0c9aacc4e9c..1c0562cc9297 100644
--- a/drivers/cxl/core/core.h
+++ b/drivers/cxl/core/core.h
@@ -7,7 +7,7 @@
 extern const struct device_type cxl_nvdimm_bridge_type;
 extern const struct device_type cxl_nvdimm_type;
 
-extern struct attribute_group cxl_base_attribute_group;
+extern const struct attribute_group cxl_base_attribute_group;
 
 struct cxl_send_command;
 struct cxl_mem_query_commands;
diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
index 61029cb7ac62..ac2d40741686 100644
--- a/drivers/cxl/core/memdev.c
+++ b/drivers/cxl/core/memdev.c
@@ -106,16 +106,16 @@ static struct attribute *cxl_memdev_ram_attributes[] = {
 	NULL,
 };
 
-static struct attribute_group cxl_memdev_attribute_group = {
+static const struct attribute_group cxl_memdev_attribute_group = {
 	.attrs = cxl_memdev_attributes,
 };
 
-static struct attribute_group cxl_memdev_ram_attribute_group = {
+static const struct attribute_group cxl_memdev_ram_attribute_group = {
 	.name = "ram",
 	.attrs = cxl_memdev_ram_attributes,
 };
 
-static struct attribute_group cxl_memdev_pmem_attribute_group = {
+static const struct attribute_group cxl_memdev_pmem_attribute_group = {
 	.name = "pmem",
 	.attrs = cxl_memdev_pmem_attributes,
 };
-- 
2.35.1


                 reply	other threads:[~2022-02-10 23:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220210230235.4463-1-rikard.falkeborn@gmail.com \
    --to=rikard.falkeborn@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=ben.widawsky@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®