diff options
| author | Danilo Krummrich <dakr@kernel.org> | 2026-06-28 16:53:39 +0200 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2026-07-12 16:06:43 +0200 |
| commit | 354a8f8b098b29d7c6064a12958cb289421a09d1 (patch) | |
| tree | e8fca5d59125aa6f7730c3c2119cfe1feb7e74af /drivers/gpu/drm/nova | |
| parent | 3ba210061c2960380007e6475d1c1119216f5c83 (diff) | |
| download | linux-next-354a8f8b098b29d7c6064a12958cb289421a09d1.tar.gz linux-next-354a8f8b098b29d7c6064a12958cb289421a09d1.zip | |
drm: nova: Use drm::Device<Registered> to access the parent bus device
The get_param ioctl needs access to the parent auxiliary device. Since
ioctl handlers run inside a RegistrationGuard, accept
&NovaDevice<Registered> to obtain &auxiliary::Device<Bound> via as_ref()
directly. This removes the need for drm::Device data, hence set it to
().
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Tested-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Link: https://patch.msgid.link/20260628145406.2107056-20-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/nova')
| -rw-r--r-- | drivers/gpu/drm/nova/driver.rs | 11 | ||||
| -rw-r--r-- | drivers/gpu/drm/nova/file.rs | 7 |
2 files changed, 6 insertions, 12 deletions
diff --git a/drivers/gpu/drm/nova/driver.rs b/drivers/gpu/drm/nova/driver.rs index bd2a55405db8..739690bc2db5 100644 --- a/drivers/gpu/drm/nova/driver.rs +++ b/drivers/gpu/drm/nova/driver.rs @@ -29,11 +29,6 @@ pub(crate) struct Nova<'bound> { /// Convienence type alias for the DRM device type for this driver pub(crate) type NovaDevice<Ctx = drm::Normal> = drm::Device<NovaDriver, Ctx>; -#[pin_data] -pub(crate) struct NovaData { - pub(crate) adev: ARef<auxiliary::Device>, -} - const INFO: drm::DriverInfo = drm::DriverInfo { major: 0, minor: 0, @@ -64,9 +59,7 @@ impl auxiliary::Driver for NovaDriver { adev: &'bound auxiliary::Device<Core<'_>>, _info: &'bound Self::IdInfo, ) -> impl PinInit<Self::Data<'bound>, Error> + 'bound { - let data = try_pin_init!(NovaData { adev: adev.into() }); - - let drm = drm::UnregisteredDevice::<Self>::new(adev, data)?; + let drm = drm::UnregisteredDevice::<Self>::new(adev, Ok(()))?; // SAFETY: `reg` is stored in `Nova` and dropped when the driver is unbound; it is // never forgotten. let reg = unsafe { drm::Registration::new(adev.as_ref(), drm, (), 0)? }; @@ -80,7 +73,7 @@ impl auxiliary::Driver for NovaDriver { #[vtable] impl drm::Driver for NovaDriver { - type Data = NovaData; + type Data = (); type RegistrationData<'a> = (); type File = File; type Object = gem::Object<NovaObject>; diff --git a/drivers/gpu/drm/nova/file.rs b/drivers/gpu/drm/nova/file.rs index 208be4e38188..298c02bacb4b 100644 --- a/drivers/gpu/drm/nova/file.rs +++ b/drivers/gpu/drm/nova/file.rs @@ -4,6 +4,8 @@ use crate::driver::{NovaDevice, NovaDriver}; use crate::gem::NovaObject; use kernel::{ alloc::flags::*, + auxiliary, + device::Bound, drm::{ self, gem::BaseObject, @@ -32,9 +34,8 @@ impl File { getparam: &mut uapi::drm_nova_getparam, _file: &drm::File<File>, ) -> Result<u32> { - let adev = &dev.adev; - let parent = adev.parent(); - let pdev: &pci::Device = parent.try_into()?; + let adev: &auxiliary::Device<Bound> = dev.as_ref(); + let pdev: &pci::Device<Bound> = adev.parent().try_into()?; let value = match getparam.param as u32 { uapi::NOVA_GETPARAM_VRAM_BAR_SIZE => pdev.resource_len(1)?, |
