diff options
author | Joseph Kogut <joseph.kogut@gmail.com> | 2021-04-23 05:02:43 +0300 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2021-04-26 19:19:15 +0300 |
commit | 70556e24e18e61beda069d72f0d5c6172e873f45 (patch) | |
tree | 275f776a7f0cce7861fd69b3c7be3f02f0339177 /drivers/gpu/drm/drm_bufs.c | |
parent | 355b60296143a090039211c5f0e1463f84aab65a (diff) | |
download | linux-70556e24e18e61beda069d72f0d5c6172e873f45.tar.xz |
drm: remove usage of drm_pci_alloc/free
Remove usage of legacy dma-api abstraction in preparation for removal
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210423020248.3427369-1-joseph.kogut@gmail.com
Diffstat (limited to 'drivers/gpu/drm/drm_bufs.c')
-rw-r--r-- | drivers/gpu/drm/drm_bufs.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 410623fc30e0..311dbd3e45e0 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -675,12 +675,17 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data, static void drm_cleanup_buf_error(struct drm_device *dev, struct drm_buf_entry *entry) { + drm_dma_handle_t *dmah; int i; if (entry->seg_count) { for (i = 0; i < entry->seg_count; i++) { if (entry->seglist[i]) { - drm_pci_free(dev, entry->seglist[i]); + dmah = entry->seglist[i]; + dma_free_coherent(dev->dev, + dmah->size, + dmah->vaddr, + dmah->busaddr); } } kfree(entry->seglist); @@ -979,10 +984,18 @@ int drm_legacy_addbufs_pci(struct drm_device *dev, page_count = 0; while (entry->buf_count < count) { + dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL); + if (!dmah) + return -ENOMEM; - dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000); + dmah->size = total; + dmah->vaddr = dma_alloc_coherent(dev->dev, + dmah->size, + &dmah->busaddr, + GFP_KERNEL); + if (!dmah->vaddr) { + kfree(dmah); - if (!dmah) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; |