* [PATCH linux] of: resolves TODO for copy_from_slice
@ 2025-08-10 23:23 ~_xllx_
2025-08-11 7:13 ` Greg KH
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: ~_xllx_ @ 2025-08-10 23:23 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Rob Herring, Saravana Kannan
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, devicetree
From: elle <elle@weathered-steel.dev>
Replaces the copy loop with `copy_from_slice` which became `const` in
stable Rust with version `1.87.0`.
Authored-by: elle <elle@weathered-steel.dev>
Signed-off-by: elle <elle@weathered-steel.dev>
---
rust/kernel/of.rs | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/rust/kernel/of.rs b/rust/kernel/of.rs
index b76b35265df2..6a5d27b741c6 100644
--- a/rust/kernel/of.rs
+++ b/rust/kernel/of.rs
@@ -39,12 +39,7 @@ impl DeviceId {
// SAFETY: FFI type is valid to be zero-initialized.
let mut of: bindings::of_device_id = unsafe { core::mem::zeroed() };
- // TODO: Use `copy_from_slice` once stabilized for `const`.
- let mut i = 0;
- while i < src.len() {
- of.compatible[i] = src[i];
- i += 1;
- }
+ of.compatible.copy_from_slice(src);
Self(of)
}
--
2.49.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH linux] of: resolves TODO for copy_from_slice
2025-08-10 23:23 [PATCH linux] of: resolves TODO for copy_from_slice ~_xllx_
@ 2025-08-11 7:13 ` Greg KH
2025-08-11 8:52 ` Elle
2025-08-11 8:02 ` Alice Ryhl
2025-08-12 9:55 ` kernel test robot
2 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2025-08-11 7:13 UTC (permalink / raw)
To: ~_xllx_
Cc: Miguel Ojeda, Alex Gaynor, Rob Herring, Saravana Kannan,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, devicetree
On Sun, Aug 10, 2025 at 11:23:55PM +0000, ~_xllx_ wrote:
> From: elle <elle@weathered-steel.dev>
>
> Replaces the copy loop with `copy_from_slice` which became `const` in
> stable Rust with version `1.87.0`.
>
> Authored-by: elle <elle@weathered-steel.dev>
This isn't a normal kernel tag, the "From:" line guarantes this, please
no need to repeat it again.
Also, we need a full name please, as per our documentation.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH linux] of: resolves TODO for copy_from_slice
2025-08-10 23:23 [PATCH linux] of: resolves TODO for copy_from_slice ~_xllx_
2025-08-11 7:13 ` Greg KH
@ 2025-08-11 8:02 ` Alice Ryhl
2025-08-11 8:51 ` Elle
2025-08-12 9:55 ` kernel test robot
2 siblings, 1 reply; 7+ messages in thread
From: Alice Ryhl @ 2025-08-11 8:02 UTC (permalink / raw)
To: ~_xllx_
Cc: Miguel Ojeda, Alex Gaynor, Rob Herring, Saravana Kannan,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Trevor Gross, Danilo Krummrich, rust-for-linux,
devicetree
On Mon, Aug 11, 2025 at 8:38 AM ~_xllx_ <_xllx_@git.sr.ht> wrote:
>
> From: elle <elle@weathered-steel.dev>
>
> Replaces the copy loop with `copy_from_slice` which became `const` in
> stable Rust with version `1.87.0`.
>
> Authored-by: elle <elle@weathered-steel.dev>
> Signed-off-by: elle <elle@weathered-steel.dev>
We still support rustc 1.78 and forward.
Alice
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH linux] of: resolves TODO for copy_from_slice
2025-08-11 8:02 ` Alice Ryhl
@ 2025-08-11 8:51 ` Elle
2025-08-11 10:41 ` Miguel Ojeda
0 siblings, 1 reply; 7+ messages in thread
From: Elle @ 2025-08-11 8:51 UTC (permalink / raw)
To: Alice Ryhl
Cc: Miguel Ojeda, Alex Gaynor, Rob Herring, Saravana Kannan,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Trevor Gross, Danilo Krummrich, rust-for-linux,
devicetree
I tried to find the MSRV before sending the patch, sorry for the noise.
Since this is a pretty low-priority patch, guess it can just hang out until the MSRV bump to 1.87.x?
On Monday, August 11th, 2025 at 8:02 AM, Alice Ryhl <aliceryhl@google.com> wrote:
>
>
> On Mon, Aug 11, 2025 at 8:38 AM ~xllx _xllx_@git.sr.ht wrote:
>
> > From: elle elle@weathered-steel.dev
> >
> > Replaces the copy loop with `copy_from_slice` which became `const` in
> > stable Rust with version `1.87.0`.
> >
> > Authored-by: elle elle@weathered-steel.dev
> > Signed-off-by: elle elle@weathered-steel.dev
>
>
> We still support rustc 1.78 and forward.
>
> Alice
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH linux] of: resolves TODO for copy_from_slice
2025-08-11 7:13 ` Greg KH
@ 2025-08-11 8:52 ` Elle
0 siblings, 0 replies; 7+ messages in thread
From: Elle @ 2025-08-11 8:52 UTC (permalink / raw)
To: Greg KH
Cc: Miguel Ojeda, Alex Gaynor, Rob Herring, Saravana Kannan,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, devicetree
I'll clean this up in future patches, thanks for letting me know.
On Monday, August 11th, 2025 at 7:13 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
>
>
> On Sun, Aug 10, 2025 at 11:23:55PM +0000, ~xllx wrote:
>
> > From: elle elle@weathered-steel.dev
> >
> > Replaces the copy loop with `copy_from_slice` which became `const` in
> > stable Rust with version `1.87.0`.
> >
> > Authored-by: elle elle@weathered-steel.dev
>
>
> This isn't a normal kernel tag, the "From:" line guarantes this, please
> no need to repeat it again.
>
> Also, we need a full name please, as per our documentation.
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH linux] of: resolves TODO for copy_from_slice
2025-08-11 8:51 ` Elle
@ 2025-08-11 10:41 ` Miguel Ojeda
0 siblings, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2025-08-11 10:41 UTC (permalink / raw)
To: Elle
Cc: Alice Ryhl, Miguel Ojeda, Alex Gaynor, Rob Herring,
Saravana Kannan, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, Danilo Krummrich,
rust-for-linux, devicetree
On Mon, Aug 11, 2025 at 10:52 AM Elle <elle@weathered-steel.dev> wrote:
>
> I tried to find the MSRV before sending the patch, sorry for the noise.
>
> Since this is a pretty low-priority patch, guess it can just hang out until the MSRV bump to 1.87.x?
Yes, but that will likely take more than a year, so we will forget
about it, or the code may change anyway.
The other option is using the unstable feature, if it is really useful
etc., but for that we also need to wait until 1.85.0, since that is
where `const_copy_from_slice` was available. Luckily, 1.85.0 is
possibly our next minimum, due to Debian Trixie.
Thanks!
(By the way, please try to avoid top-posting on the mailing list:
https://docs.kernel.org/process/submitting-patches.html#use-trimmed-interleaved-replies-in-email-discussions
:)
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH linux] of: resolves TODO for copy_from_slice
2025-08-10 23:23 [PATCH linux] of: resolves TODO for copy_from_slice ~_xllx_
2025-08-11 7:13 ` Greg KH
2025-08-11 8:02 ` Alice Ryhl
@ 2025-08-12 9:55 ` kernel test robot
2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2025-08-12 9:55 UTC (permalink / raw)
To: ~_xllx_, Miguel Ojeda, Alex Gaynor, Rob Herring, Saravana Kannan
Cc: llvm, oe-kbuild-all, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, rust-for-linux, devicetree
Hi ~_xllx_,
kernel test robot noticed the following build errors:
[auto build test ERROR on linux/master]
url: https://github.com/intel-lab-lkp/linux/commits/_xllx_/of-resolves-TODO-for-copy_from_slice/20250811-144924
base: linux/master
patch link: https://lore.kernel.org/r/175489428990.9320.6825335165759789458-0%40git.sr.ht
patch subject: [PATCH linux] of: resolves TODO for copy_from_slice
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250812/202508121650.l7ZSniGd-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250812/202508121650.l7ZSniGd-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508121650.l7ZSniGd-lkp@intel.com/
All errors (new ones prefixed by >>):
>> error[E0080]: evaluation of constant value failed
--> rust/doctests_kernel_generated.rs:6978:11
|
6978 | (of::DeviceId::new(c_str!("test,device")), ())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: copy_from_slice: source slice length does not match destination slice length
|
note: inside `rust_doctest_kernel_alloc_kbox_rs_7::kernel::of::DeviceId::new`
--> rust/kernel/of.rs:42:9
|
42 | of.compatible.copy_from_slice(src);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here
--
>> error[E0080]: evaluation of constant value failed
--> samples/rust/rust_driver_platform.rs:88:7
|
88 | [(of::DeviceId::new(c_str!("test,rust-device")), Info(42))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: copy_from_slice: source slice length does not match destination slice length
|
note: inside `kernel::of::DeviceId::new`
--> rust/kernel/of.rs:42:9
|
42 | of.compatible.copy_from_slice(src);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the failure occurred here
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-08-12 9:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-10 23:23 [PATCH linux] of: resolves TODO for copy_from_slice ~_xllx_
2025-08-11 7:13 ` Greg KH
2025-08-11 8:52 ` Elle
2025-08-11 8:02 ` Alice Ryhl
2025-08-11 8:51 ` Elle
2025-08-11 10:41 ` Miguel Ojeda
2025-08-12 9:55 ` kernel test robot
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).