drm: define drm_compat_ioctl NULL on CONFIG_COMPAT=n and reduce #ifdefs
authorJani Nikula <jani.nikula@intel.com>
Tue, 1 Nov 2016 15:40:44 +0000 (17:40 +0200)
committerSean Paul <seanpaul@chromium.org>
Wed, 2 Nov 2016 15:33:47 +0000 (11:33 -0400)
If we define drm_compat_ioctl NULL on CONFIG_COMPAT=n, we don't have to
check for the config everywhere.

Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1478014844-27454-1-git-send-email-jani.nikula@intel.com
35 files changed:
drivers/gpu/drm/arc/arcpgu_drv.c
drivers/gpu/drm/arm/hdlcd_drv.c
drivers/gpu/drm/arm/malidp_drv.c
drivers/gpu/drm/ast/ast_drv.c
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
drivers/gpu/drm/bochs/bochs_drv.c
drivers/gpu/drm/cirrus/cirrus_drv.c
drivers/gpu/drm/drm_fops.c
drivers/gpu/drm/etnaviv/etnaviv_drv.c
drivers/gpu/drm/exynos/exynos_drm_drv.c
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
drivers/gpu/drm/gma500/psb_drv.c
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
drivers/gpu/drm/i810/i810_dma.c
drivers/gpu/drm/i810/i810_drv.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/mediatek/mtk_drm_drv.c
drivers/gpu/drm/mgag200/mgag200_drv.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/rcar-du/rcar_du_drv.c
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
drivers/gpu/drm/savage/savage_drv.c
drivers/gpu/drm/shmobile/shmob_drm_drv.c
drivers/gpu/drm/sis/sis_drv.c
drivers/gpu/drm/sti/sti_drv.c
drivers/gpu/drm/sun4i/sun4i_drv.c
drivers/gpu/drm/tdfx/tdfx_drv.c
drivers/gpu/drm/tegra/drm.c
drivers/gpu/drm/tilcdc/tilcdc_drv.c
drivers/gpu/drm/udl/udl_drv.c
drivers/gpu/drm/vc4/vc4_drv.c
drivers/gpu/drm/via/via_drv.c
drivers/gpu/drm/virtio/virtgpu_drv.c
include/drm/drmP.h

index 28e6471..0b6eaa4 100644 (file)
@@ -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,
index 6477d1a..59747ec 100644 (file)
@@ -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,
index 9f47394..d53b625 100644 (file)
@@ -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,
index f54afd2..fd7c9ee 100644 (file)
@@ -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,
 };
 
index 9f62228..cbd0070 100644 (file)
@@ -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,
index 534227d..15a293e 100644 (file)
@@ -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,
index 6c76d12..d893ea2 100644 (file)
@@ -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,
index cf993db..5d96de4 100644 (file)
@@ -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,
index 0dee6ac..a6799b0 100644 (file)
@@ -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,
index 4a21a74..b247149 100644 (file)
@@ -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,
 };
 
index e04efbe..0b0d1cb 100644 (file)
@@ -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,
index 8f3ca52..ff37ea5 100644 (file)
@@ -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,
index e88fde1..ebd5f4f 100644 (file)
@@ -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,
index d918567..ab4e6cb 100644 (file)
@@ -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,
 };
 
index 0be55dc..02504a7 100644 (file)
@@ -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,
 };
 
index 912d534..cf583d4 100644 (file)
@@ -2509,9 +2509,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,
 };
 
index f022f43..74476f5 100644 (file)
@@ -2901,6 +2901,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;
 
index 296f541..d90152e 100644 (file)
@@ -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 = {
index 1443b3a..b0b8742 100644 (file)
@@ -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,
 };
 
index 84d38ea..8855972 100644 (file)
@@ -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,
index 73c971e..68fd167 100644 (file)
@@ -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,
index 6fe1611..2390c85 100644 (file)
@@ -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,
 };
 
index 3b80713..78c6d8e 100644 (file)
@@ -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,
 };
 
index f049260..38dd55f 100644 (file)
@@ -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,
index ae98398..a836451 100644 (file)
@@ -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,
 };
 
index 6aead20..80ecee9 100644 (file)
@@ -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,
 };
 
index b3c4ad6..aae723c 100644 (file)
@@ -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,
index f418892..c54138c 100644 (file)
@@ -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,
 };
 
index a9630c2..b8be3ee 100644 (file)
@@ -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,
 };
 
index 147fb28..0f58a74 100644 (file)
@@ -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,
index cc45d98..cd8b017 100644 (file)
@@ -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,
 };
 
index 8703f56..eaf26d9 100644 (file)
@@ -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,
 };
 
index e5582ba..9e0e539 100644 (file)
@@ -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,
 };
 
index 5820b70..04d98db 100644 (file)
@@ -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,
 };
 
index e336e39..a3effab 100644 (file)
@@ -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) */