[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240305-rapidio-v1-1-0c036139704f@marliere.net>
Date: Tue, 05 Mar 2024 17:15:04 -0300
From: "Ricardo B. Marliere" <ricardo@...liere.net>
To: Matt Porter <mporter@...nel.crashing.org>,
Alexandre Bounine <alex.bou9@...il.com>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Ricardo B. Marliere" <ricardo@...liere.net>
Subject: [PATCH] rapidio: make rio_mport_class constant
Since commit 43a7206b0963 ("driver core: class: make class_register() take
a const *"), the driver core allows for struct class to be in read-only
memory, so move the rio_mport_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at boot time.
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@...liere.net>
---
drivers/rapidio/rio-driver.c | 2 +-
include/linux/rio.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c
index 1b3b4c2e015d..9aacb5edf6b3 100644
--- a/drivers/rapidio/rio-driver.c
+++ b/drivers/rapidio/rio-driver.c
@@ -221,7 +221,7 @@ static int rio_uevent(const struct device *dev, struct kobj_uevent_env *env)
return 0;
}
-struct class rio_mport_class = {
+const struct class rio_mport_class = {
.name = "rapidio_port",
.dev_groups = rio_mport_groups,
};
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 2cd637268b4f..55cebdddabfe 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -79,7 +79,7 @@
#define RIO_CTAG_UDEVID 0x0001ffff /* Unique device identifier */
extern struct bus_type rio_bus_type;
-extern struct class rio_mport_class;
+extern const struct class rio_mport_class;
struct rio_mport;
struct rio_dev;
---
base-commit: 90d35da658da8cff0d4ecbb5113f5fac9d00eb72
change-id: 20240305-rapidio-fc61b2014cff
Best regards,
--
Ricardo B. Marliere <ricardo@...liere.net>
Powered by blists - more mailing lists