rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@kernel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Shankari Anand <shankari.ak0208@gmail.com>,
	rust-for-linux@vger.kernel.org, alex.gaynor@gmail.com,
	boqun.feng@gmail.com, gary@garyguo.net, a.hindborg@kernel.org,
	bjorn3_gh@protonmail.com, Benno Lossin <lossin@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alice Ryhl <aliceryhl@google.com>
Subject: Re: [PATCH] rust: miscdevice: clarify invariant for `MiscDeviceRegistration`
Date: Sun, 22 Jun 2025 22:32:12 +0200	[thread overview]
Message-ID: <b332e91c-7457-45f7-8402-3c5604f22ae4@kernel.org> (raw)
In-Reply-To: <CANiq72mWQPbUQKqCve+FF63aayeMEPgYVSezLjgGft+1weMh-g@mail.gmail.com>

On Sun, Jun 22, 2025 at 10:26:49PM +0200, Miguel Ojeda wrote:
> On Sun, Jun 22, 2025 at 1:07 PM Shankari Anand
> <shankari.ak0208@gmail.com> wrote:
> >
> > Reword and expand the invariant documentation for `MiscDeviceRegistration`
> > to clarify what it means for the inner device to be "registered".
> > It expands to explain:
> > - `inner` points to a `miscdevice` registered via `misc_register`.
> > - This registration stays valid for the entire lifetime of the object.
> > - Deregistration is guaranteed on `Drop`, via `misc_deregister`.
> >
> > Reported-by: Benno Lossin <lossin@kernel.org>
> > Closes: https://github.com/Rust-for-Linux/linux/issues/1168
> > Fixes: f893691e7426 ("rust: miscdevice: add base miscdevice abstraction")
> > Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
> 
> Cc'ing Danilo and Greg.

Thanks -- also Cc'ing Alice.

> > +/// The `inner` field contains a `struct miscdevice` that has been registered with
> > +/// the kernel using `misc_register()`.
> > +/// This registration remains valid for the entire lifetime of the `MiscDeviceRegistration`
> > +/// instance.
> > +/// Deregistration is guaranteed to occur exactly once, during the [`Drop`] implementation, via
> > +/// a call to `misc_deregister()`.
> > +/// The `inner` pointer is never null and always points to a valid, pinned `miscdevice` instance
> > +/// initialized via `MiscDeviceOptions::into_raw`.
> 
> These should be bullet points -- like this it will be rendered like a
> single long paragraph (but please wait for other feedback before
> fixing that).
> 
> The last one seems wrong -- `inner` is not a pointer. It should also
> probably be simplified/merged with the first one.
> 
> Also, please use intra-doc links wherever possible, e.g.
> [`MiscDeviceRegistration`] and for `into_raw` too.
> 
> Thanks for the patch!
> 
> Cheers,
> Miguel

      reply	other threads:[~2025-06-22 20:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-22 11:06 [PATCH] rust: miscdevice: clarify invariant for `MiscDeviceRegistration` Shankari Anand
2025-06-22 20:26 ` Miguel Ojeda
2025-06-22 20:32   ` Danilo Krummrich [this message]

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=b332e91c-7457-45f7-8402-3c5604f22ae4@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=shankari.ak0208@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).