[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D9ILR2IG980H.34N8WNWKWJJO3@buenzli.dev>
Date: Mon, 28 Apr 2025 23:50:19 +0200
From: "Remo Senekowitsch" <remo@...nzli.dev>
To: "Danilo Krummrich" <dakr@...nel.org>, "Rob Herring" <robh@...nel.org>
Cc: "Dirk Behme" <dirk.behme@...bosch.com>, "Dirk Behme"
<dirk.behme@...il.com>, "Saravana Kannan" <saravanak@...gle.com>, "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>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
<rafael@...nel.org>, <linux-kernel@...r.kernel.org>,
<devicetree@...r.kernel.org>, <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH v3 3/7] rust: property: Introduce PropertyGuard
On Mon Apr 28, 2025 at 11:21 PM CEST, Danilo Krummrich wrote:
> On Mon, Apr 28, 2025 at 03:48:40PM -0500, Rob Herring wrote:
>>
>> One thing that's really hard to debug in C drivers is where an
>> error came from. You can for example turn on initcall_debug and see that
>> a driver probe returned an error. It's virtually impossible to tell
>> where that originated from. The only way to tell is with prints. That is
>> probably the root of why probe has so many error prints. I think we can
>> do a lot better with rust given Result can hold more than just an int.
>
> This I fully agree with, not sure if the solution is to put more stuff into the
> Result type though. However, there are things like #[track_caller] (also
> recently mentioned by Benno), which might be a good candidate for improving this
> situation.
>
> As mentioned, for now let's go with
>
> pub fn required_by(self, dev: &Device) -> Result<T>
>
> additional to required() for this purpose to get a proper dev_err() print.
Could it make sense to _replace_ `required` with `required_by` ?
Otherwise `required` sits a little awkwardly between `optional` and
`required_by`. I can't think of a situation where `required` would be
preferred.
Powered by blists - more mailing lists