[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bk7rp5zyw6n4txhgbyq4gi3cegi6fkwhvkk7gdvtqp3en7uidu@wgaohfzkp4i2>
Date: Wed, 17 Sep 2025 11:51:36 +0200
From: Benjamin Tissoires <bentiss@...nel.org>
To: Rahul Rameshbabu <sergeantsagara@...tonmail.com>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, Jiri Kosina <jikos@...nel.org>, a.hindborg@...nel.org,
alex.gaynor@...il.com, aliceryhl@...gle.com, benno.lossin@...ton.me,
Benjamin Tissoires <benjamin.tissoires@...hat.com>, bjorn3_gh@...tonmail.com, boqun.feng@...il.com, dakr@...nel.org,
db48x@...8x.net, gary@...yguo.net, ojeda@...nel.org, tmgross@...ch.edu,
peter.hutterer@...-t.net
Subject: Re: [PATCH v3 RESEND RESEND 1/3] HID: core: Change hid_driver to use
a const char* for name
On Sep 13 2025, Rahul Rameshbabu wrote:
> 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@...tonmail.com>
While we figure out the rest, I'm queueing this one patch in my test
setup and will probably merge it for 6.18. This way, the rest of the
series is purely rust and doesn't depend on anything on the HID tree.
Cheers,
Benjamin
> ---
> include/linux/hid.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index 568a9d8c749b..d65c202783da 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h
> @@ -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;
> --
> 2.47.2
>
>
Powered by blists - more mailing lists