diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-08 09:41:29 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-08-19 00:15:50 -0400 |
commit | 6eb9278adabd17da3bc1cb843c729d1b10d79c93 (patch) | |
tree | 06e8b2806147c85bf3a5399c7d69be5948de07c9 | |
parent | 2ba5f7d538976a9d6a70339da4be49f6652fe753 (diff) |
drm: remove the dma_ioctl special-case
We might as well have a real ioctl function which checks for the
callbacks. This seems to be a remnant from back in the days when each
drm driver had their own complete ioctl table, with no shared core
drm table at all.
To make really sure no mis-guided user in a kms driver pops up again
explicitly check for that in the new ioctl implementation.
v2: Drop the unused variable I've accidentally left in the code,
spotted by David Herrmann.
Cc: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_bufs.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_drv.c | 6 | ||||
-rw-r--r-- | include/drm/drmP.h | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index f63133b0a9ab..471e051d295e 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -1455,6 +1455,18 @@ int drm_mapbufs(struct drm_device *dev, void *data, | |||
1455 | return retcode; | 1455 | return retcode; |
1456 | } | 1456 | } |
1457 | 1457 | ||
1458 | int drm_dma_ioctl(struct drm_device *dev, void *data, | ||
1459 | struct drm_file *file_priv) | ||
1460 | { | ||
1461 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
1462 | return -EINVAL; | ||
1463 | |||
1464 | if (dev->driver->dma_ioctl) | ||
1465 | return dev->driver->dma_ioctl(dev, data, file_priv); | ||
1466 | else | ||
1467 | return -EINVAL; | ||
1468 | } | ||
1469 | |||
1458 | struct drm_local_map *drm_getsarea(struct drm_device *dev) | 1470 | struct drm_local_map *drm_getsarea(struct drm_device *dev) |
1459 | { | 1471 | { |
1460 | struct drm_map_list *entry; | 1472 | struct drm_map_list *entry; |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index d97976cc51cd..357a14ea3cb0 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -106,8 +106,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = { | |||
106 | DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_infobufs, DRM_AUTH), | 106 | DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_infobufs, DRM_AUTH), |
107 | DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_mapbufs, DRM_AUTH), | 107 | DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_mapbufs, DRM_AUTH), |
108 | DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_freebufs, DRM_AUTH), | 108 | DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_freebufs, DRM_AUTH), |
109 | /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ | 109 | DRM_IOCTL_DEF(DRM_IOCTL_DMA, drm_dma_ioctl, DRM_AUTH), |
110 | DRM_IOCTL_DEF(DRM_IOCTL_DMA, NULL, DRM_AUTH), | ||
111 | 110 | ||
112 | DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 111 | DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
113 | 112 | ||
@@ -397,9 +396,6 @@ long drm_ioctl(struct file *filp, | |||
397 | 396 | ||
398 | /* Do not trust userspace, use our own definition */ | 397 | /* Do not trust userspace, use our own definition */ |
399 | func = ioctl->func; | 398 | func = ioctl->func; |
400 | /* is there a local override? */ | ||
401 | if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl) | ||
402 | func = dev->driver->dma_ioctl; | ||
403 | 399 | ||
404 | if (!func) { | 400 | if (!func) { |
405 | DRM_DEBUG("no function\n"); | 401 | DRM_DEBUG("no function\n"); |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 139d859adf16..808eb237be0e 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1355,6 +1355,8 @@ extern int drm_freebufs(struct drm_device *dev, void *data, | |||
1355 | struct drm_file *file_priv); | 1355 | struct drm_file *file_priv); |
1356 | extern int drm_mapbufs(struct drm_device *dev, void *data, | 1356 | extern int drm_mapbufs(struct drm_device *dev, void *data, |
1357 | struct drm_file *file_priv); | 1357 | struct drm_file *file_priv); |
1358 | extern int drm_dma_ioctl(struct drm_device *dev, void *data, | ||
1359 | struct drm_file *file_priv); | ||
1358 | 1360 | ||
1359 | /* DMA support (drm_dma.h) */ | 1361 | /* DMA support (drm_dma.h) */ |
1360 | extern int drm_legacy_dma_setup(struct drm_device *dev); | 1362 | extern int drm_legacy_dma_setup(struct drm_device *dev); |