EDAC: constantify the struct bus_type usage
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Dec 2023 13:13:10 +0000 (14:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Jan 2024 13:34:27 +0000 (14:34 +0100)
In many places in the edac code, struct bus_type pointers are passed
around and then eventually sent to the driver core, which can handle a
constant pointer.  So constantify all of the edac usage of these as well
because the data in them is never modified by the edac code either.

Cc: Borislav Petkov <bp@alien8.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: James Morse <james.morse@arm.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Robert Richter <rric@kernel.org>
Cc: <linux-edac@vger.kernel.org>
Link: https://lore.kernel.org/r/2023121909-tribute-punctuate-4b22@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/edac/edac_device.h
drivers/edac/edac_device_sysfs.c
drivers/edac/edac_module.c
drivers/edac/edac_pci_sysfs.c
include/linux/edac.h

index 3f44e6b9d387f961d615db4a435edcfdc2faef11..7db22a4c83ef3f521aa5447759182b227171b668 100644 (file)
@@ -176,7 +176,7 @@ struct edac_device_ctl_info {
        struct edac_dev_sysfs_attribute *sysfs_attributes;
 
        /* pointer to main 'edac' subsys in sysfs */
-       struct bus_type *edac_subsys;
+       const struct bus_type *edac_subsys;
 
        /* the internal state of this controller instance */
        int op_state;
index 010c26be58464d141da85ea5dfea0039cb942827..237a542e045a3f2af6402e674aba0e603a0f5773 100644 (file)
@@ -229,7 +229,7 @@ static struct kobj_type ktype_device_ctrl = {
 int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
 {
        struct device *dev_root;
-       struct bus_type *edac_subsys;
+       const struct bus_type *edac_subsys;
        int err = -ENODEV;
 
        edac_dbg(1, "\n");
index 32a931d0cb71ff1c262c97eb323c8894768ee423..1c9f623826665be9e790f40fcd12d564835cad39 100644 (file)
@@ -67,7 +67,7 @@ char *edac_op_state_to_string(int opstate)
  * sysfs object: /sys/devices/system/edac
  *     need to export to other files
  */
-static struct bus_type edac_subsys = {
+static const struct bus_type edac_subsys = {
        .name = "edac",
        .dev_name = "edac",
 };
@@ -90,7 +90,7 @@ static void edac_subsys_exit(void)
 }
 
 /* return pointer to the 'edac' node in sysfs */
-struct bus_type *edac_get_sysfs_subsys(void)
+const struct bus_type *edac_get_sysfs_subsys(void)
 {
        return &edac_subsys;
 }
index 287cc51dbc868a6437767288f8a67159f4bf354b..e823e4da086a7719db623e618c91a0d3401709de 100644 (file)
@@ -338,7 +338,7 @@ static struct kobj_type ktype_edac_pci_main_kobj = {
 static int edac_pci_main_kobj_setup(void)
 {
        int err = -ENODEV;
-       struct bus_type *edac_subsys;
+       const struct bus_type *edac_subsys;
        struct device *dev_root;
 
        edac_dbg(0, "\n");
index fa4bda2a70f6c61aa7a231f4b4710ffc7b8fe996..ccaf2ae0801d68d4d78276a03ca525a8a81fbf17 100644 (file)
@@ -30,7 +30,7 @@ struct device;
 
 extern int edac_op_state;
 
-struct bus_type *edac_get_sysfs_subsys(void);
+const struct bus_type *edac_get_sysfs_subsys(void);
 
 static inline void opstate_init(void)
 {
@@ -492,7 +492,7 @@ struct edac_raw_error_desc {
  */
 struct mem_ctl_info {
        struct device                   dev;
-       struct bus_type                 *bus;
+       const struct bus_type           *bus;
 
        struct list_head link;  /* for global list of mem_ctl_info structs */