summaryrefslogtreecommitdiff
path: root/rust/helpers
diff options
context:
space:
mode:
authorMarkus Probst <markus.probst@posteo.de>2026-07-18 15:33:11 +0000
committerDanilo Krummrich <dakr@kernel.org>2026-07-23 22:48:24 +0200
commit99f59aa82341c8491a1b94c5dd9c666fe979a479 (patch)
tree5e9f8cbc659b355c3505b17bae6349b4e7853899 /rust/helpers
parent0e6f8ccd4618afdb504d5c56fe2fea1a2cd5d86a (diff)
rust: add basic serial device bus abstractions
Implement the basic serial device bus abstractions required to write a serial device bus device driver with or without the need for initial device data. This includes the following data structures: The `serdev::Driver` trait represents the interface to the driver. The `serdev::Device` abstraction represents a `struct serdev_device`. In order to provide the Serdev specific parts to a generic `driver::Registration` the `driver::RegistrationOps` trait is implemented by `serdev::Adapter`. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Markus Probst <markus.probst@posteo.de> Link: https://patch.msgid.link/20260718-rust_serdev-v16-1-5809384d2e1b@posteo.de Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/helpers')
-rw-r--r--rust/helpers/helpers.c1
-rw-r--r--rust/helpers/serdev.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 998e31052e66..6921a5ecb78a 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -87,6 +87,7 @@
#include "regulator.c"
#include "scatterlist.c"
#include "security.c"
+#include "serdev.c"
#include "signal.c"
#include "slab.c"
#include "spinlock.c"
diff --git a/rust/helpers/serdev.c b/rust/helpers/serdev.c
new file mode 100644
index 000000000000..c52b78ca3fc7
--- /dev/null
+++ b/rust/helpers/serdev.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/serdev.h>
+
+__rust_helper
+void rust_helper_serdev_device_driver_unregister(struct serdev_device_driver *sdrv)
+{
+ serdev_device_driver_unregister(sdrv);
+}
+
+__rust_helper
+void rust_helper_serdev_device_put(struct serdev_device *serdev)
+{
+ serdev_device_put(serdev);
+}
+
+__rust_helper
+void rust_helper_serdev_device_set_client_ops(struct serdev_device *serdev,
+ const struct serdev_device_ops *ops)
+{
+ serdev_device_set_client_ops(serdev, ops);
+}