Skip to content

Commit f16a237

Browse files
tamirdojeda
authored andcommitted
rust: kunit: use core::ffi::CStr method names
Prepare for `core::ffi::CStr` taking the place of `kernel::str::CStr` by avoid methods that only exist on the latter. Link: Rust-for-Linux#1075 Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Benno Lossin <lossin@kernel.org> Signed-off-by: Tamir Duberstein <tamird@gmail.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 141ba59 commit f16a237

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rust/kernel/kunit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ macro_rules! kunit_assert {
102102
unsafe impl Sync for UnaryAssert {}
103103

104104
static LOCATION: Location = Location($crate::bindings::kunit_loc {
105-
file: FILE.as_char_ptr(),
105+
file: $crate::str::as_char_ptr_in_const_context(FILE),
106106
line: LINE,
107107
});
108108
static ASSERTION: UnaryAssert = UnaryAssert($crate::bindings::kunit_unary_assert {
109109
assert: $crate::bindings::kunit_assert {},
110-
condition: CONDITION.as_char_ptr(),
110+
condition: $crate::str::as_char_ptr_in_const_context(CONDITION),
111111
expected_true: true,
112112
});
113113

@@ -202,7 +202,7 @@ pub const fn kunit_case(
202202
) -> kernel::bindings::kunit_case {
203203
kernel::bindings::kunit_case {
204204
run_case: Some(run_case),
205-
name: name.as_char_ptr(),
205+
name: kernel::str::as_char_ptr_in_const_context(name),
206206
attr: kernel::bindings::kunit_attributes {
207207
speed: kernel::bindings::kunit_speed_KUNIT_SPEED_NORMAL,
208208
},

0 commit comments

Comments
 (0)