From: Markus Probst <markus.probst@posteo.de>
To: Danilo Krummrich <dakr@kernel.org>
Cc: Markus Probst via B4 Relay
<devnull+markus.probst.posteo.de@kernel.org>,
Rob Herring <robh@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Miguel Ojeda <ojeda@kernel.org>, 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>,
Kari Argillander <kari.argillander@gmail.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Boqun Feng <boqun@kernel.org>, David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, linux-pm@vger.kernel.org,
driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v8 3/5] rust: add basic serial device bus abstractions
Date: Sat, 30 May 2026 16:30:07 +0000 [thread overview]
Message-ID: <be835bce958c99e9623ea240b67282d3b429ae9f.camel@posteo.de> (raw)
In-Reply-To: <DIW5HXH3HYDB.17132XFBBDBJL@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2518 bytes --]
On Sat, 2026-05-30 at 18:27 +0200, Danilo Krummrich wrote:
> On Sat May 30, 2026 at 6:23 PM CEST, Markus Probst wrote:
> > On Sat, 2026-05-30 at 18:14 +0200, Danilo Krummrich wrote:
> > > On Sat May 30, 2026 at 4:51 PM CEST, Markus Probst wrote:
> > > > On Sat, 2026-05-30 at 16:35 +0200, Danilo Krummrich wrote:
> > > > > On Sat May 30, 2026 at 4:27 PM CEST, Markus Probst wrote:
> > > > > > This would work, but I don't see how it would get rid of rust_private_data in
> > > > > > this way. The device private data will but the private bus abstraction data
> > > > > > needs to outlive the devres callbacks (which is done by rust_private_data).
> > > > >
> > > > > Why? You only ever use it in the receive callback, which won't be called after
> > > > > device unbind anymore.
> > > > Because the possibility exists that some classdev ops or Drop calls
> > > > e.g. sdev.set_baudrate. This is a null pointer dereference after
> > > > serdev_device_close has been called. I interpreted it to add a state to
> > > > the abstraction private data which would prevent those calls (early
> > > > return with error) after serdev_device_close has been called, but this
> > > > would only work if it outlives these calls.
> > > >
> > > > But it seems you were refering to something else with the state?
> > >
> > > Yes, but I just notice that I'm a step ahead. With the lifetime model class
> > > device registrations shouldn't be guarded with Devres anymore, but with a
> > > lifetime.
> > >
> > > (This also entirely eliminates the need for having different devres stages to
> > > prevent drivers from smuggling a newly created Devres object into an existing
> > > Devres<Registration<T>>'s data, which would be unsound for obvious reasons.)
> > >
> > > With this there is no way there are still class device callbacks after the bus
> > > device private data has been dropped in the first place.
> > There would still be Drop, which can access the device.
> > Drop happens after remove_callback.
>
> But you control drop(), so can order it such that first the driver's bus device
> private data drops and after this the private data of the bus wrapping it (which
> will also call serdev_device_close()).
Yes.
It seems I also have to rebase led then, as it currently uses Devres.
Thanks
- Markus Probst
>
> > Might be simpler for now: I can use a mutex to prevent calls in
> > receive_buf after remove_callback has been called.
> >
> > Thanks
> > - Markus Probst
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 870 bytes --]
next prev parent reply other threads:[~2026-05-31 13:58 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-30 1:13 [PATCH v8 0/5] rust: add basic serial device bus abstractions Markus Probst via B4 Relay
2026-05-30 1:13 ` [PATCH v8 1/5] rust: devres: return reference in `devres::register` Markus Probst via B4 Relay
2026-05-30 11:54 ` Danilo Krummrich
2026-05-30 17:37 ` Markus Probst
2026-06-04 5:57 ` Claude review: " Claude Code Review Bot
2026-05-30 1:13 ` [PATCH v8 2/5] serdev: add rust private data to serdev_device Markus Probst via B4 Relay
2026-06-04 5:57 ` Claude review: " Claude Code Review Bot
2026-05-30 1:13 ` [PATCH v8 3/5] rust: add basic serial device bus abstractions Markus Probst via B4 Relay
2026-05-30 13:10 ` Danilo Krummrich
2026-05-30 13:37 ` Markus Probst
2026-05-30 13:53 ` Markus Probst
2026-05-30 14:00 ` Markus Probst
2026-05-30 14:08 ` Danilo Krummrich
2026-05-30 14:27 ` Markus Probst
2026-05-30 14:35 ` Danilo Krummrich
2026-05-30 14:51 ` Markus Probst
2026-05-30 16:14 ` Danilo Krummrich
2026-05-30 16:23 ` Markus Probst
2026-05-30 16:27 ` Danilo Krummrich
2026-05-30 16:30 ` Markus Probst [this message]
2026-05-30 18:55 ` Markus Probst
2026-05-30 19:45 ` Danilo Krummrich
2026-05-30 20:31 ` Markus Probst
2026-05-30 20:59 ` Danilo Krummrich
2026-06-04 5:57 ` Claude review: " Claude Code Review Bot
2026-05-30 1:13 ` [PATCH v8 4/5] samples: rust: add Rust serial device bus sample device driver Markus Probst via B4 Relay
2026-06-04 5:57 ` Claude review: " Claude Code Review Bot
2026-05-30 1:13 ` [PATCH v8 5/5] MAINTAINERS: serdev: Add self for serdev Markus Probst via B4 Relay
2026-06-04 5:57 ` Claude review: " Claude Code Review Bot
2026-06-04 5:57 ` Claude review: rust: add basic serial device bus abstractions Claude Code Review Bot
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=be835bce958c99e9623ea240b67282d3b429ae9f.camel@posteo.de \
--to=markus.probst@posteo.de \
--cc=a.hindborg@kernel.org \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=devnull+markus.probst.posteo.de@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kari.argillander@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
--cc=viresh.kumar@linaro.org \
/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