memory tier: make memory_tier_subsys const

Message ID 20240204-bus_cleanup-mm-v1-1-00f49286f164@marliere.net
State New
Headers
Series memory tier: make memory_tier_subsys const |

Commit Message

Ricardo B. Marliere Feb. 4, 2024, 1:56 p.m. UTC
  Now that the driver core can properly handle constant struct bus_type,
move the memory_tier_subsys 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>
---
 mm/memory-tiers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 91f3daa1765ee4e0c89987dc25f72c40f07af34d
change-id: 20240204-bus_cleanup-mm-d8c2937d6af4

Best regards,
  

Comments

Greg KH Feb. 4, 2024, 2:24 p.m. UTC | #1
On Sun, Feb 04, 2024 at 10:56:44AM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the memory_tier_subsys 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>
> ---
>  mm/memory-tiers.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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

Patch

diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
index 5462d9e3c84c..ed20f96bf89d 100644
--- a/mm/memory-tiers.c
+++ b/mm/memory-tiers.c
@@ -39,7 +39,7 @@  static LIST_HEAD(memory_tiers);
 static struct node_memory_type_map node_memory_types[MAX_NUMNODES];
 struct memory_dev_type *default_dram_type;
 
-static struct bus_type memory_tier_subsys = {
+static const struct bus_type memory_tier_subsys = {
 	.name = "memory_tiering",
 	.dev_name = "memory_tier",
 };