Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

EDAC: constantify the struct bus_type usage

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>

+7 -7
+1 -1
drivers/edac/edac_device.h
··· 176 176 struct edac_dev_sysfs_attribute *sysfs_attributes; 177 177 178 178 /* pointer to main 'edac' subsys in sysfs */ 179 - struct bus_type *edac_subsys; 179 + const struct bus_type *edac_subsys; 180 180 181 181 /* the internal state of this controller instance */ 182 182 int op_state;
+1 -1
drivers/edac/edac_device_sysfs.c
··· 229 229 int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) 230 230 { 231 231 struct device *dev_root; 232 - struct bus_type *edac_subsys; 232 + const struct bus_type *edac_subsys; 233 233 int err = -ENODEV; 234 234 235 235 edac_dbg(1, "\n");
+2 -2
drivers/edac/edac_module.c
··· 67 67 * sysfs object: /sys/devices/system/edac 68 68 * need to export to other files 69 69 */ 70 - static struct bus_type edac_subsys = { 70 + static const struct bus_type edac_subsys = { 71 71 .name = "edac", 72 72 .dev_name = "edac", 73 73 }; ··· 90 90 } 91 91 92 92 /* return pointer to the 'edac' node in sysfs */ 93 - struct bus_type *edac_get_sysfs_subsys(void) 93 + const struct bus_type *edac_get_sysfs_subsys(void) 94 94 { 95 95 return &edac_subsys; 96 96 }
+1 -1
drivers/edac/edac_pci_sysfs.c
··· 338 338 static int edac_pci_main_kobj_setup(void) 339 339 { 340 340 int err = -ENODEV; 341 - struct bus_type *edac_subsys; 341 + const struct bus_type *edac_subsys; 342 342 struct device *dev_root; 343 343 344 344 edac_dbg(0, "\n");
+2 -2
include/linux/edac.h
··· 30 30 31 31 extern int edac_op_state; 32 32 33 - struct bus_type *edac_get_sysfs_subsys(void); 33 + const struct bus_type *edac_get_sysfs_subsys(void); 34 34 35 35 static inline void opstate_init(void) 36 36 { ··· 492 492 */ 493 493 struct mem_ctl_info { 494 494 struct device dev; 495 - struct bus_type *bus; 495 + const struct bus_type *bus; 496 496 497 497 struct list_head link; /* for global list of mem_ctl_info structs */ 498 498