Re: [RFC PATCH 3/3] cpufreq: Add Rust based cpufreq-dt driver
From: Viresh Kumar
Date: Mon Apr 22 2024 - 06:32:34 EST
On 07-04-24, 10:17, Benno Lossin wrote:
> On 07.04.24 11:54, Benno Lossin wrote:
> > On 05.04.24 13:09, Viresh Kumar wrote:
> >> +// Finds exact supply name from the OF node.
> >> +fn find_supply_name_exact(np: *mut bindings::device_node, name: &str) -> Option<CString> {
> >> + let sname = CString::try_from_fmt(fmt!("{}-supply", name)).ok()?;
> >> +
> >> + // SAFETY: The OF node is guaranteed by the C code to be valid.
> >> + let pp = unsafe { bindings::of_find_property(np, sname.as_ptr() as *mut _, ptr::null_mut()) };
> >
> > Drivers should avoid calling `unsafe` code as much as possible. They
> > also should not be calling `bindings` code directly. Please write (or
> > find) abstractions for these `unsafe` calls.
>
> Having re-read the cover letter, I see that you are already aware of
> this. If you need any help with creating the abstractions, feel free to
> reach out!
Thanks Benno. I am not sure what's the right approach here as there
are so many missing things (frameworks) I need. Though I don't need
full support for them but just a handful of APIs.
And then there is dependency on the generic support for device/driver,
platform device/driver, etc.
--
viresh