From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00E401FAC48; Wed, 23 Apr 2025 12:05:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745409937; cv=none; b=aGy/86B+oc/yoiM29Ufx1pqPfhdduON/+4re5ypkrCiiaGgEwYNeEqk43EIcFqp013ZQePh5h9hgELT79sE4FAMAXdmak7yEZFH6AX+Fk1i8cGdZbfE5qLE+zYR6yGp4EwMf3T/gsES1A15gOalivBYSNF/+IfRy2FboW7we9rk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745409937; c=relaxed/simple; bh=/kvgqZE/r/9J65nWsx0jZLdM7cszgoACFIAVIubFz6g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CG+BQG5CSwRFvoFcnXmpjubMucHYN+8b9l4pbb8pdMl9EQiTVA26czBYPYA496mfwSUEzEchCQutEWqtnaVe2CuHfmNwNBVDcJLSTdvFvmYOW9UWZTyOJ9oSCaHg2aS62i+TBtk3RoCQzmFecbCQzQh/mAt8ytpNkBZH/qSbclo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gZSOgX2A; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gZSOgX2A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0431FC4CEE2; Wed, 23 Apr 2025 12:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745409936; bh=/kvgqZE/r/9J65nWsx0jZLdM7cszgoACFIAVIubFz6g=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=gZSOgX2AeGB8+9oCfds03dU+/3CjtDIKs7ApO7jTqWn/6LE6PgbCvcBtze9v635ca Gdm5wZ68NHC+wYc4odpYaviMxaEMNQB9ECYKjitrPKoMHLBYPasycWpQy5cv84D5zF P6Iqex/KJSzVPEuR/OHa+m8nXhhO/geMQAvXYpG/ktAGTnHgvvJxCH92GmtAlMIPex v8sC5CM5c+1NkQTaG7gSy9AlVGRVLi7d0i0BRdLcFhDCFGfFCXxwHOzZNKjc66caEg 771mj5tifrwmGsiuBK3hWjNS5Zz0Eb2HmyFLBBo3HbgTBMzGOcv7uRH0n8RtS08hXM Ck2fEWXt/rhIA== Message-ID: <975c8346-dddc-44ef-ab24-71cadfbce23a@kernel.org> Date: Wed, 23 Apr 2025 14:05:29 +0200 Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V11 13/15] rust: cpufreq: Extend abstractions for driver registration To: Viresh Kumar Cc: "Rafael J. Wysocki" , Miguel Ojeda , Danilo Krummrich , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , rust-for-linux@vger.kernel.org, Manos Pitsidianakis , =?UTF-8?Q?Alex_Benn=C3=A9e?= , Joakim Bech , Rob Herring , Yury Norov , Burak Emir , Rasmus Villemoes , Russell King , linux-clk@vger.kernel.org, Michael Turquette , linux-kernel@vger.kernel.org References: From: Danilo Krummrich Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/21/25 9:22 AM, Viresh Kumar wrote: > Extend the cpufreq abstractions to support driver registration from > Rust. > > Signed-off-by: Viresh Kumar > --- > rust/kernel/cpufreq.rs | 490 ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 488 insertions(+), 2 deletions(-) > > diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs > index 5e0bfd03fd30..8628f0bada02 100644 > --- a/rust/kernel/cpufreq.rs > +++ b/rust/kernel/cpufreq.rs > + /// Registers a CPU frequency driver with the cpufreq core. > + pub fn new() -> Result { > + // We can't use `&Self::VTABLE` directly because the cpufreq core modifies some fields in > + // the C `struct cpufreq_driver`, which requires a mutable reference. > + let mut drv = KBox::new(UnsafeCell::new(Self::VTABLE), GFP_KERNEL)?; Maybe add a comment that it would be desired to make a struct cpufreq_driver capable of being declared as static const in the future. Either way, Reviewed-by: Danilo Krummrich