[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240619120407.o7qh6jlld76j5luu@vireshk-i7>
Date: Wed, 19 Jun 2024 17:34:07 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Danilo Krummrich <dakr@...hat.com>
Cc: gregkh@...uxfoundation.org, rafael@...nel.org, bhelgaas@...gle.com,
ojeda@...nel.org, alex.gaynor@...il.com, wedsonaf@...il.com,
boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me, a.hindborg@...sung.com,
aliceryhl@...gle.com, airlied@...il.com, fujita.tomonori@...il.com,
lina@...hilina.net, pstanner@...hat.com, ajanulgu@...hat.com,
lyude@...hat.com, robh@...nel.org, daniel.almeida@...labora.com,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org,
Manos Pitsidianakis <manos.pitsidianakis@...aro.org>,
Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: [PATCH v2 00/10] Device / Driver and PCI Rust abstractions
On 19-06-24, 01:39, Danilo Krummrich wrote:
> - move base device ID abstractions to a separate source file (Greg)
> - remove `DeviceRemoval` trait in favor of using a `Devres` callback to
> unregister drivers
> - remove `device::Data`, we don't need this abstraction anymore now that we
> `Devres` to revoke resources and registrations
Hi Danilo,
I am working on writing bindings for CPUFreq drivers [1] and was
looking to rebase over staging/rust-device, and I am not sure how to
proceed after device::Data is dropped now.
What I was doing at probe() was something like this:
fn probe(dev: &mut platform::Device, id_info: Option<&Self::IdInfo>) -> Result<Self::Data> {
let data = Arc::<DeviceData>::from(kernel::new_device_data!(
cpufreq::Registration::new(),
(),
"CPUFreqDT::Registration"
)?);
...
// Need a mutable object to be passed to register() here.
data.registrations()
.ok_or(ENXIO)?
.as_pinned_mut()
.register(c_str!("cpufreq-dt"), ...)?;
Ok(data)
}
The register() function of cpufreq core needs a mutable pointer to
`self` and it worked earlier as Data used a RevocableMutex. But with
Devres, we don't have a Mutex anymore and devres.try_access() doesn't
give a mutable object.
I am a bit confused on how to get this going. I looked at how PCI bus
is implemented in the staging/dev but I couldn't find an end driver
using this work.
Maybe I am making an mistake and missing the obvious.
Thanks.
--
viresh
[1] https://lore.kernel.org/all/cover.1717750631.git.viresh.kumar@linaro.org/
Powered by blists - more mailing lists