summaryrefslogtreecommitdiff
path: root/rust/helpers
diff options
context:
space:
mode:
authorTimur Tabi <ttabi@nvidia.com>2026-03-19 16:26:53 -0500
committerDanilo Krummrich <dakr@kernel.org>2026-03-24 23:51:23 +0100
commitd35ae50c5f48dfcd33cb24bf477ce912fa0af1f7 (patch)
tree66e7e187b53b5541fdce788b7a1b4e810b71e1b6 /rust/helpers
parent651c27d6a7e2b92eb30f56738dc45e861c975921 (diff)
rust: device: add device name method
Add a name() method to the `Device` type, which returns a CStr that contains the device name. Signed-off-by: Timur Tabi <ttabi@nvidia.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Gary Guo <gary@garyguo.net> Tested-by: John Hubbard <jhubbard@nvidia.com> Tested-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260319212658.2541610-2-ttabi@nvidia.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/helpers')
-rw-r--r--rust/helpers/device.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/helpers/device.c b/rust/helpers/device.c
index a8ab931a9bd1..3be4ee590784 100644
--- a/rust/helpers/device.c
+++ b/rust/helpers/device.c
@@ -25,3 +25,8 @@ __rust_helper void rust_helper_dev_set_drvdata(struct device *dev, void *data)
{
dev_set_drvdata(dev, data);
}
+
+__rust_helper const char *rust_helper_dev_name(const struct device *dev)
+{
+ return dev_name(dev);
+}