[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aBCSymzemg_6Fy2h@pollux>
Date: Tue, 29 Apr 2025 10:50:18 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Remo Senekowitsch <remo@...nzli.dev>
Cc: Rob Herring <robh@...nel.org>, 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:50:19PM +0200, Remo Senekowitsch wrote:
> 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.
Fine with me; required() also seems not useful to implement required_by().
However, I think we should revisit those generic error prints once we tackled
the issue of ergonomics in finding the source of an error in general.
Powered by blists - more mailing lists