i2c: make i2c_bus_type const
Subsystems (5)
PATCH 1/1 i2c: make i2c_bus_type const
Now that the driver core can properly handle constant struct bus_type, move the i2c_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
Note, the sound/soc/rockchip/rk3399_gru_sound.c also needed tweaking as it decided to save off a pointer to a bus type for internal stuff, and it was using the i2c_bus_type as well.
--- drivers/i2c/i2c-core-base.c | 2 +- include/linux/i2c.h | 2 +- sound/soc/rockchip/rk3399_gru_sound.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/i2c-core-base.c +1 -1
@@ -689,7 +689,7 @@ static struct attribute *i2c_dev_attrs[] = { };ATTRIBUTE_GROUPS (i2c_dev); -struct bus_type i2c_bus_type = { +const struct bus_type i2c_bus_type = { .name ="i2c" , .match = i2c_device_match, .probe = i2c_device_probe,
include/linux/i2c.h +1 -1
@@ -23,7 +23,7 @@#include <linux/swab.h> /* for swab16 */ #include <uapi/linux/i2c.h> -extern struct bus_type i2c_bus_type; +extern const struct bus_type i2c_bus_type;extern struct device_type i2c_adapter_type;extern struct device_type i2c_client_type;
sound/soc/rockchip/rk3399_gru_sound.c +1 -1
@@ -446,7 +446,7 @@ static const struct rockchip_sound_route rockchip_routes[] = {struct dailink_match_data {const char *compatible; -struct bus_type *bus_type; +const struct bus_type *bus_type; };static const struct dailink_match_data dailink_match[] = {
Signature · 1 line
2.43.0
Quoted 3 lines · Greg Kroah-Hartman
Now that the driver core can properly handle constant struct
bus_type, move thei2c_bus_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
Wolfram Sang
AppliedQuoted 8 lines · Greg Kroah-Hartman
Now that the driver core can properly handle constant struct
bus_type, move thei2c_bus_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Note, the
sound/soc/rockchip/rk3399_gru_sound.calso needed tweaking as it decided to save off a pointer to a bus type for internal stuff, and it was using thei2c_bus_typeas well.
Quoted 11 lines
Cc Wolfram Sang <[email protected]>Cc Liam Girdwood <[email protected]>Cc Mark Brown <[email protected]>Cc Jaroslav Kysela <[email protected]>Cc Takashi Iwai <[email protected]>Cc Heiko Stuebner <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Applied to for-next, thanks!