]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
HID: core: Change hid_driver to use a const char* for name
authorRahul Rameshbabu <sergeantsagara@protonmail.com>
Sat, 13 Sep 2025 16:12:54 +0000 (16:12 +0000)
committerBenjamin Tissoires <bentiss@kernel.org>
Wed, 17 Sep 2025 09:48:01 +0000 (11:48 +0200)
name is never mutated by the core HID stack. Making name a const char*
simplifies passing the string from Rust to C. Otherwise, it becomes
difficult to pass a 'static lifetime CStr from Rust to a char*, rather than
a const char*, due to lack of guarantee that the underlying data of the
CStr will not be mutated by the C code.

Signed-off-by: Rahul Rameshbabu <sergeantsagara@protonmail.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
include/linux/hid.h

index 2cc4f1e4ea96375aeb656ab93a93c27be2a2a7ce..426b22ed42b4010c9040cefe0d90c4ef2e4de0e5 100644 (file)
@@ -816,7 +816,7 @@ struct hid_usage_id {
  * zero from them.
  */
 struct hid_driver {
-       char *name;
+       const char *name;
        const struct hid_device_id *id_table;
 
        struct list_head dyn_list;