Commit 1dcd763b authored by Tamir Duberstein's avatar Tamir Duberstein Committed by Miguel Ojeda
Browse files

rust: clk: use `CStr::as_char_ptr`



Replace the use of `as_ptr` which works through `<CStr as
Deref<Target=&[u8]>::deref()` in preparation for replacing
`kernel::str::CStr` with `core::ffi::CStr` as the latter does not
implement `Deref<Target=&[u8]>`.

Signed-off-by: default avatarTamir Duberstein <tamird@gmail.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/20251018-cstr-core-v18-14-9378a54385f8@gmail.com


Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent 9ce084e5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ impl Clk {
        ///
        /// [`clk_get`]: https://docs.kernel.org/core-api/kernel-api.html#c.clk_get
        pub fn get(dev: &Device, name: Option<&CStr>) -> Result<Self> {
            let con_id = name.map_or(ptr::null(), |n| n.as_ptr());
            let con_id = name.map_or(ptr::null(), |n| n.as_char_ptr());

            // SAFETY: It is safe to call [`clk_get`] for a valid device pointer.
            //
@@ -304,7 +304,7 @@ impl OptionalClk {
        /// [`clk_get_optional`]:
        /// https://docs.kernel.org/core-api/kernel-api.html#c.clk_get_optional
        pub fn get(dev: &Device, name: Option<&CStr>) -> Result<Self> {
            let con_id = name.map_or(ptr::null(), |n| n.as_ptr());
            let con_id = name.map_or(ptr::null(), |n| n.as_char_ptr());

            // SAFETY: It is safe to call [`clk_get_optional`] for a valid device pointer.
            //