[PATCH 34/39] drm: remove the dma_ioctl special-case
David Herrmann
dh.herrmann at gmail.com
Wed Jul 10 07:34:46 PDT 2013
Hi
On Wed, Jul 10, 2013 at 2:12 PM, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> 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.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/drm_bufs.c | 14 ++++++++++++++
> drivers/gpu/drm/drm_drv.c | 6 +-----
> include/drm/drmP.h | 2 ++
> 3 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index f63133b..ff7fe80 100644
> --- a/drivers/gpu/drm/drm_bufs.c
> +++ b/drivers/gpu/drm/drm_bufs.c
> @@ -1455,6 +1455,20 @@ int drm_mapbufs(struct drm_device *dev, void *data,
> return retcode;
> }
>
> +int drm_dma_ioctl(struct drm_device *dev, void *data,
> + struct drm_file *file_priv)
> +{
> + struct drm_device_dma *dma = dev->dma;
Unused variable.
Cheers
David
> +
> + if (drm_core_check_feature(dev, DRIVER_MODESET))
> + return -EINVAL;
> +
> + if (dev->driver->dma_ioctl)
> + return dev->driver->dma_ioctl(dev, data, file_priv);
> + else
> + return -EINVAL;
> +}
> +
> struct drm_local_map *drm_getsarea(struct drm_device *dev)
> {
> struct drm_map_list *entry;
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index f2495e1..b349b5f 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[] = {
> DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_infobufs, DRM_AUTH),
> DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_mapbufs, DRM_AUTH),
> DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_freebufs, DRM_AUTH),
> - /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */
> - DRM_IOCTL_DEF(DRM_IOCTL_DMA, NULL, DRM_AUTH),
> + DRM_IOCTL_DEF(DRM_IOCTL_DMA, drm_dma_ioctl, DRM_AUTH),
>
> DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
>
> @@ -415,9 +414,6 @@ long drm_ioctl(struct file *filp,
>
> /* Do not trust userspace, use our own definition */
> func = ioctl->func;
> - /* is there a local override? */
> - if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl)
> - func = dev->driver->dma_ioctl;
>
> if (!func) {
> DRM_DEBUG("no function\n");
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index d933f06..1afa431 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -1368,6 +1368,8 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
> struct drm_file *file_priv);
> extern int drm_mapbufs(struct drm_device *dev, void *data,
> struct drm_file *file_priv);
> +extern int drm_dma_ioctl(struct drm_device *dev, void *data,
> + struct drm_file *file_priv);
>
> /* DMA support (drm_dma.h) */
> extern int drm_legacy_dma_setup(struct drm_device *dev);
> --
> 1.8.3.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the dri-devel
mailing list