Skip to content

Commit 94959c0

Browse files
gregkhwsakernel
authored andcommitted
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. Signed-off-by: Greg Kroah-Hartman <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 614ef4d commit 94959c0

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/i2c/i2c-core-base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ static struct attribute *i2c_dev_attrs[] = {
692692
};
693693
ATTRIBUTE_GROUPS(i2c_dev);
694694

695-
struct bus_type i2c_bus_type = {
695+
const struct bus_type i2c_bus_type = {
696696
.name = "i2c",
697697
.match = i2c_device_match,
698698
.probe = i2c_device_probe,

include/linux/i2c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <linux/swab.h> /* for swab16 */
2424
#include <uapi/linux/i2c.h>
2525

26-
extern struct bus_type i2c_bus_type;
26+
extern const struct bus_type i2c_bus_type;
2727
extern struct device_type i2c_adapter_type;
2828
extern struct device_type i2c_client_type;
2929

sound/soc/rockchip/rk3399_gru_sound.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ static const struct rockchip_sound_route rockchip_routes[] = {
446446

447447
struct dailink_match_data {
448448
const char *compatible;
449-
struct bus_type *bus_type;
449+
const struct bus_type *bus_type;
450450
};
451451

452452
static const struct dailink_match_data dailink_match[] = {

0 commit comments

Comments
 (0)