Skip to content

Commit 24e041e

Browse files
KunWuChangregkh
authored andcommitted
platform: Make platform_bus_type constant
Since commit d492cc2 ("driver core: device.h: make struct bus_type a const *"), the driver core can properly handle constant struct bus_type, move the platform_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman <[email protected]> Suggested-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kunwu Chan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a169a66 commit 24e041e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/base/platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ static const struct dev_pm_ops platform_dev_pm_ops = {
14741474
USE_PLATFORM_PM_SLEEP_OPS
14751475
};
14761476

1477-
struct bus_type platform_bus_type = {
1477+
const struct bus_type platform_bus_type = {
14781478
.name = "platform",
14791479
.dev_groups = platform_dev_groups,
14801480
.match = platform_match,

include/linux/platform_device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct platform_device {
5252
extern int platform_device_register(struct platform_device *);
5353
extern void platform_device_unregister(struct platform_device *);
5454

55-
extern struct bus_type platform_bus_type;
55+
extern const struct bus_type platform_bus_type;
5656
extern struct device platform_bus;
5757

5858
extern struct resource *platform_get_resource(struct platform_device *,

0 commit comments

Comments
 (0)