nvmem: core: make nvmem_bus_type const

Message ID 20240204-bus_cleanup-nvmem-v1-1-21775783d1d2@marliere.net
State New
Headers
Series nvmem: core: make nvmem_bus_type const |

Commit Message

Ricardo B. Marliere Feb. 4, 2024, 8:22 p.m. UTC
  Now that the driver core can properly handle constant struct bus_type,
move the nvmem_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 drivers/nvmem/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: a0cfd5e997824d0bd8c7620d40cdb324121a2fc7
change-id: 20240204-bus_cleanup-nvmem-a5d83375164b

Best regards,
  

Comments

Greg KH Feb. 5, 2024, 12:48 p.m. UTC | #1
On Sun, Feb 04, 2024 at 05:22:51PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the nvmem_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  

Patch

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index eb357ac2e54a..5236f11d4700 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -517,7 +517,7 @@  static const struct device_type nvmem_provider_type = {
 	.release	= nvmem_release,
 };
 
-static struct bus_type nvmem_bus_type = {
+static const struct bus_type nvmem_bus_type = {
 	.name		= "nvmem",
 };