linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] rust: init: remove old workaround
@ 2025-07-09 22:49 Tamir Duberstein
  2025-07-09 22:49 ` [PATCH v2 1/2] rust: init: compile examples Tamir Duberstein
  2025-07-09 22:49 ` [PATCH v2 2/2] rust: init: remove old workaround Tamir Duberstein
  0 siblings, 2 replies; 8+ messages in thread
From: Tamir Duberstein @ 2025-07-09 22:49 UTC (permalink / raw)
  To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich
  Cc: rust-for-linux, linux-kernel, Tamir Duberstein

The first patch just enables compilation for these doctests, since I
accidentally broke them in v1 of the second patch.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
Changes in v2:
- Add a commit to compile the doctests.
- Remove a bit more.
- Link to v1: https://lore.kernel.org/r/20250709-init-remove-old-workaround-v1-1-a922d32338d2@gmail.com

---
Tamir Duberstein (2):
      rust: init: compile examples
      rust: init: remove old workaround

 rust/kernel/init.rs | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
---
base-commit: 2009a2d5696944d85c34d75e691a6f3884e787c0
change-id: 20250709-init-remove-old-workaround-a6ec6792e010

Best regards,
--  
Tamir Duberstein <tamird@gmail.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] rust: init: compile examples
  2025-07-09 22:49 [PATCH v2 0/2] rust: init: remove old workaround Tamir Duberstein
@ 2025-07-09 22:49 ` Tamir Duberstein
  2025-07-10  7:56   ` Benno Lossin
  2025-07-13 20:32   ` Miguel Ojeda
  2025-07-09 22:49 ` [PATCH v2 2/2] rust: init: remove old workaround Tamir Duberstein
  1 sibling, 2 replies; 8+ messages in thread
From: Tamir Duberstein @ 2025-07-09 22:49 UTC (permalink / raw)
  To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich
  Cc: rust-for-linux, linux-kernel, Tamir Duberstein

It's not exactly clear to me why these were `ignore`d. There are many
others like this in pin-init, but I'm only touching the kernel-specific
ones here.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 rust/kernel/init.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index 8d228c237954..f8402c818d30 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -29,15 +29,16 @@
 //!
 //! ## General Examples
 //!
-//! ```rust,ignore
+//! ```rust
 //! # #![allow(clippy::disallowed_names)]
+//! # #![allow(clippy::undocumented_unsafe_blocks)]
 //! use kernel::types::Opaque;
 //! use pin_init::pin_init_from_closure;
 //!
 //! // assume we have some `raw_foo` type in C:
 //! #[repr(C)]
 //! struct RawFoo([u8; 16]);
-//! extern {
+//! extern "C" {
 //!     fn init_foo(_: *mut RawFoo);
 //! }
 //!
@@ -66,12 +67,13 @@
 //! });
 //! ```
 //!
-//! ```rust,ignore
+//! ```rust
 //! # #![allow(unreachable_pub, clippy::disallowed_names)]
 //! use kernel::{prelude::*, types::Opaque};
 //! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
 //! # mod bindings {
 //! #     #![allow(non_camel_case_types)]
+//! #     #![allow(clippy::missing_safety_doc)]
 //! #     pub struct foo;
 //! #     pub unsafe fn init_foo(_ptr: *mut foo) {}
 //! #     pub unsafe fn destroy_foo(_ptr: *mut foo) {}

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] rust: init: remove old workaround
  2025-07-09 22:49 [PATCH v2 0/2] rust: init: remove old workaround Tamir Duberstein
  2025-07-09 22:49 ` [PATCH v2 1/2] rust: init: compile examples Tamir Duberstein
@ 2025-07-09 22:49 ` Tamir Duberstein
  2025-07-13 20:33   ` Miguel Ojeda
  1 sibling, 1 reply; 8+ messages in thread
From: Tamir Duberstein @ 2025-07-09 22:49 UTC (permalink / raw)
  To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich
  Cc: rust-for-linux, linux-kernel, Tamir Duberstein

`Error::from_errno` is `pub` since commit 5ed147473458 ("rust: error:
make conversion functions public"), thus remove this workaround which is
no longer needed.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 rust/kernel/init.rs | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index f8402c818d30..9b3f3e29cc6a 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -79,14 +79,6 @@
 //! #     pub unsafe fn destroy_foo(_ptr: *mut foo) {}
 //! #     pub unsafe fn enable_foo(_ptr: *mut foo, _flags: u32) -> i32 { 0 }
 //! # }
-//! # // `Error::from_errno` is `pub(crate)` in the `kernel` crate, thus provide a workaround.
-//! # trait FromErrno {
-//! #     fn from_errno(errno: core::ffi::c_int) -> Error {
-//! #         // Dummy error that can be constructed outside the `kernel` crate.
-//! #         Error::from(core::fmt::Error)
-//! #     }
-//! # }
-//! # impl FromErrno for Error {}
 //! /// # Invariants
 //! ///
 //! /// `foo` is always initialized

-- 
2.50.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] rust: init: compile examples
  2025-07-09 22:49 ` [PATCH v2 1/2] rust: init: compile examples Tamir Duberstein
@ 2025-07-10  7:56   ` Benno Lossin
  2025-07-13 20:32   ` Miguel Ojeda
  1 sibling, 0 replies; 8+ messages in thread
From: Benno Lossin @ 2025-07-10  7:56 UTC (permalink / raw)
  To: Tamir Duberstein, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich
  Cc: rust-for-linux, linux-kernel

On Thu Jul 10, 2025 at 12:49 AM CEST, Tamir Duberstein wrote:
> It's not exactly clear to me why these were `ignore`d. There are many
> others like this in pin-init, but I'm only touching the kernel-specific
> ones here.

Most likely a remnant from 206dea39e559 ("rust: init: disable doctests")
that wasn't cleaned up... Thanks!

---
Cheers,
Benno

> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
>  rust/kernel/init.rs | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] rust: init: compile examples
  2025-07-09 22:49 ` [PATCH v2 1/2] rust: init: compile examples Tamir Duberstein
  2025-07-10  7:56   ` Benno Lossin
@ 2025-07-13 20:32   ` Miguel Ojeda
  2025-07-14 12:24     ` Tamir Duberstein
  1 sibling, 1 reply; 8+ messages in thread
From: Miguel Ojeda @ 2025-07-13 20:32 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, linux-kernel

On Thu, Jul 10, 2025 at 12:49 AM Tamir Duberstein <tamird@gmail.com> wrote:
>
> It's not exactly clear to me why these were `ignore`d. There are many
> others like this in pin-init, but I'm only touching the kernel-specific
> ones here.
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

This seems essentially equivalent to this one applied a few weeks ago:

    https://lore.kernel.org/rust-for-linux/20250526152914.2453949-1-ojeda@kernel.org/

But that one uses `expect` to, which is a bit better for the future.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] rust: init: remove old workaround
  2025-07-09 22:49 ` [PATCH v2 2/2] rust: init: remove old workaround Tamir Duberstein
@ 2025-07-13 20:33   ` Miguel Ojeda
  2025-07-13 23:04     ` Benno Lossin
  0 siblings, 1 reply; 8+ messages in thread
From: Miguel Ojeda @ 2025-07-13 20:33 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, linux-kernel

On Thu, Jul 10, 2025 at 12:49 AM Tamir Duberstein <tamird@gmail.com> wrote:
>
> `Error::from_errno` is `pub` since commit 5ed147473458 ("rust: error:
> make conversion functions public"), thus remove this workaround which is
> no longer needed.
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

This seems the same as this one applied a few weeks ago:

    https://lore.kernel.org/rust-for-linux/20250526152914.2453949-2-ojeda@kernel.org/

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] rust: init: remove old workaround
  2025-07-13 20:33   ` Miguel Ojeda
@ 2025-07-13 23:04     ` Benno Lossin
  0 siblings, 0 replies; 8+ messages in thread
From: Benno Lossin @ 2025-07-13 23:04 UTC (permalink / raw)
  To: Miguel Ojeda, Tamir Duberstein
  Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, linux-kernel

On Sun Jul 13, 2025 at 10:33 PM CEST, Miguel Ojeda wrote:
> On Thu, Jul 10, 2025 at 12:49 AM Tamir Duberstein <tamird@gmail.com> wrote:
>>
>> `Error::from_errno` is `pub` since commit 5ed147473458 ("rust: error:
>> make conversion functions public"), thus remove this workaround which is
>> no longer needed.
>>
>> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
>
> This seems the same as this one applied a few weeks ago:
>
>     https://lore.kernel.org/rust-for-linux/20250526152914.2453949-2-ojeda@kernel.org/

Oh yeah you're right, thanks for the heads-up! (seems like I forgot the
patches after applying them so early in the cycle :)

---
Cheers,
Benno

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] rust: init: compile examples
  2025-07-13 20:32   ` Miguel Ojeda
@ 2025-07-14 12:24     ` Tamir Duberstein
  0 siblings, 0 replies; 8+ messages in thread
From: Tamir Duberstein @ 2025-07-14 12:24 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, rust-for-linux, linux-kernel

On Sun, Jul 13, 2025 at 4:33 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Thu, Jul 10, 2025 at 12:49 AM Tamir Duberstein <tamird@gmail.com> wrote:
> >
> > It's not exactly clear to me why these were `ignore`d. There are many
> > others like this in pin-init, but I'm only touching the kernel-specific
> > ones here.
> >
> > Signed-off-by: Tamir Duberstein <tamird@gmail.com>
>
> This seems essentially equivalent to this one applied a few weeks ago:
>
>     https://lore.kernel.org/rust-for-linux/20250526152914.2453949-1-ojeda@kernel.org/
>
> But that one uses `expect` to, which is a bit better for the future.

Yep, thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-07-14 12:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09 22:49 [PATCH v2 0/2] rust: init: remove old workaround Tamir Duberstein
2025-07-09 22:49 ` [PATCH v2 1/2] rust: init: compile examples Tamir Duberstein
2025-07-10  7:56   ` Benno Lossin
2025-07-13 20:32   ` Miguel Ojeda
2025-07-14 12:24     ` Tamir Duberstein
2025-07-09 22:49 ` [PATCH v2 2/2] rust: init: remove old workaround Tamir Duberstein
2025-07-13 20:33   ` Miguel Ojeda
2025-07-13 23:04     ` Benno Lossin

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).