Skip to content

Commit f36be9c

Browse files
committed
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 <[email protected]> Cc: Tony Luck <[email protected]> Cc: James Morse <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: Robert Richter <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/2023121909-tribute-punctuate-4b22@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c810729 commit f36be9c

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

drivers/edac/edac_device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ struct edac_device_ctl_info {
176176
struct edac_dev_sysfs_attribute *sysfs_attributes;
177177

178178
/* pointer to main 'edac' subsys in sysfs */
179-
struct bus_type *edac_subsys;
179+
const struct bus_type *edac_subsys;
180180

181181
/* the internal state of this controller instance */
182182
int op_state;

drivers/edac/edac_device_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static struct kobj_type ktype_device_ctrl = {
229229
int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
230230
{
231231
struct device *dev_root;
232-
struct bus_type *edac_subsys;
232+
const struct bus_type *edac_subsys;
233233
int err = -ENODEV;
234234

235235
edac_dbg(1, "\n");

drivers/edac/edac_module.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ char *edac_op_state_to_string(int opstate)
6767
* sysfs object: /sys/devices/system/edac
6868
* need to export to other files
6969
*/
70-
static struct bus_type edac_subsys = {
70+
static const struct bus_type edac_subsys = {
7171
.name = "edac",
7272
.dev_name = "edac",
7373
};
@@ -90,7 +90,7 @@ static void edac_subsys_exit(void)
9090
}
9191

9292
/* 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)
9494
{
9595
return &edac_subsys;
9696
}

drivers/edac/edac_pci_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ static struct kobj_type ktype_edac_pci_main_kobj = {
338338
static int edac_pci_main_kobj_setup(void)
339339
{
340340
int err = -ENODEV;
341-
struct bus_type *edac_subsys;
341+
const struct bus_type *edac_subsys;
342342
struct device *dev_root;
343343

344344
edac_dbg(0, "\n");

include/linux/edac.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct device;
3030

3131
extern int edac_op_state;
3232

33-
struct bus_type *edac_get_sysfs_subsys(void);
33+
const struct bus_type *edac_get_sysfs_subsys(void);
3434

3535
static inline void opstate_init(void)
3636
{
@@ -492,7 +492,7 @@ struct edac_raw_error_desc {
492492
*/
493493
struct mem_ctl_info {
494494
struct device dev;
495-
struct bus_type *bus;
495+
const struct bus_type *bus;
496496

497497
struct list_head link; /* for global list of mem_ctl_info structs */
498498

0 commit comments

Comments
 (0)