All of lore.kernel.org
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@kernel.org>
To: acourbot@nvidia.com
Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] gpu: nova-core: take advantage of pci::Device::unbind()
Date: Sat, 30 Aug 2025 15:51:53 +0200	[thread overview]
Message-ID: <41730916-2f02-4584-99bc-5556355bceeb@kernel.org> (raw)
In-Reply-To: <20250830133255.62380-1-dakr@kernel.org>

On 8/30/25 3:32 PM, Danilo Krummrich wrote:
> +    pub(crate) fn unbind(&self, pdev: &pci::Device<device::Bound>) {
> +        // Unregister the sysmem flush page before we release it.
> +        kernel::warn_on!(self.bar.access(pdev.as_ref()).map_or(true, |bar| {
> +            self.sysmem_flush.unregister(bar);
> +
> +            false
> +        }));
> +    }
>   }

Actually, inspect() + is_err() is much nicer:

diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 2db9afdc6087..ca4ea5749975 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -303,10 +303,10 @@ pub(crate) fn new(

      pub(crate) fn unbind(&self, pdev: &pci::Device<device::Bound>) {
          // Unregister the sysmem flush page before we release it.
-        kernel::warn_on!(self.bar.access(pdev.as_ref()).map_or(true, |bar| {
-            self.sysmem_flush.unregister(bar);
-
-            false
-        }));
+        kernel::warn_on!(self
+            .bar
+            .access(pdev.as_ref())
+            .inspect(|bar| self.sysmem_flush.unregister(bar))
+            .is_err());
      }
  }


  reply	other threads:[~2025-08-30 13:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-30 13:32 [PATCH] gpu: nova-core: take advantage of pci::Device::unbind() Danilo Krummrich
2025-08-30 13:51 ` Danilo Krummrich [this message]
2025-08-31 13:50 ` Alexandre Courbot
2025-09-01 10:41   ` Danilo Krummrich
2025-09-01 13:13     ` Alexandre Courbot
2025-09-01 14:54       ` 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=41730916-2f02-4584-99bc-5556355bceeb@kernel.org \
    --to=dakr@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=nouveau@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.