]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
HID: make hid_bus_type const
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 07:38:46 +0000 (08:38 +0100)
committerJiri Kosina <jkosina@suse.com>
Tue, 2 Jan 2024 10:25:28 +0000 (11:25 +0100)
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 <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-core.c
include/linux/hid.h

index e0181218ad857862aba07f6ff0ffe30df42bfb16..de7a477d66656c9843db1733b12a8e07f1a8b7b5 100644 (file)
@@ -2749,7 +2749,7 @@ static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
        return 0;
 }
 
-struct bus_type hid_bus_type = {
+const struct bus_type hid_bus_type = {
        .name           = "hid",
        .dev_groups     = hid_dev_groups,
        .drv_groups     = hid_drv_groups,
index bf43f3ff666400fb8a5d0fcef9e1c20773dcde1e..7c26db874ff0323c2cfc91785ae1c45ec567440f 100644 (file)
@@ -912,7 +912,7 @@ extern bool hid_ignore(struct hid_device *);
 extern int hid_add_device(struct hid_device *);
 extern void hid_destroy_device(struct hid_device *);
 
-extern struct bus_type hid_bus_type;
+extern const struct bus_type hid_bus_type;
 
 extern int __must_check __hid_register_driver(struct hid_driver *,
                struct module *, const char *mod_name);