Commit e2e99a8206bcce6f2d3d72ff8be42859f98dbcda
Committed by
Dave Airlie
1 parent
8e194bbf96
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
drm: mark dma setup/teardown as legacy systems
And hide the checks a bit better. This was already disallowed for modesetting drivers, so no functinal change here. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
Showing 4 changed files with 21 additions and 16 deletions Side-by-side Diff
drivers/gpu/drm/drm_dma.c
... | ... | @@ -44,10 +44,18 @@ |
44 | 44 | * |
45 | 45 | * Allocate and initialize a drm_device_dma structure. |
46 | 46 | */ |
47 | -int drm_dma_setup(struct drm_device *dev) | |
47 | +int drm_legacy_dma_setup(struct drm_device *dev) | |
48 | 48 | { |
49 | 49 | int i; |
50 | 50 | |
51 | + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) || | |
52 | + drm_core_check_feature(dev, DRIVER_MODESET)) { | |
53 | + return 0; | |
54 | + } | |
55 | + | |
56 | + dev->buf_use = 0; | |
57 | + atomic_set(&dev->buf_alloc, 0); | |
58 | + | |
51 | 59 | dev->dma = kzalloc(sizeof(*dev->dma), GFP_KERNEL); |
52 | 60 | if (!dev->dma) |
53 | 61 | return -ENOMEM; |
54 | 62 | |
... | ... | @@ -66,10 +74,15 @@ |
66 | 74 | * Free all pages associated with DMA buffers, the buffers and pages lists, and |
67 | 75 | * finally the drm_device::dma structure itself. |
68 | 76 | */ |
69 | -void drm_dma_takedown(struct drm_device *dev) | |
77 | +void drm_legacy_dma_takedown(struct drm_device *dev) | |
70 | 78 | { |
71 | 79 | struct drm_device_dma *dma = dev->dma; |
72 | 80 | int i, j; |
81 | + | |
82 | + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) || | |
83 | + drm_core_check_feature(dev, DRIVER_MODESET)) { | |
84 | + return; | |
85 | + } | |
73 | 86 | |
74 | 87 | if (!dma) |
75 | 88 | return; |
drivers/gpu/drm/drm_drv.c
... | ... | @@ -205,9 +205,7 @@ |
205 | 205 | kfree(vma); |
206 | 206 | } |
207 | 207 | |
208 | - if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && | |
209 | - !drm_core_check_feature(dev, DRIVER_MODESET)) | |
210 | - drm_dma_takedown(dev); | |
208 | + drm_legacy_dma_takedown(dev); | |
211 | 209 | |
212 | 210 | dev->dev_mapping = NULL; |
213 | 211 | mutex_unlock(&dev->struct_mutex); |
drivers/gpu/drm/drm_fops.c
... | ... | @@ -60,15 +60,9 @@ |
60 | 60 | atomic_set(&dev->ioctl_count, 0); |
61 | 61 | atomic_set(&dev->vma_count, 0); |
62 | 62 | |
63 | - if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && | |
64 | - !drm_core_check_feature(dev, DRIVER_MODESET)) { | |
65 | - dev->buf_use = 0; | |
66 | - atomic_set(&dev->buf_alloc, 0); | |
67 | - | |
68 | - i = drm_dma_setup(dev); | |
69 | - if (i < 0) | |
70 | - return i; | |
71 | - } | |
63 | + i = drm_legacy_dma_setup(dev); | |
64 | + if (i < 0) | |
65 | + return i; | |
72 | 66 | |
73 | 67 | for (i = 0; i < ARRAY_SIZE(dev->counts); i++) |
74 | 68 | atomic_set(&dev->counts[i], 0); |
include/drm/drmP.h
... | ... | @@ -1374,8 +1374,8 @@ |
1374 | 1374 | struct drm_file *file_priv); |
1375 | 1375 | |
1376 | 1376 | /* DMA support (drm_dma.h) */ |
1377 | -extern int drm_dma_setup(struct drm_device *dev); | |
1378 | -extern void drm_dma_takedown(struct drm_device *dev); | |
1377 | +extern int drm_legacy_dma_setup(struct drm_device *dev); | |
1378 | +extern void drm_legacy_dma_takedown(struct drm_device *dev); | |
1379 | 1379 | extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf); |
1380 | 1380 | extern void drm_core_reclaim_buffers(struct drm_device *dev, |
1381 | 1381 | struct drm_file *filp); |