From: Danilo Krummrich <dakr@redhat.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@samsung.com>,
"Alice Ryhl" <aliceryhl@google.com>,
linux-pm@vger.kernel.org,
"Vincent Guittot" <vincent.guittot@linaro.org>,
"Stephen Boyd" <sboyd@kernel.org>, "Nishanth Menon" <nm@ti.com>,
rust-for-linux@vger.kernel.org,
"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
"Erik Schilling" <erik.schilling@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Joakim Bech" <joakim.bech@linaro.org>,
"Rob Herring" <robh@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V4 8/8] cpufreq: Add Rust based cpufreq-dt driver
Date: Thu, 11 Jul 2024 12:43:12 +0200 [thread overview]
Message-ID: <Zo-3QIPbhBsv8EjB@pollux> (raw)
In-Reply-To: <b1601c1dbdf68a4b812fcfaf73f3b5dea67f2025.1720680252.git.viresh.kumar@linaro.org>
On Thu, Jul 11, 2024 at 12:27:50PM +0530, Viresh Kumar wrote:
> This commit adds a Rust based cpufreq-dt driver, which covers most of
> the functionality of the existing C based driver. Only a handful of
> things are left, like fetching platform data from cpufreq-dt-platdev.c.
>
> This is tested with the help of QEMU for now and switching of
> frequencies work as expected.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> drivers/cpufreq/Kconfig | 12 ++
> drivers/cpufreq/Makefile | 1 +
> drivers/cpufreq/rcpufreq_dt.rs | 222 +++++++++++++++++++++++++++++++++
> 3 files changed, 235 insertions(+)
> create mode 100644 drivers/cpufreq/rcpufreq_dt.rs
>
> diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
> new file mode 100644
> index 000000000000..3e86ad134e13
> --- /dev/null
> +++ b/drivers/cpufreq/rcpufreq_dt.rs
> +
> +impl platform::Driver for CPUFreqDTDriver {
> + type Data = ();
> +
> + define_of_id_table! {(), [
> + (of::DeviceId(b_str!("operating-points-v2")), None),
> + ]}
> +
> + fn probe(dev: &mut platform::Device, _id_info: Option<&Self::IdInfo>) -> Result<Self::Data> {
> + let drv = cpufreq::Registration::<CPUFreqDTDriver>::register(
Please just call this function `cpufreq::Registration::new`.
The existance of a `cpufreq::Registration` means that it's registered. Once it
is dropped, it's unregistered. It's the whole point of a `Registration` type
to bind the period of a driver being registered to the lifetime of a
`Registration` instance.
Having `Registration::register` implies a bit, that we could ever have an
unregistered `Registration`, which can never happen.
Besides that, it'd be nice to follow the same naming scheme everywhere.
> + c_str!("cpufreq-dt"),
> + (),
> + cpufreq::flags::NEED_INITIAL_FREQ_CHECK | cpufreq::flags::IS_COOLING_DEV,
> + true,
> + )?;
> +
> + Devres::new_foreign_owned(dev.as_ref(), drv, GFP_KERNEL)?;
This should be called by `cpufreq::Registration` directly, otherwise it's every
driver's responsibility to take care of the registration lifetime.
> +
> + pr_info!("CPUFreq DT driver registered\n");
> +
> + Ok(())
> + }
> +}
> +
> +module_platform_driver! {
> + type: CPUFreqDTDriver,
> + name: "cpufreq_dt",
> + author: "Viresh Kumar <viresh.kumar@linaro.org>",
> + description: "Generic CPUFreq DT driver",
> + license: "GPL v2",
> +}
> --
> 2.31.1.272.g89b43f80a514
>
next prev parent reply other threads:[~2024-07-11 10:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 6:57 [PATCH V4 0/8] Rust bindings for cpufreq and OPP core + sample driver Viresh Kumar
2024-07-11 6:57 ` [PATCH V4 1/8] rust: Add initial bindings for OPP framework Viresh Kumar
2024-07-11 6:57 ` [PATCH V4 2/8] rust: Extend OPP bindings for the OPP table Viresh Kumar
2024-07-11 6:57 ` [PATCH V4 3/8] rust: Extend OPP bindings for the configuration options Viresh Kumar
2024-07-11 6:57 ` [PATCH V4 4/8] rust: Add initial bindings for cpufreq framework Viresh Kumar
2024-07-11 6:57 ` [PATCH V4 5/8] rust: Extend cpufreq bindings for policy and driver ops Viresh Kumar
2024-07-11 6:57 ` [PATCH V4 6/8] rust: Extend cpufreq bindings for driver registration Viresh Kumar
2024-07-11 6:57 ` [PATCH V4 7/8] rust: Extend OPP bindings with CPU frequency table Viresh Kumar
2024-07-11 6:57 ` [PATCH V4 8/8] cpufreq: Add Rust based cpufreq-dt driver Viresh Kumar
2024-07-11 10:43 ` Danilo Krummrich [this message]
2024-07-11 13:08 ` Viresh Kumar
2024-07-11 13:21 ` Danilo Krummrich
2024-07-11 14:37 ` Greg KH
2024-07-11 16:12 ` Danilo Krummrich
2024-07-11 16:34 ` Greg KH
2024-07-11 16:41 ` Greg KH
2024-07-11 17:21 ` Greg KH
2024-07-11 17:42 ` Danilo Krummrich
2024-07-16 15:15 ` Danilo Krummrich
2024-07-16 15:22 ` Greg KH
2024-07-16 15:53 ` Rob Herring
2024-07-16 22:33 ` Danilo Krummrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zo-3QIPbhBsv8EjB@pollux \
--to=dakr@redhat.com \
--cc=a.hindborg@samsung.com \
--cc=alex.bennee@linaro.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=erik.schilling@linaro.org \
--cc=gary@garyguo.net \
--cc=joakim.bech@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=manos.pitsidianakis@linaro.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=nm@ti.com \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=wedsonaf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.