[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250224095945.xjcjwkoqlgcsd2np@vireshk-i7>
Date: Mon, 24 Feb 2025 15:29:45 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Rob Herring <robh@...nel.org>
Cc: Sebastian Reichel <sebastian.reichel@...labora.com>,
Danilo Krummrich <dakr@...nel.org>,
Daniel Almeida <daniel.almeida@...labora.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...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 <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Russell King <linux@...linux.org.uk>, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH V2 2/2] rust: Add basic bindings for clk APIs
On 21-02-25, 15:59, Rob Herring wrote:
> It would be nice to handle the optional case from the start. Otherwise,
> driver writers handle optional or not optional themselves. The not
> optional case is typically some form of error message duplicated in
> every driver.
>
> Every foo_get() needs foo_get_optional(), so let's figure out the rust
> way to handle this once for everyone.
Are we talking about adding another field here (like below code) or
something else ?
impl Clk {
pub fn get(dev: &Device, name: Option<&CStr>, optional: bool) -> Result<Self> {
...
let clk = if optional {
bindings::clk_get(dev.as_raw(), con_id)
else {
bindings::clk_get_optional(dev.as_raw(), con_id)
};
Ok(Self(from_err_ptr(clk)?))
}
}
--
viresh
Powered by blists - more mailing lists