Skip to contentSkip to conversation

powerpc: pseries: making bus_type structures const

PATCH In review Adrian Barnaś 2 participants 4 messages Sep 18, 2025 PowerPC

lore
Share & tools
lore
#0 lore raw

cover powerpc: pseries: making bus_type structures const

Current driver core properly handle constant bus_type structures. Both changes are moving bus_type structures to be constant. It is a part of tree clean-up from non const bus_type structures

Adrian Barnaś (2):
powerpc: pseries: make suspend_subsys const
powerpc: pseries: make cmm_subsys const

 arch/powerpc/platforms/pseries/cmm.c     | 2 +-
 arch/powerpc/platforms/pseries/suspend.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.51.0.470.ga7dc726c21-goog
#1 lore raw

PATCH 1/2 powerpc: pseries: make suspend_subsys const

Because driver core can properly handle constant struct bus_type, move the suspend_subsys to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

---
 arch/powerpc/platforms/pseries/suspend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/pseries/suspend.c +1 -1
index 382003dfdb9a..c51db63d3e88 100644
@@ -126,7 +126,7 @@ static ssize_t show_hibernate(struct device *dev,
 
 static DEVICE_ATTR(hibernate, 0644, show_hibernate, store_hibernate);
 
-static struct bus_type suspend_subsys = {
+static const struct bus_type suspend_subsys = {
 	.name = "power",
 	.dev_name = "power",
 };
Signature · 1 line
2.51.0.470.ga7dc726c21-goog
#2 lore raw

PATCH 2/2 powerpc: pseries: make cmm_subsys const

In reply to Adrian Barnaś

Because driver core can properly handle constant struct bus_type, move the cmm_subsys to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

---
 arch/powerpc/platforms/pseries/cmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/pseries/cmm.c +1 -1
index 5e0a718d1be7..913642647fe9 100644
@@ -375,7 +375,7 @@ static struct device_attribute *cmm_attrs[] = {
 static DEVICE_ULONG_ATTR(simulate_loan_target_kb, 0644,
 			 simulate_loan_target_kb);
 
-static struct bus_type cmm_subsys = {
+static const struct bus_type cmm_subsys = {
 	.name = "cmm",
 	.dev_name = "cmm",
 };
Signature · 1 line
2.51.0.470.ga7dc726c21-goog
Reviewed-by on the v1 series
#3 lore raw
In reply to Adrian Barnaś
Quoted 4 lines · Adrian Barnaś

Current driver core properly handle constant bus_type structures. Both changes are moving bus_type structures to be constant. It is a part of tree clean-up from non const bus_type structures

Quoted 11 lines

Adrian Barnaś (2):
powerpc: pseries: make suspend_subsys const
powerpc: pseries: make cmm_subsys const

 arch/powerpc/platforms/pseries/cmm.c     | 2 +-
 arch/powerpc/platforms/pseries/suspend.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.51.0.470.ga7dc726c21-goog