Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Tamir Duberstein <tamird@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/20251018-cstr-core-v18-14-9378a54385f8@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Tamir Duberstein and committed by
Miguel Ojeda
1dcd763b 9ce084e5

+2 -2
+2 -2
rust/kernel/clk.rs
··· 136 136 /// 137 137 /// [`clk_get`]: https://docs.kernel.org/core-api/kernel-api.html#c.clk_get 138 138 pub fn get(dev: &Device, name: Option<&CStr>) -> Result<Self> { 139 - let con_id = name.map_or(ptr::null(), |n| n.as_ptr()); 139 + let con_id = name.map_or(ptr::null(), |n| n.as_char_ptr()); 140 140 141 141 // SAFETY: It is safe to call [`clk_get`] for a valid device pointer. 142 142 // ··· 304 304 /// [`clk_get_optional`]: 305 305 /// https://docs.kernel.org/core-api/kernel-api.html#c.clk_get_optional 306 306 pub fn get(dev: &Device, name: Option<&CStr>) -> Result<Self> { 307 - let con_id = name.map_or(ptr::null(), |n| n.as_ptr()); 307 + let con_id = name.map_or(ptr::null(), |n| n.as_char_ptr()); 308 308 309 309 // SAFETY: It is safe to call [`clk_get_optional`] for a valid device pointer. 310 310 //