From 1d9d6752601ddfefc25fcedef6446a4b2d49f0ab Mon Sep 17 00:00:00 2001 From: David Brown Date: Fri, 26 Jul 2024 08:46:57 -0600 Subject: [PATCH] rust: Convert k_str_out to bindgen one Remove the manual k_str_out wrapper, and use the one generated by bindgen. Signed-off-by: David Brown --- lib/rust/main.c | 10 ---------- lib/rust/zephyr/src/printk.rs | 6 +----- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/rust/main.c b/lib/rust/main.c index 634b15a6545dd8..a5fa648cbd1dce 100644 --- a/lib/rust/main.c +++ b/lib/rust/main.c @@ -16,14 +16,4 @@ int main(void) return 0; } -#ifdef CONFIG_PRINTK -/* - * Until we have syscall support in Rust, wrap this syscall. - */ -void wrapped_str_out(char *c, size_t n) -{ - k_str_out(c, n); -} -#endif - #endif diff --git a/lib/rust/zephyr/src/printk.rs b/lib/rust/zephyr/src/printk.rs index 6b13a6e26c0890..a8183aef2b13d8 100644 --- a/lib/rust/zephyr/src/printk.rs +++ b/lib/rust/zephyr/src/printk.rs @@ -77,7 +77,7 @@ impl Context { fn flush(&mut self) { if self.count > 0 { unsafe { - wrapped_str_out(self.buf.as_ptr(), self.count); + zephyr_sys::k_str_out(self.buf.as_mut_ptr() as *mut i8, self.count); } self.count = 0; } @@ -111,7 +111,3 @@ pub fn printkln(args: Arguments<'_>) { context.add_byte(b'\n'); context.flush(); } - -extern "C" { - fn wrapped_str_out(buf: *const u8, len: usize); -}