[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87jz9ao500.fsf@kernel.org>
Date: Fri, 28 Feb 2025 09:19:59 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Alice Ryhl" <aliceryhl@...gle.com>
Cc: "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>, "Miguel Ojeda"
<ojeda@...nel.org>, "Petr Mladek" <pmladek@...e.com>, "Steven Rostedt"
<rostedt@...dmis.org>, "Andy Shevchenko"
<andriy.shevchenko@...ux.intel.com>, "Rasmus Villemoes"
<linux@...musvillemoes.dk>, "Sergey Senozhatsky"
<senozhatsky@...omium.org>, "Andrew Morton" <akpm@...ux-foundation.org>,
"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>, "Trevor Gross" <tmgross@...ch.edu>, "Maarten
Lankhorst" <maarten.lankhorst@...ux.intel.com>, "Maxime Ripard"
<mripard@...nel.org>, "Thomas Zimmermann" <tzimmermann@...e.de>, "David
Airlie" <airlied@...il.com>, "Simona Vetter" <simona@...ll.ch>,
<linux-kernel@...r.kernel.org>, <rust-for-linux@...r.kernel.org>,
<dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH 4/4] panic_qr: use new #[export] macro
"Alice Ryhl" <aliceryhl@...gle.com> writes:
> This validates at compile time that the signatures match what is in the
> header file. It highlights one annoyance with the compile-time check,
> which is that it can only be used with functions marked unsafe.
It would indeed be nice if there was a way to mark some functions to be
emitted as safe by bindgen.
>
> If the function is not unsafe, then this error is emitted:
>
> error[E0308]: `if` and `else` have incompatible types
> --> <linux>/drivers/gpu/drm/drm_panic_qr.rs:987:19
> |
> 986 | #[export]
> | --------- expected because of this
> 987 | pub extern "C" fn drm_panic_qr_max_data_size(version: u8, url_len: usize) -> usize {
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected unsafe fn, found safe fn
> |
> = note: expected fn item `unsafe extern "C" fn(_, _) -> _ {kernel::bindings::drm_panic_qr_max_data_size}`
> found fn item `extern "C" fn(_, _) -> _ {drm_panic_qr_max_data_size}`
>
> Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
Reviewed-by: Andreas Hindborg <a.hindborg@...nel.org>
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists