Re: [PATCH] EDAC: constantify the struct bus_type usage

From: Borislav Petkov
Date: Thu Dec 28 2023 - 10:00:24 EST


On Tue, Dec 19, 2023 at 02:13:10PM +0100, Greg Kroah-Hartman wrote:
> 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.

"constantify", huh? Not enough words in the English language so let's do
new ones?

:-)

So what's the plan with this "constantification"?

Because:

drivers/edac/edac_module.c: In function ‘edac_subsys_init’:
drivers/edac/edac_module.c:80:38: warning: passing argument 1 of ‘subsys_system_register’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
80 | err = subsys_system_register(&edac_subsys, NULL);
| ^~~~~~~~~~~~
In file included from ./include/linux/edac.h:16,
from drivers/edac/edac_module.c:13:
./include/linux/device.h:75:45: note: expected ‘struct bus_type *’ but argument is of type ‘const struct bus_type *’
75 | int subsys_system_register(struct bus_type *subsys,
|

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette