Skip to content

Commit eb05a3d

Browse files
committed
drm/asahi/regs: fix mmio handling
1 parent 71dbe40 commit eb05a3d

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

drivers/gpu/drm/asahi/regs.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,18 @@ pub(crate) struct FaultInfo {
145145
/// Device resources for this GPU instance.
146146
pub(crate) struct Resources {
147147
dev: ARef<platform::Device>,
148-
asc: Devres<IoMem<ASC_CTL_SIZE>>,
149-
sgx: Devres<IoMem<SGX_SIZE>>,
148+
sgx: Pin<KBox<Devres<IoMem<SGX_SIZE>>>>,
150149
}
151150

152151
impl Resources {
153152
/// Map the required resources given our platform device.
154153
pub(crate) fn new(pdev: &platform::Device<Core>) -> Result<Resources> {
155-
let asc_res = pdev.resource_by_name(c_str!("asc")).ok_or(EINVAL)?;
156-
let asc_iomem = pdev.iomap_resource_sized::<ASC_CTL_SIZE>(asc_res)?;
157-
158-
let sgx_res = pdev.resource_by_name(c_str!("sgx")).ok_or(EINVAL)?;
159-
let sgx_iomem = pdev.iomap_resource_sized::<SGX_SIZE>(sgx_res)?;
154+
let sgx_req = pdev.io_request_by_name(c_str!("sgx")).ok_or(EINVAL)?;
155+
let sgx_iomem = KBox::pin_init(sgx_req.iomap_sized::<SGX_SIZE>(), GFP_KERNEL)?;
160156

161157
Ok(Resources {
162158
// SAFETY: This device does DMA via the UAT IOMMU.
163159
dev: pdev.into(),
164-
asc: asc_iomem,
165160
sgx: sgx_iomem,
166161
})
167162
}

0 commit comments

Comments
 (0)