diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs index 9fe6aedaa956..a64a306e0ec8 100644 --- a/drivers/gpu/nova-core/gpu.rs +++ b/drivers/gpu/nova-core/gpu.rs @@ -134,9 +134,8 @@ pub(crate) struct Spec { } impl Spec { - fn new(bar: &Devres) -> Result { - let bar = bar.try_access().ok_or(ENXIO)?; - let boot0 = regs::Boot0::read(&bar); + fn new(bar: &Bar0) -> Result { + let boot0 = regs::Boot0::read(bar); Ok(Self { chipset: boot0.chipset().try_into()?, @@ -183,8 +182,12 @@ pub(crate) struct Gpu { } impl Gpu { - pub(crate) fn new(pdev: &pci::Device, bar: Devres) -> Result> { - let spec = Spec::new(&bar)?; + pub(crate) fn new( + pdev: &pci::Device, + devres_bar: Devres, + ) -> Result> { + let bar = devres_bar.access(pdev.as_ref())?; + let spec = Spec::new(bar)?; let fw = Firmware::new(pdev.as_ref(), &spec, "535.113.01")?; dev_info!( @@ -195,6 +198,10 @@ pub(crate) fn new(pdev: &pci::Device, bar: Devres) -> Result