mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rahul Rameshbabu <sergeantsagara@protonmail.com>
To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	rust-for-linux@vger.kernel.org
Cc: Jiri Kosina <jikos@kernel.org>,
	a.hindborg@kernel.org, alex.gaynor@gmail.com,
	aliceryhl@google.com, benno.lossin@proton.me,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	bjorn3_gh@protonmail.com, boqun.feng@gmail.com, dakr@kernel.org,
	db48x@db48x.net, gary@garyguo.net, ojeda@kernel.org,
	tmgross@umich.edu, peter.hutterer@who-t.net,
	Rahul Rameshbabu <sergeantsagara@protonmail.com>
Subject: [PATCH v3 RESEND RESEND 1/3] HID: core: Change hid_driver to use a const char* for name
Date: Sat, 13 Sep 2025 16:12:54 +0000	[thread overview]
Message-ID: <20250913161222.3889-2-sergeantsagara@protonmail.com> (raw)
In-Reply-To: <20250913161222.3889-1-sergeantsagara@protonmail.com>

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>
---
 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



  reply	other threads:[~2025-09-13 16:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-13 16:12 [PATCH v3 RESEND RESEND 0/3] Initial work for Rust abstraction for HID device driver development Rahul Rameshbabu
2025-09-13 16:12 ` Rahul Rameshbabu [this message]
2025-09-17  9:51   ` [PATCH v3 RESEND RESEND 1/3] HID: core: Change hid_driver to use a const char* for name Benjamin Tissoires
2025-09-13 16:13 ` [PATCH v3 RESEND RESEND 2/3] rust: core abstractions for HID drivers Rahul Rameshbabu
2025-09-17 10:04   ` Benjamin Tissoires
2025-09-17 12:08     ` Rahul Rameshbabu
2025-09-13 16:13 ` [PATCH v3 RESEND RESEND 3/3] rust: hid: Glorious PC Gaming Race Model O and O- mice reference driver Rahul Rameshbabu
2025-09-17 10:25 ` (subset) [PATCH v3 RESEND RESEND 0/3] Initial work for Rust abstraction for HID device driver development Benjamin Tissoires
2025-09-17 11:59   ` Rahul Rameshbabu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250913161222.3889-2-sergeantsagara@protonmail.com \
    --to=sergeantsagara@protonmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=db48x@db48x.net \
    --cc=gary@garyguo.net \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=peter.hutterer@who-t.net \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®