[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c9e4399-7337-43dd-9efc-c530d0989bbb@oss.qualcomm.com>
Date: Wed, 23 Jul 2025 13:36:08 +0200
From: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
To: Daniel Sedlak <daniel@...lak.dev>, Konrad Dybcio
<konradybcio@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron
<bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, Georgi Djakov <djakov@...nel.org>,
Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>,
Bjorn Andersson <bjorn.andersson@....qualcomm.com>
Cc: Marijn Suijten <marijn.suijten@...ainline.org>,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH 1/2] rust: Add initial interconnect framework abstractions
On 7/23/25 12:44 PM, Daniel Sedlak wrote:
> Hi Konrad,
[...]
>> + /// Create a new instance from bits (b) per second
>> + pub const fn from_bits_per_sec(_bps: u32) -> Self {
>> + Self(1)
>> + }
>
> This is a very shady API. If I were to call
>
> let bw = IccBwUnit::from_bits_per_sec(16);
>
> I would expect.
>
> assert_eq!(bw.as_bytes_per_sec(), 2);
>
> But it would fail (assuming that 8 bits = 1 byte), since IccBwUnit::from_bits_per_sec(), always assigns 1.
I followed the C api:
include/linux/interconnect.h
18:#define bps_to_icc(x) (1)
But indeed, something like bw.div_ceil(8) makes more logical sense
>> diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
>> index 87bcaa1c6b8a6291e71905e8dde60d945b654b98..60f6ac6e79cce57a8538ea0ad48f34f51af91731 100644
>> --- a/rust/kernel/lib.rs
>> +++ b/rust/kernel/lib.rs
>> @@ -89,6 +89,7 @@
>> pub mod fmt;
>> pub mod fs;
>> pub mod init;
>> +pub mod icc;
>
> Nit: formatting/missing space?
No, it's actually fine.. git decided that context lines shall begin
with a space
Konrad
Powered by blists - more mailing lists