mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: "Daniel Sedlak" <daniel@sedlak.dev>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Georgi Djakov" <djakov@kernel.org>,
	"Dmitry Baryshkov" <dmitry.baryshkov@oss.qualcomm.com>,
	"Bjorn Andersson" <bjorn.andersson@oss.qualcomm.com>
Cc: Marijn Suijten <marijn.suijten@somainline.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH 1/2] rust: Add initial interconnect framework abstractions
Date: Wed, 23 Jul 2025 13:36:08 +0200	[thread overview]
Message-ID: <4c9e4399-7337-43dd-9efc-c530d0989bbb@oss.qualcomm.com> (raw)
In-Reply-To: <d0891c62-6c9a-4036-bf63-f5070ebba084@sedlak.dev>

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

  reply	other threads:[~2025-07-23 11:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22 21:14 [PATCH 0/2] Add initial interconnect (icc_path) Rust abstractions Konrad Dybcio
2025-07-22 21:14 ` [PATCH 1/2] rust: Add initial interconnect framework abstractions Konrad Dybcio
2025-07-23 10:42   ` Miguel Ojeda
2025-07-23 11:32     ` Konrad Dybcio
2025-07-23 11:41       ` Miguel Ojeda
2025-07-23 11:42         ` Miguel Ojeda
2025-07-23 11:53         ` Konrad Dybcio
2025-07-23 10:44   ` Daniel Sedlak
2025-07-23 11:36     ` Konrad Dybcio [this message]
2025-07-23 11:34   ` kernel test robot
2025-07-23 12:36   ` Daniel Almeida
2025-07-22 21:14 ` [PATCH DNM 2/2] interconnect: Add a test Rust consumer driver Konrad Dybcio
2025-07-23 13:10   ` Daniel Almeida
2025-07-23 13:22     ` Benno Lossin
2025-12-19 12:57       ` Konrad Dybcio
2025-07-23 10:22 ` [PATCH 0/2] Add initial interconnect (icc_path) Rust abstractions Miguel Ojeda
2025-07-24 12:36   ` Konrad Dybcio
2025-07-24 15:55     ` Miguel Ojeda
2025-12-19 12:58       ` Konrad Dybcio

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=4c9e4399-7337-43dd-9efc-c530d0989bbb@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn.andersson@oss.qualcomm.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel@sedlak.dev \
    --cc=djakov@kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gary@garyguo.net \
    --cc=konradybcio@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®