[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024010549-erasure-swoop-1cc6@gregkh>
Date: Fri, 5 Jan 2024 11:32:50 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: broonie@...nel.org
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-spi@...r.kernel.org
Subject: [PATCH] spi: make spi_bus_type const
Now that the driver core can properly handle constant struct bus_type,
move the spi_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.
Cc: Mark Brown <broonie@...nel.org>
Cc: linux-spi@...r.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/spi/spi.c | 2 +-
include/linux/spi/spi.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 8ead7acb99f3..6e962befc450 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -459,7 +459,7 @@ static void spi_shutdown(struct device *dev)
}
}
-struct bus_type spi_bus_type = {
+const struct bus_type spi_bus_type = {
.name = "spi",
.dev_groups = spi_dev_groups,
.match = spi_match_device,
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 255a0562aea5..f6c157dee55d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -33,7 +33,7 @@ struct spi_message;
* INTERFACES between SPI master-side drivers and SPI slave protocol handlers,
* and SPI infrastructure.
*/
-extern struct bus_type spi_bus_type;
+extern const struct bus_type spi_bus_type;
/**
* struct spi_statistics - statistics for spi transfers
--
2.43.0
Powered by blists - more mailing lists