From: "Gary Guo" <gary@garyguo.net>
To: "Danilo Krummrich" <dakr@kernel.org>, "Gary Guo" <gary@garyguo.net>
Cc: <acourbot@nvidia.com>, <aliceryhl@google.com>,
<nova-gpu@lists.linux.dev>, <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] gpu: nova-core: use a single try_pin_init!() block in probe()
Date: Mon, 28 Sep 2026 14:53:37 +0100 [thread overview]
Message-ID: <DLR009WMVVQ5.26C5V2E6GFD40@garyguo.net> (raw)
In-Reply-To: <DLQXWXRP3P1J.28SLFOJJQ2EDK@kernel.org>
On Mon Sep 28, 2026 at 1:15 PM BST, Danilo Krummrich wrote:
> On Mon Sep 28, 2026 at 2:10 PM CEST, Gary Guo wrote:
>> On Mon Sep 28, 2026 at 1:00 PM BST, Danilo Krummrich wrote:
>>> On Mon Sep 28, 2026 at 1:36 PM CEST, Gary Guo wrote:
>>>> I think this doesn't need to use `pin_chain`? You can do
>>>>
>>>> gpu <- ...,
>>>>
>>>> _: {
>>>> #[cfg(...)]
>>>> gpu.run_self_tests(pdev);
>>>> }
>>>
>>> Unfortunately, this produces the following error.
>>>
>>> error[E0382]: borrow of moved value: `gpu`
>>> --> drivers/gpu/nova-core/driver.rs:140:62
>>> |
>>> 119 | gpu <- Gpu::new(
>>> | --- move occurs because `gpu` has type `core::pin::Pin<&mut gpu::Gpu<'_>>`, which does not implement the `Copy` trait
>>> ...
>>> 129 | gpu.run_selftests(pdev);
>>> | --- value moved here
>>
>> gpu.as_mut().run_selftests(pdev);
>>
>> should work?
>
> I tried that previously, that gives another error. I didn't dig in further
> though.
>
> error[E0596]: cannot borrow `gpu` as mutable, as it is not declared as mutable
> --> drivers/gpu/nova-core/driver.rs:129:17
> |
> 129 | gpu.as_mut().run_selftests(pdev);
> | ^^^ cannot borrow as mutable
> |
> help: consider changing this to be mutable
> |
> 119 | mut gpu <- Gpu::new(
> | +++
>
> error: aborting due to 1 previous error
Right, we didn't create the let binding with `mut`.
Does this fix it for you?
diff --git a/rust/pin-init/internal/src/init.rs b/rust/pin-init/internal/src/init.rs
index c5b5a0ce5c4e..031adb46cefe 100644
--- a/rust/pin-init/internal/src/init.rs
+++ b/rust/pin-init/internal/src/init.rs
@@ -446,7 +446,7 @@ fn init_fields(fields: &Punctuated<InitializerField, Token![,]>, pinned: bool) -
// Allow `non_snake_case` since the same warning is going to be reported for the
// struct field.
#[allow(unused_variables, non_snake_case)]
- let #ident = #guard.let_binding();
+ let mut #ident = #guard.let_binding();
},
Member::Unnamed(_) => quote!(),
};
Best,
Gary
next prev parent reply other threads:[~2026-09-28 13:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 14:44 [PATCH] gpu: nova-core: use a single try_pin_init!() block in probe() Danilo Krummrich
2026-09-28 0:23 ` Alexandre Courbot
2026-09-28 13:48 ` Danilo Krummrich
2026-09-29 20:31 ` John Hubbard
2026-09-29 20:43 ` Danilo Krummrich
2026-09-28 4:17 ` Eliot Courtney
2026-09-28 11:36 ` Gary Guo
2026-09-28 12:00 ` Danilo Krummrich
2026-09-28 12:10 ` Gary Guo
2026-09-28 12:15 ` Danilo Krummrich
2026-09-28 13:53 ` Gary Guo [this message]
2026-09-28 13:56 ` Danilo Krummrich
2026-09-29 19:12 ` Danilo Krummrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DLR009WMVVQ5.26C5V2E6GFD40@garyguo.net \
--to=gary@garyguo.net \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=nova-gpu@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox