Skip to content

Commit 37d158d

Browse files
gregkhJiri Kosina
authored andcommitted
HID: make hid_bus_type const
Now that the driver core can properly handle constant struct bus_type, move the hid_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Jiri Kosina <[email protected]> Cc: Benjamin Tissoires <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 3f10e21 commit 37d158d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/hid/hid-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2749,7 +2749,7 @@ static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
27492749
return 0;
27502750
}
27512751

2752-
struct bus_type hid_bus_type = {
2752+
const struct bus_type hid_bus_type = {
27532753
.name = "hid",
27542754
.dev_groups = hid_dev_groups,
27552755
.drv_groups = hid_drv_groups,

include/linux/hid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ extern bool hid_ignore(struct hid_device *);
912912
extern int hid_add_device(struct hid_device *);
913913
extern void hid_destroy_device(struct hid_device *);
914914

915-
extern struct bus_type hid_bus_type;
915+
extern const struct bus_type hid_bus_type;
916916

917917
extern int __must_check __hid_register_driver(struct hid_driver *,
918918
struct module *, const char *mod_name);

0 commit comments

Comments
 (0)