aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDanilo Krummrich <dakr@kernel.org>2025-10-21 00:34:26 +0200
committerDanilo Krummrich <dakr@kernel.org>2025-10-29 18:29:32 +0100
commite4e679c8608e5c747081cc6ce63ee0b0e524c68d (patch)
treeba5c0a8dbb8abd3efae0bab5de059bc69c2b2e75 /drivers/gpu
parent589b061975db3c7e87b819cc9a8006eb99ac4b5f (diff)
rust: auxiliary: unregister on parent device unbind
Guarantee that an auxiliary driver will be unbound before its parent is unbound; there is no point in operating an auxiliary device whose parent has been unbound. In practice, this guarantee allows us to assume that for a bound auxiliary device, also the parent device is bound. This is useful when an auxiliary driver calls into its parent, since it allows the parent to directly access device resources and its device private data due to the guaranteed bound device context. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nova-core/driver.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
index a83b86199182..ca0d5f8ad54b 100644
--- a/drivers/gpu/nova-core/driver.rs
+++ b/drivers/gpu/nova-core/driver.rs
@@ -3,6 +3,7 @@
use kernel::{
auxiliary, c_str,
device::Core,
+ devres::Devres,
pci,
pci::{Class, ClassMask, Vendor},
prelude::*,
@@ -16,7 +17,8 @@ use crate::gpu::Gpu;
pub(crate) struct NovaCore {
#[pin]
pub(crate) gpu: Gpu,
- _reg: auxiliary::Registration,
+ #[pin]
+ _reg: Devres<auxiliary::Registration>,
}
const BAR0_SIZE: usize = SZ_16M;
@@ -65,12 +67,12 @@ impl pci::Driver for NovaCore {
Ok(try_pin_init!(Self {
gpu <- Gpu::new(pdev, bar.clone(), bar.access(pdev.as_ref())?),
- _reg: auxiliary::Registration::new(
+ _reg <- auxiliary::Registration::new(
pdev.as_ref(),
c_str!("nova-drm"),
0, // TODO[XARR]: Once it lands, use XArray; for now we don't use the ID.
crate::MODULE_NAME
- )?,
+ ),
}))
})
}