Re: [RFC PATCH V3 8/8] cpufreq: Add Rust based cpufreq-dt driver

From: Viresh Kumar
Date: Thu Jul 11 2024 - 02:06:15 EST


On 10-07-24, 17:28, Danilo Krummrich wrote:
> No, the platform driver layer will only guarantee that it decreses the reference
> count of the `Arc` by one, that doesn't guarantee a free. If something else
> still holds a reference to the `Arc` it will keep the `Registration` alive,
> unless it's wrapped by `Devres`.

I see. Thanks.

There is one problem that I haven't found a solution to yet. If I make
the following change to the driver:

diff --git a/drivers/cpufreq/rcpufreq_dt.rs b/drivers/cpufreq/rcpufreq_dt.rs
index 315adca2a747..052ea2db095a 100644
--- a/drivers/cpufreq/rcpufreq_dt.rs
+++ b/drivers/cpufreq/rcpufreq_dt.rs
@@ -236,7 +236,7 @@ fn probe(dev: &mut platform::Device, _id_info: Option<&Self::IdInfo>) -> Result<

module_platform_driver! {
type: CPUFreqDTDriver,
- name: "cpufreq_dt",
+ name: "cpufreq-dt",
author: "Viresh Kumar <viresh.kumar@xxxxxxxxxx>",
description: "Generic CPUFreq DT driver",
license: "GPL v2",

then I get this error:

CLIPPY drivers/cpufreq/rcpufreq_dt.o
error: expected one of `:`, `;`, or `=`, found `-`
--> /mnt/ssd/all/work/repos/kernel/linux/drivers/cpufreq/rcpufreq_dt.rs:237:1
|
237 | / module_platform_driver! {
238 | | type: CPUFreqDTDriver,
239 | | name: "cpufreq-dt",
240 | | author: "Viresh Kumar <viresh.kumar@xxxxxxxxxx>",
241 | | description: "Generic CPUFreq DT driver",
242 | | license: "GPL v2",
243 | | }
| |_^ expected one of `:`, `;`, or `=`
|
= note: this error originates in the macro
`$crate::prelude::module` which comes from the expansion of the
macro `module_platform_driver` (in Nightly builds, run with -Z
macro-backtrace for more info)


And because of that I had to change the name of the platform device
too in the existing kernel.

--
viresh