cxl: make cxl_bus_type constant
PATCH v2 1/1 cxl: make cxl_bus_type constant
Now that the driver core can properly handle constant struct bus_type, move the cxl_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
---
v2: fix up the subject line to be correct
drivers/cxl/core/port.c | 2 +- drivers/cxl/cxl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/cxl/core/port.c +1 -1
@@ -2293,7 +2293,7 @@ static const struct attribute_group *cxl_bus_attribute_groups[] = { NULL, }; -struct bus_type cxl_bus_type = { +const struct bus_type cxl_bus_type = { .name ="cxl" , .uevent = cxl_bus_uevent, .match = cxl_bus_match,
drivers/cxl/cxl.h +1 -1
@@ -815,7 +815,7 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,bool is_cxl_region (struct device *dev); -extern struct bus_type cxl_bus_type; +extern const struct bus_type cxl_bus_type;struct cxl_driver {const char *name;
Signature · 1 line
2.50.0
Quoted 4 lines · On Tue, 1 Jul 2025 14:07:39 +0200 Greg Kroah-Hartman…
Now that the driver core can properly handle constant struct
bus_type, move thecxl_bus_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
Quoted 9 lines
Cc Davidlohr Bueso <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Dave Jiang <[email protected]>Cc Alison Schofield <[email protected]>Cc Vishal Verma <[email protected]>Cc Ira Weiny <[email protected]>Cc Dan Williams <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 33 lines
---
v2: fix up the subject line to be correctdrivers/cxl/core/port.c | 2 +- drivers/cxl/cxl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/cxl/core/port.c +1
-1@@ -2293,7 +2293,7 @@ static const struct attribute_group *cxl_bus_attribute_groups[] = { NULL, }; -struct bus_type cxl_bus_type = { +const struct bus_type cxl_bus_type = { .name ="cxl" , .uevent = cxl_bus_uevent, .match = cxl_bus_match,drivers/cxl/cxl.h +1
-1@@ -815,7 +815,7 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,bool is_cxl_region (struct device *dev); -extern struct bus_type cxl_bus_type; +extern const struct bus_type cxl_bus_type;struct cxl_driver {const char *name;
Quoted 10 lines · Greg Kroah-Hartman
Now that the driver core can properly handle constant struct
bus_type, move thecxl_bus_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Cc Davidlohr Bueso <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Dave Jiang <[email protected]>Cc Alison Schofield <[email protected]>Cc Vishal Verma <[email protected]>Cc Ira Weiny <[email protected]>
[snip]
Quoted 4 lines · Greg Kroah-Hartman
Now that the driver core can properly handle constant struct
bus_type, move thecxl_bus_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
Quoted 9 lines
Cc Davidlohr Bueso <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Dave Jiang <[email protected]>Cc Alison Schofield <[email protected]>Cc Vishal Verma <[email protected]>Cc Ira Weiny <[email protected]>Cc Dan Williams <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 33 lines
---
v2: fix up the subject line to be correctdrivers/cxl/core/port.c | 2 +- drivers/cxl/cxl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/cxl/core/port.c +1
-1@@ -2293,7 +2293,7 @@ static const struct attribute_group *cxl_bus_attribute_groups[] = { NULL, }; -struct bus_type cxl_bus_type = { +const struct bus_type cxl_bus_type = { .name ="cxl" , .uevent = cxl_bus_uevent, .match = cxl_bus_match,drivers/cxl/cxl.h +1
-1@@ -815,7 +815,7 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,bool is_cxl_region (struct device *dev); -extern struct bus_type cxl_bus_type; +extern const struct bus_type cxl_bus_type;struct cxl_driver {const char *name;
Quoted 4 lines · Greg Kroah-Hartman
Now that the driver core can properly handle constant struct
bus_type, move thecxl_bus_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
Quoted 9 lines
Cc Davidlohr Bueso <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Dave Jiang <[email protected]>Cc Alison Schofield <[email protected]>Cc Vishal Verma <[email protected]>Cc Ira Weiny <[email protected]>Cc Dan Williams <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Applied to cxl/nextac0fe6a5731700bcea6fecfd5d0b76c0454b3a20
Quoted 33 lines
---
v2: fix up the subject line to be correctdrivers/cxl/core/port.c | 2 +- drivers/cxl/cxl.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/cxl/core/port.c +1
-1@@ -2293,7 +2293,7 @@ static const struct attribute_group *cxl_bus_attribute_groups[] = { NULL, }; -struct bus_type cxl_bus_type = { +const struct bus_type cxl_bus_type = { .name ="cxl" , .uevent = cxl_bus_uevent, .match = cxl_bus_match,drivers/cxl/cxl.h +1
-1@@ -815,7 +815,7 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,bool is_cxl_region (struct device *dev); -extern struct bus_type cxl_bus_type; +extern const struct bus_type cxl_bus_type;struct cxl_driver {const char *name;