Skip to content

Commit 06bbe25

Browse files
committed
Merge branch 'pci/devres'
- Add pcim_add_mapping_to_legacy_table() and pcim_remove_mapping_from_legacy_table() helper functions to simplify devres iomap table (Philipp Stanner) - Reimplement devres that take a bit mask of BARs in a way that can be used to map partial BARs as well as entire BARs (Philipp Stanner) - Deprecate pcim_iomap_table() and pcim_iomap_regions_request_all() in favor of pcim_* request plus pcim_* mapping (Philipp Stanner) - Add pcim_request_region(), a managed interface to request a single BAR (Philipp Stanner) - Use the existing pci_is_enabled() interface to replace the struct devres.enabled bit (Philipp Stanner) - Move the struct pci_devres.pinned bit to struct pci_dev (Philipp Stanner) - Reimplement pcim_set_mwi() so it uses its own devres cleanup callback instead of a special-purpose bit in struct pci_devres (Philipp Stanner) - Add pcim_intx(), which is unambiguously managed, unlike pci_intx(), which is managed if pcim_enable_device() has been called but unmanaged otherwise (Philipp Stanner) - Remove pcim_release(), which is no longer needed after previous cleanups of pcim_set_mwi() and pci_intx() (Philipp Stanner) - Add pcim_iomap_range(), a managed interface to map part of a BAR (Philipp Stanner) - Fix vboxvideo leak by using the new pcim_iomap_range() instead of the unmanaged pci_iomap_range() (Philipp Stanner) * pci/devres: drm/vboxvideo: fix mapping leaks PCI: Add managed pcim_iomap_range() PCI: Remove legacy pcim_release() PCI: Add managed pcim_intx() PCI: Give pcim_set_mwi() its own devres cleanup callback PCI: Move struct pci_devres.pinned bit to struct pci_dev PCI: Remove struct pci_devres.enabled status bit PCI: Document hybrid devres hazards PCI: Add managed pcim_request_region() PCI: Deprecate pcim_iomap_table(), pcim_iomap_regions_request_all() PCI: Add managed partial-BAR request and map infrastructure PCI: Add devres helpers for iomap table PCI: Add and use devres helper for bit masks
2 parents cb43487 + f00059b commit 06bbe25

File tree

6 files changed

+871
-202
lines changed

6 files changed

+871
-202
lines changed

drivers/gpu/drm/vboxvideo/vbox_main.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ static int vbox_accel_init(struct vbox_private *vbox)
4242
/* Take a command buffer for each screen from the end of usable VRAM. */
4343
vbox->available_vram_size -= vbox->num_crtcs * VBVA_MIN_BUFFER_SIZE;
4444

45-
vbox->vbva_buffers = pci_iomap_range(pdev, 0,
46-
vbox->available_vram_size,
47-
vbox->num_crtcs *
48-
VBVA_MIN_BUFFER_SIZE);
49-
if (!vbox->vbva_buffers)
50-
return -ENOMEM;
45+
vbox->vbva_buffers = pcim_iomap_range(
46+
pdev, 0, vbox->available_vram_size,
47+
vbox->num_crtcs * VBVA_MIN_BUFFER_SIZE);
48+
if (IS_ERR(vbox->vbva_buffers))
49+
return PTR_ERR(vbox->vbva_buffers);
5150

5251
for (i = 0; i < vbox->num_crtcs; ++i) {
5352
vbva_setup_buffer_context(&vbox->vbva_info[i],
@@ -116,11 +115,10 @@ int vbox_hw_init(struct vbox_private *vbox)
116115
DRM_INFO("VRAM %08x\n", vbox->full_vram_size);
117116

118117
/* Map guest-heap at end of vram */
119-
vbox->guest_heap =
120-
pci_iomap_range(pdev, 0, GUEST_HEAP_OFFSET(vbox),
121-
GUEST_HEAP_SIZE);
122-
if (!vbox->guest_heap)
123-
return -ENOMEM;
118+
vbox->guest_heap = pcim_iomap_range(pdev, 0,
119+
GUEST_HEAP_OFFSET(vbox), GUEST_HEAP_SIZE);
120+
if (IS_ERR(vbox->guest_heap))
121+
return PTR_ERR(vbox->guest_heap);
124122

125123
/* Create guest-heap mem-pool use 2^4 = 16 byte chunks */
126124
vbox->guest_pool = devm_gen_pool_create(vbox->ddev.dev, 4, -1,

0 commit comments

Comments
 (0)