[Intel-gfx] [RFC PATCH] drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs

Patrik Jakobsson patrik.r.jakobsson at gmail.com
Wed Nov 2 06:03:07 UTC 2016


On Tue, Nov 1, 2016 at 4:40 PM, Jani Nikula <jani.nikula at intel.com> wrote:
> If we define drm_compat_ioctl NULL on CONFIG_COMPAT=n, we don't have to
> check for the config everywhere.
>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Looks good and I like the idea.

Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson at gmail.com>

> ---
>
> Just an idea on top of Patrik's patch.
> ---
>  drivers/gpu/drm/arc/arcpgu_drv.c                |  2 --
>  drivers/gpu/drm/arm/hdlcd_drv.c                 |  2 --
>  drivers/gpu/drm/arm/malidp_drv.c                |  2 --
>  drivers/gpu/drm/ast/ast_drv.c                   |  2 --
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    |  2 --
>  drivers/gpu/drm/bochs/bochs_drv.c               |  2 --
>  drivers/gpu/drm/cirrus/cirrus_drv.c             |  2 --
>  drivers/gpu/drm/drm_fops.c                      | 13 ++++++-------
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c           |  2 --
>  drivers/gpu/drm/exynos/exynos_drm_drv.c         |  2 --
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c       |  2 --
>  drivers/gpu/drm/gma500/psb_drv.c                |  2 --
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  2 --
>  drivers/gpu/drm/i810/i810_dma.c                 |  2 --
>  drivers/gpu/drm/i810/i810_drv.c                 |  2 --
>  drivers/gpu/drm/i915/i915_drv.c                 |  2 --
>  drivers/gpu/drm/i915/i915_drv.h                 |  2 ++
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c          |  2 --
>  drivers/gpu/drm/mgag200/mgag200_drv.c           |  2 --
>  drivers/gpu/drm/msm/msm_drv.c                   |  2 --
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c           |  2 --
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c     |  2 --
>  drivers/gpu/drm/savage/savage_drv.c             |  2 --
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c        |  2 --
>  drivers/gpu/drm/sis/sis_drv.c                   |  2 --
>  drivers/gpu/drm/sti/sti_drv.c                   |  2 --
>  drivers/gpu/drm/sun4i/sun4i_drv.c               |  2 --
>  drivers/gpu/drm/tdfx/tdfx_drv.c                 |  2 --
>  drivers/gpu/drm/tegra/drm.c                     |  2 --
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c             |  2 --
>  drivers/gpu/drm/udl/udl_drv.c                   |  2 --
>  drivers/gpu/drm/vc4/vc4_drv.c                   |  2 --
>  drivers/gpu/drm/via/via_drv.c                   |  2 --
>  drivers/gpu/drm/virtio/virtgpu_drv.c            |  2 --
>  include/drm/drmP.h                              |  5 +++++
>  35 files changed, 13 insertions(+), 71 deletions(-)
>
> diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
> index 28e6471257d0..0b6eaa49a1db 100644
> --- a/drivers/gpu/drm/arc/arcpgu_drv.c
> +++ b/drivers/gpu/drm/arc/arcpgu_drv.c
> @@ -65,9 +65,7 @@ static const struct file_operations arcpgu_drm_ops = {
>         .open = drm_open,
>         .release = drm_release,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .poll = drm_poll,
>         .read = drm_read,
>         .llseek = no_llseek,
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index 6477d1a65266..59747ecaad54 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -268,9 +268,7 @@ static const struct file_operations fops = {
>         .open           = drm_open,
>         .release        = drm_release,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl   = drm_compat_ioctl,
> -#endif
>         .poll           = drm_poll,
>         .read           = drm_read,
>         .llseek         = noop_llseek,
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 9f4739452a25..d53b625b14fe 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -197,9 +197,7 @@ static const struct file_operations fops = {
>         .open = drm_open,
>         .release = drm_release,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .poll = drm_poll,
>         .read = drm_read,
>         .llseek = noop_llseek,
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index f54afd2113a9..fd7c9eec92e4 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -188,9 +188,7 @@ static const struct file_operations ast_fops = {
>         .unlocked_ioctl = drm_ioctl,
>         .mmap = ast_mmap,
>         .poll = drm_poll,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .read = drm_read,
>  };
>
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 9f6222895212..cbd0070265c9 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -749,9 +749,7 @@ static const struct file_operations fops = {
>         .open               = drm_open,
>         .release            = drm_release,
>         .unlocked_ioctl     = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl       = drm_compat_ioctl,
> -#endif
>         .poll               = drm_poll,
>         .read               = drm_read,
>         .llseek             = no_llseek,
> diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
> index 534227df23f3..15a293e65b31 100644
> --- a/drivers/gpu/drm/bochs/bochs_drv.c
> +++ b/drivers/gpu/drm/bochs/bochs_drv.c
> @@ -70,9 +70,7 @@ static const struct file_operations bochs_fops = {
>         .open           = drm_open,
>         .release        = drm_release,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl   = drm_compat_ioctl,
> -#endif
>         .poll           = drm_poll,
>         .read           = drm_read,
>         .llseek         = no_llseek,
> diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
> index 6c76d125995b..d893ea21a359 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_drv.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
> @@ -126,9 +126,7 @@ static const struct file_operations cirrus_driver_fops = {
>         .unlocked_ioctl = drm_ioctl,
>         .mmap = cirrus_mmap,
>         .poll = drm_poll,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>  };
>  static struct drm_driver driver = {
>         .driver_features = DRIVER_MODESET | DRIVER_GEM,
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index cf993dbf602e..5d96de40b63f 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -51,10 +51,11 @@ DEFINE_MUTEX(drm_global_mutex);
>   * Drivers must define the file operations structure that forms the DRM
>   * userspace API entry point, even though most of those operations are
>   * implemented in the DRM core. The mandatory functions are drm_open(),
> - * drm_read(), drm_ioctl() and drm_compat_ioctl if CONFIG_COMPAT is enabled.
> - * Drivers which implement private ioctls that require 32/64 bit compatibility
> - * support must provided their onw .compat_ioctl() handler that processes
> - * private ioctls and calls drm_compat_ioctl() for core ioctls.
> + * drm_read(), drm_ioctl() and drm_compat_ioctl() if CONFIG_COMPAT is enabled
> + * (note that drm_compat_ioctl will be NULL if CONFIG_COMPAT=n). Drivers which
> + * implement private ioctls that require 32/64 bit compatibility support must
> + * provide their own .compat_ioctl() handler that processes private ioctls and
> + * calls drm_compat_ioctl() for core ioctls.
>   *
>   * In addition drm_read() and drm_poll() provide support for DRM events. DRM
>   * events are a generic and extensible means to send asynchronous events to
> @@ -75,9 +76,7 @@ DEFINE_MUTEX(drm_global_mutex);
>   *             .open = drm_open,
>   *             .release = drm_release,
>   *             .unlocked_ioctl = drm_ioctl,
> - *     #ifdef CONFIG_COMPAT
> - *             .compat_ioctl = drm_compat_ioctl,
> - *     #endif
> + *             .compat_ioctl = drm_compat_ioctl, // NULL if CONFIG_COMPAT=n
>   *             .poll = drm_poll,
>   *             .read = drm_read,
>   *             .llseek = no_llseek,
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 0dee6acbd880..a6799b0aa3d9 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -479,9 +479,7 @@ static const struct file_operations fops = {
>         .open               = drm_open,
>         .release            = drm_release,
>         .unlocked_ioctl     = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl       = drm_compat_ioctl,
> -#endif
>         .poll               = drm_poll,
>         .read               = drm_read,
>         .llseek             = no_llseek,
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 4a21a745c373..b24714976d24 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -346,9 +346,7 @@ static const struct file_operations exynos_drm_driver_fops = {
>         .poll           = drm_poll,
>         .read           = drm_read,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .release        = drm_release,
>  };
>
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index e04efbed1a54..0b0d1cb11641 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -180,9 +180,7 @@ static const struct file_operations fsl_dcu_drm_fops = {
>         .open           = drm_open,
>         .release        = drm_release,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl   = drm_compat_ioctl,
> -#endif
>         .poll           = drm_poll,
>         .read           = drm_read,
>         .llseek         = no_llseek,
> diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
> index 8f3ca526bd1b..ff37ea585664 100644
> --- a/drivers/gpu/drm/gma500/psb_drv.c
> +++ b/drivers/gpu/drm/gma500/psb_drv.c
> @@ -473,9 +473,7 @@ static const struct file_operations psb_gem_fops = {
>         .open = drm_open,
>         .release = drm_release,
>         .unlocked_ioctl = psb_unlocked_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .mmap = drm_gem_mmap,
>         .poll = drm_poll,
>         .read = drm_read,
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index e88fde18c946..ebd5f4fe4c23 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -152,9 +152,7 @@ static const struct file_operations kirin_drm_fops = {
>         .open           = drm_open,
>         .release        = drm_release,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl   = drm_compat_ioctl,
> -#endif
>         .poll           = drm_poll,
>         .read           = drm_read,
>         .llseek         = no_llseek,
> diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
> index d91856779beb..ab4e6cbe1f8b 100644
> --- a/drivers/gpu/drm/i810/i810_dma.c
> +++ b/drivers/gpu/drm/i810/i810_dma.c
> @@ -113,9 +113,7 @@ static const struct file_operations i810_buffer_fops = {
>         .release = drm_release,
>         .unlocked_ioctl = drm_ioctl,
>         .mmap = i810_mmap_buffers,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
> index 0be55dc1ef4b..02504a7cfaf2 100644
> --- a/drivers/gpu/drm/i810/i810_drv.c
> +++ b/drivers/gpu/drm/i810/i810_drv.c
> @@ -49,9 +49,7 @@ static const struct file_operations i810_driver_fops = {
>         .unlocked_ioctl = drm_ioctl,
>         .mmap = drm_legacy_mmap,
>         .poll = drm_poll,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 6a99544c98d3..9699c4092f71 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -2499,9 +2499,7 @@ static const struct file_operations i915_driver_fops = {
>         .mmap = drm_gem_mmap,
>         .poll = drm_poll,
>         .read = drm_read,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = i915_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 51360d199263..eb8a888fb3eb 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2984,6 +2984,8 @@ __i915_printk(struct drm_i915_private *dev_priv, const char *level,
>  #ifdef CONFIG_COMPAT
>  extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
>                               unsigned long arg);
> +#else
> +#define i915_compat_ioctl NULL
>  #endif
>  extern const struct dev_pm_ops i915_pm_ops;
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 296f541fbe2f..d90152e85ed0 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -249,9 +249,7 @@ static const struct file_operations mtk_drm_fops = {
>         .mmap = mtk_drm_gem_mmap,
>         .poll = drm_poll,
>         .read = drm_read,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>  };
>
>  static struct drm_driver mtk_drm_driver = {
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
> index 1443b3a34775..b0b874264f9d 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
> @@ -82,9 +82,7 @@ static const struct file_operations mgag200_driver_fops = {
>         .unlocked_ioctl = drm_ioctl,
>         .mmap = mgag200_mmap,
>         .poll = drm_poll,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .read = drm_read,
>  };
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 84d38eaea585..8855972303ec 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -768,9 +768,7 @@ static const struct file_operations fops = {
>         .open               = drm_open,
>         .release            = drm_release,
>         .unlocked_ioctl     = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl       = drm_compat_ioctl,
> -#endif
>         .poll               = drm_poll,
>         .read               = drm_read,
>         .llseek             = no_llseek,
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 73c971e39b1c..68fd167d7313 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -201,9 +201,7 @@ static const struct file_operations rcar_du_fops = {
>         .open           = drm_open,
>         .release        = drm_release,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl   = drm_compat_ioctl,
> -#endif
>         .poll           = drm_poll,
>         .read           = drm_read,
>         .llseek         = no_llseek,
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index 6fe161192bb4..2390c8577617 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -275,9 +275,7 @@ static const struct file_operations rockchip_drm_driver_fops = {
>         .poll = drm_poll,
>         .read = drm_read,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .release = drm_release,
>  };
>
> diff --git a/drivers/gpu/drm/savage/savage_drv.c b/drivers/gpu/drm/savage/savage_drv.c
> index 3b807135a5cd..78c6d8e9b42c 100644
> --- a/drivers/gpu/drm/savage/savage_drv.c
> +++ b/drivers/gpu/drm/savage/savage_drv.c
> @@ -42,9 +42,7 @@ static const struct file_operations savage_driver_fops = {
>         .unlocked_ioctl = drm_ioctl,
>         .mmap = drm_legacy_mmap,
>         .poll = drm_poll,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> index f0492603ea88..38dd55f4af81 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -245,9 +245,7 @@ static const struct file_operations shmob_drm_fops = {
>         .open           = drm_open,
>         .release        = drm_release,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl   = drm_compat_ioctl,
> -#endif
>         .poll           = drm_poll,
>         .read           = drm_read,
>         .llseek         = no_llseek,
> diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
> index ae9839886c4d..a836451920f0 100644
> --- a/drivers/gpu/drm/sis/sis_drv.c
> +++ b/drivers/gpu/drm/sis/sis_drv.c
> @@ -72,9 +72,7 @@ static const struct file_operations sis_driver_fops = {
>         .unlocked_ioctl = drm_ioctl,
>         .mmap = drm_legacy_mmap,
>         .poll = drm_poll,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 6aead2013b62..80ecee9d52b8 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -277,9 +277,7 @@ static const struct file_operations sti_driver_fops = {
>         .poll = drm_poll,
>         .read = drm_read,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .release = drm_release,
>  };
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index b3c4ad605e81..aae723cd6d79 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -53,9 +53,7 @@ static const struct file_operations sun4i_drv_fops = {
>         .open           = drm_open,
>         .release        = drm_release,
>         .unlocked_ioctl = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl   = drm_compat_ioctl,
> -#endif
>         .poll           = drm_poll,
>         .read           = drm_read,
>         .llseek         = no_llseek,
> diff --git a/drivers/gpu/drm/tdfx/tdfx_drv.c b/drivers/gpu/drm/tdfx/tdfx_drv.c
> index f418892b0c71..c54138c3a376 100644
> --- a/drivers/gpu/drm/tdfx/tdfx_drv.c
> +++ b/drivers/gpu/drm/tdfx/tdfx_drv.c
> @@ -49,9 +49,7 @@ static const struct file_operations tdfx_driver_fops = {
>         .unlocked_ioctl = drm_ioctl,
>         .mmap = drm_legacy_mmap,
>         .poll = drm_poll,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index a9630c2d6cb3..b8be3ee4d3b8 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -802,9 +802,7 @@ static const struct file_operations tegra_drm_fops = {
>         .mmap = tegra_drm_mmap,
>         .poll = drm_poll,
>         .read = drm_read,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 147fb28287ae..0f58a74f25d1 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -573,9 +573,7 @@ static const struct file_operations fops = {
>         .open               = drm_open,
>         .release            = drm_release,
>         .unlocked_ioctl     = drm_ioctl,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl       = drm_compat_ioctl,
> -#endif
>         .poll               = drm_poll,
>         .read               = drm_read,
>         .llseek             = no_llseek,
> diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
> index cc45d98f9bb5..cd8b01727734 100644
> --- a/drivers/gpu/drm/udl/udl_drv.c
> +++ b/drivers/gpu/drm/udl/udl_drv.c
> @@ -44,9 +44,7 @@ static const struct file_operations udl_driver_fops = {
>         .read = drm_read,
>         .unlocked_ioctl = drm_ioctl,
>         .release = drm_release,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index 8703f56b7947..eaf26d9b5f11 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -103,9 +103,7 @@ static const struct file_operations vc4_drm_fops = {
>         .mmap = vc4_mmap,
>         .poll = drm_poll,
>         .read = drm_read,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c
> index e5582bab7e3c..9e0e5392b6ec 100644
> --- a/drivers/gpu/drm/via/via_drv.c
> +++ b/drivers/gpu/drm/via/via_drv.c
> @@ -64,9 +64,7 @@ static const struct file_operations via_driver_fops = {
>         .unlocked_ioctl = drm_ioctl,
>         .mmap = drm_legacy_mmap,
>         .poll = drm_poll,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
> index 5820b7020ae5..04d98db75c64 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
> @@ -108,9 +108,7 @@ static const struct file_operations virtio_gpu_driver_fops = {
>         .read = drm_read,
>         .unlocked_ioctl = drm_ioctl,
>         .release = drm_release,
> -#ifdef CONFIG_COMPAT
>         .compat_ioctl = drm_compat_ioctl,
> -#endif
>         .llseek = noop_llseek,
>  };
>
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index e336e3901876..a3effab98407 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -941,8 +941,13 @@ static inline bool drm_is_primary_client(const struct drm_file *file_priv)
>  extern int drm_ioctl_permit(u32 flags, struct drm_file *file_priv);
>  extern long drm_ioctl(struct file *filp,
>                       unsigned int cmd, unsigned long arg);
> +#ifdef CONFIG_COMPAT
>  extern long drm_compat_ioctl(struct file *filp,
>                              unsigned int cmd, unsigned long arg);
> +#else
> +/* Let drm_compat_ioctl be assigned to .compat_ioctl unconditionally */
> +#define drm_compat_ioctl NULL
> +#endif
>  extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
>
>  /* File Operations (drm_fops.c) */
> --
> 2.1.4
>


More information about the Intel-gfx mailing list