public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Markus Probst" <markus.probst@posteo.de>
Cc: "Kari Argillander" <kari.argillander@gmail.com>,
	"Rob Herring" <robh@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"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>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH RFC 2/4] rust: add basic serial device bus abstractions
Date: Tue, 13 Jan 2026 20:10:37 +0100	[thread overview]
Message-ID: <DFNP6FEZ0S1O.1MQGAXEGX1P7@kernel.org> (raw)
In-Reply-To: <dcab1e61e451aeba27575c8245aef687caf94b23.camel@posteo.de>

On Tue Jan 13, 2026 at 6:59 PM CET, Markus Probst wrote:
> This is gated behind "if T::HAS_RECEIVE_INITIAL". And in probe its
> gated behind "if T::HAS_RECEIVE_INITIAL".

I guess you mean `if !T::HAS_RECEIVE_INITIAL` in probe().

Anyways, I now get what you are trying to do. (I got confused by late_probe(),
which I think is a misleading name for what it actually is and in which context
it might run in. I think a better name would be initial_xfer() or something
along those lines.)

So, what you really want is additional private data that is valid between some
inital xfer happening at some point of time after probe() and unbind(), and
hence is valid to access in all subsequent transfers callbacks.

There are three options:

  (1) What you already implement, but with less callbacks.

      I think the only additional callback you need is initial_xfer(), where you
      return the init private data.

      For storing this data you probably want to add void *init_data to
      struct serdev_device.

  (2) A synchronous inital transfer in probe() as proposed by Kari.

      This is much simpler than (1), but still leaves the driver without an
      Option for the init data in its device private data.

  (3) Leave it to the driver.

      The driver can store an Option in its device private data, which is
      initialized in the first callback.

> Which one do you think should be used for the abstraction?

I don't know, it depends on the requirements of serdev drivers.

But since you already mentioned that there is only a single driver that needs
this initial xfer data, I'd say don't consider it in the abstraction at all
until we are sure it is a common pattern needed by drivers. We can always add it
later on if needed.

  reply	other threads:[~2026-01-13 19:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-20 18:44 [PATCH RFC 0/4] rust: add basic serial device bus abstractions Markus Probst
2025-12-20 18:44 ` [PATCH RFC 1/4] serdev: Export internal is_serdev_device() for drivers Markus Probst
2025-12-21 16:10   ` Greg Kroah-Hartman
2025-12-21 16:28     ` Markus Probst
2025-12-21 16:46       ` Greg Kroah-Hartman
2025-12-21 17:36       ` Danilo Krummrich
2025-12-21 17:40   ` Danilo Krummrich
2025-12-20 18:44 ` [PATCH RFC 2/4] rust: add basic serial device bus abstractions Markus Probst
2025-12-21  9:19   ` Dirk Behme
2025-12-21 12:41     ` Markus Probst
2025-12-25 15:13   ` Kari Argillander
2026-01-13 16:15     ` Markus Probst
2026-01-13 17:37       ` Danilo Krummrich
2026-01-13 17:59         ` Markus Probst
2026-01-13 19:10           ` Danilo Krummrich [this message]
2026-02-08 14:30         ` Markus Probst
2025-12-26 15:09   ` Kari Argillander
2025-12-20 18:44 ` [PATCH RFC 3/4] samples: rust: add Rust serial device bus sample device driver Markus Probst
2025-12-21  9:11   ` Dirk Behme
2025-12-21 12:39     ` Markus Probst
2025-12-20 18:44 ` [PATCH RFC 4/4] rust: Add serdev rust abstractions to MAINTAINERS file Markus Probst

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=DFNP6FEZ0S1O.1MQGAXEGX1P7@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --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-serial@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=markus.probst@posteo.de \
    --cc=ojeda@kernel.org \
    --cc=robh@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