[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250314-manipulative-important-mackerel-7a25ba@houat>
Date: Fri, 14 Mar 2025 12:48:58 +0100
From: Maxime Ripard <mripard@...nel.org>
To: Lyude Paul <lyude@...hat.com>
Cc: dri-devel@...ts.freedesktop.org, rust-for-linux@...r.kernel.org,
Danilo Krummrich <dakr@...nel.org>, mcanal@...lia.com, Alice Ryhl <aliceryhl@...gle.com>,
Simona Vetter <sima@...ll.ch>, Daniel Almeida <daniel.almeida@...labora.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>, Trevor Gross <tmgross@...ch.edu>,
Asahi Lina <lina@...hilina.net>, Wedson Almeida Filho <wedsonaf@...il.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC v3 07/33] rust: drm/kms: Add drm_encoder bindings
On Wed, Mar 05, 2025 at 05:59:23PM -0500, Lyude Paul wrote:
> +unsafe extern "C" fn encoder_destroy_callback<T: DriverEncoder>(
> + encoder: *mut bindings::drm_encoder,
> +) {
> + // SAFETY: DRM guarantees that `encoder` points to a valid initialized `drm_encoder`.
> + unsafe { bindings::drm_encoder_cleanup(encoder) };
> +
> + // SAFETY:
> + // - DRM guarantees we are now the only one with access to this [`drm_encoder`].
> + // - This cast is safe via `DriverEncoder`s type invariants.
> + unsafe { drop(KBox::from_raw(encoder as *mut Encoder<T>)) };
> +}
I'm not sure we should expose drm_encoder_cleanup() there, if only
because it's not really up to the driver to deal with it anymore. We're
switching to drmm_encoder_alloc/init where having a destroy hook is
explicitly rejected.
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)
Powered by blists - more mailing lists