| 211dcf77 | 02-May-2025 |
Miguel Ojeda <[email protected]> |
rust: clean Rust 1.88.0's `clippy::uninlined_format_args` lint
Starting with Rust 1.88.0 (expected 2025-06-26) [1], `rustc` may move back the `uninlined_format_args` to `style` from `pedantic` (it w
rust: clean Rust 1.88.0's `clippy::uninlined_format_args` lint
Starting with Rust 1.88.0 (expected 2025-06-26) [1], `rustc` may move back the `uninlined_format_args` to `style` from `pedantic` (it was there waiting for rust-analyzer suppotr), and thus we will start to see lints like:
warning: variables can be used directly in the `format!` string --> rust/macros/kunit.rs:105:37 | 105 | let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{}", test); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 105 - let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{}", test); 105 + let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{test}");
There is even a case that is a pure removal:
warning: variables can be used directly in the `format!` string --> rust/macros/module.rs:51:13 | 51 | format!("{field}={content}\0", field = field, content = content) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 51 - format!("{field}={content}\0", field = field, content = content) 51 + format!("{field}={content}\0")
The lints all seem like nice cleanups, thus just apply them.
We may want to disable `allow-mixed-uninlined-format-args` in the future.
Cc: [email protected] # Needed in 6.12.y and later (Rust is pinned in older LTSs). Link: https://github.com/rust-lang/rust-clippy/pull/14160 [1] Acked-by: Benno Lossin <[email protected]> Reviewed-by: Tamir Duberstein <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 28bb48c4 | 24-Mar-2025 |
Danilo Krummrich <[email protected]> |
rust: dma: add `Send` implementation for `CoherentAllocation`
Stephen found a future build failure in linux-next [1]:
error[E0277]: `*mut MyStruct` cannot be sent between threads safely -
rust: dma: add `Send` implementation for `CoherentAllocation`
Stephen found a future build failure in linux-next [1]:
error[E0277]: `*mut MyStruct` cannot be sent between threads safely --> samples/rust/rust_dma.rs:47:22 | 47 | impl pci::Driver for DmaSampleDriver { | ^^^^^^^^^^^^^^^ `*mut MyStruct` cannot be sent between threads safely
It is caused by the interaction between commit 935e1d90bf6f ("rust: pci: require Send for Driver trait implementers") from the driver-core tree, which fixes a missing concurrency requirement, and commit 9901addae63b ("samples: rust: add Rust dma test sample driver") which adds a sample that does not satisfy that requirement.
Add a `Send` implementation to `CoherentAllocation`, which allows the sample (and other future users) to satisfy it.
Reported-by: Stephen Rothwell <[email protected]> Closes: https://lore.kernel.org/linux-next/[email protected]/ [1] Signed-off-by: Danilo Krummrich <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Added number to Closes. Fix typo spotted by Boqun. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 2a571248 | 20-Mar-2025 |
Antonio Hickey <[email protected]> |
rust: block: refactor to use `&raw mut`
Replace all occurrences (one) of `addr_of_mut!(place)` with `&raw mut place`.
This will allow us to reduce macro complexity, and improve consistency with exi
rust: block: refactor to use `&raw mut`
Replace all occurrences (one) of `addr_of_mut!(place)` with `&raw mut place`.
This will allow us to reduce macro complexity, and improve consistency with existing reference syntax as `&raw mut` is similar to `&mut` making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <[email protected]> Link: https://github.com/Rust-for-Linux/linux/issues/1148 Signed-off-by: Antonio Hickey <[email protected]> Acked-by: Andreas Hindborg <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Reworded slightly. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| e1dfaa33 | 20-Mar-2025 |
Antonio Hickey <[email protected]> |
rust: enable `raw_ref_op` feature
Since Rust 1.82.0 the `raw_ref_op` feature is stable [1].
By enabling this feature we can use `&raw const place` and `&raw mut place` instead of using `addr_of!(pl
rust: enable `raw_ref_op` feature
Since Rust 1.82.0 the `raw_ref_op` feature is stable [1].
By enabling this feature we can use `&raw const place` and `&raw mut place` instead of using `addr_of!(place)` and `addr_of_mut!(place)` macros.
Allowing us to reduce macro complexity, and improve consistency with existing reference syntax as `&raw const`, `&raw mut` are similar to `&`, `&mut` making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <[email protected]> Link: https://github.com/Rust-for-Linux/linux/issues/1148 Link: https://blog.rust-lang.org/2024/10/17/Rust-1.82.0.html#native-syntax-for-creating-a-raw-pointer [1] Signed-off-by: Antonio Hickey <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Tamir Duberstein <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Removed dashed line change as discussed. Added Link to the explanation of the feature in the Rust 1.82.0 release blog post. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| f6be7af4 | 15-Mar-2025 |
Charalampos Mitrodimas <[email protected]> |
rust: rbtree: fix comments referring to Box instead of KBox
Several safety comments in the RBTree implementation still refer to "Box::from_raw" and "Box::into_raw", but the code actually uses KBox.
rust: rbtree: fix comments referring to Box instead of KBox
Several safety comments in the RBTree implementation still refer to "Box::from_raw" and "Box::into_raw", but the code actually uses KBox. These comments were not updated when the implementation transitioned from using Box to KBox.
Fixes: 8373147ce496 ("rust: treewide: switch to our kernel `Box` type") Signed-off-by: Charalampos Mitrodimas <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| ad2907b4 | 17-Mar-2025 |
Abdiel Janulgue <[email protected]> |
rust: add dma coherent allocator abstraction
Add a simple dma coherent allocator rust abstraction. Based on Andreas Hindborg's dma abstractions from the rnvme driver, which was also based on earlier
rust: add dma coherent allocator abstraction
Add a simple dma coherent allocator rust abstraction. Based on Andreas Hindborg's dma abstractions from the rnvme driver, which was also based on earlier work by Wedson Almeida Filho.
Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: Abdiel Janulgue <[email protected]> Acked-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Nacked-by: Christoph Hellwig <[email protected]> [ Removed period. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
show more ...
|
| 51d0de75 | 19-Mar-2025 |
Danilo Krummrich <[email protected]> |
rust: platform: require Send for Driver trait implementers
The instance of Self, returned and created by Driver::probe() is dropped in the bus' remove() callback.
Request implementers of the Driver
rust: platform: require Send for Driver trait implementers
The instance of Self, returned and created by Driver::probe() is dropped in the bus' remove() callback.
Request implementers of the Driver trait to implement Send, since the remove() callback is not guaranteed to run from the same thread as probe().
Fixes: 683a63befc73 ("rust: platform: add basic platform device / driver abstractions") Cc: stable <[email protected]> Reported-by: Alice Ryhl <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Danilo Krummrich <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| 935e1d90 | 19-Mar-2025 |
Danilo Krummrich <[email protected]> |
rust: pci: require Send for Driver trait implementers
The instance of Self, returned and created by Driver::probe() is dropped in the bus' remove() callback.
Request implementers of the Driver trai
rust: pci: require Send for Driver trait implementers
The instance of Self, returned and created by Driver::probe() is dropped in the bus' remove() callback.
Request implementers of the Driver trait to implement Send, since the remove() callback is not guaranteed to run from the same thread as probe().
Fixes: 1bd8b6b2c5d3 ("rust: pci: add basic PCI device / driver abstractions") Cc: stable <[email protected]> Reported-by: Alice Ryhl <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Danilo Krummrich <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|