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 28e6471257d0d799d020f7e1dac47007760fcee9..0b6eaa49a1db15f5f4f8bdbe342fb40866931048 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 6477d1a65266583cd791adf10909d38cc36bd55c..59747ecaad54afea71305331a050f14983700154 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 9f4739452a2509950f68a10d1b5a567f9b931298..d53b625b14feb467a5c9b0e48049d4206ea41949 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 f54afd2113a9700d38fc2978055438e9013e8843..fd7c9eec92e4d75eba8aeb935d6dbcd2e122c1f7 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 9f6222895212606c97ef5a7a98092790f587832a..cbd0070265c9e07ff1c0f5a77eb067e1cbb83869 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 534227df23f355722e3ed6d1479bd60e12f75732..15a293e65b313a63d39ec45631e4c4c087f9ec21 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 6c76d125995bef3f20b566292aeeb7ad9122c86d..d893ea21a359226400d56920d663db3d2c4c1083 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 cf993dbf602ec22c0aefe8b36dc091837a07416c..5d96de40b63fb8813ba1200117f6f908d387f41a 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 0dee6acbd880a7175ede3de5ca25e91f9a23d058..a6799b0aa3d94232e0b80e9adc9f77e7a73b802f 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 4a21a745c373c323d0da1db9c268eb69fb7e5400..b24714976d240c532020d34523ce25ebf94ae9d3 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 e04efbed1a54f89e4277186405c2b46d59604d52..0b0d1cb11641517073a8822aeb7337f680634cfe 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 8f3ca526bd1bd43118e78e8bf8eea8a9181ed403..ff37ea585664572233331b95588afefa8711070d 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 e88fde18c9462e33996804c6f07b11bf8f5b3ccc..ebd5f4fe4c2307e9308551201fb6f7b7f124b350 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 d91856779bebca20a04f198da3ce486c907927e4..ab4e6cbe1f8b717fe6885e1d75fea89a89e786f7 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 0be55dc1ef4bbe748b6d66daff817093effd83d6..02504a7cfaf2125099af30cbd21261fab12ccc8e 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 912d5348e3e76ae55aab66dfe7eaca90237ff02f..cf583d4e3a9fdf7bcd1e65e66e13495d000f35ac 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 f022f438e5b93e1c408d102ee3f70d57a57a6c11..74476f55d05e98ea20da6eecc1d9ed06de51f3d6 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 296f541fbe2f121dd54694b6f5753d8d7ad17a2f..d90152e85ed0ff4afa9864d75942719e123c93b2 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 1443b3a34775cbcaca50532482cfa32fd3052671..b0b874264f9d84fad2ab4a183fd9f8be41bb4dfd 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 84d38eaea585757c151e4ccae4a2c72a952823cf..8855972303ecaac8b3862c86de7a208700f3bf9e 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 73c971e39b1c723f5e712dd85eb491a85ced2ac4..68fd167d7313e077f27fac62d90ed8f0468dcb7b 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 6fe161192bb4958eac8c9cd7161e247fcadeb885..2390c8577617adcb8061057d0260bbb717e53d64 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 3b807135a5cd8621fe1d40879749bec94dd3d3e2..78c6d8e9b42c1fc149b259baa62ace6ccdf0f3df 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 f0492603ea885d0767a375d782913c9da391cb62..38dd55f4af812fec3e7ef55104f7293344eea7e4 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 ae9839886c4d09ed78e706e4d1b7d843034bf434..a836451920f0f605c2616f5d2918dd34680beffd 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 6aead2013b625fab015163a3a0626b15ef9cab9a..80ecee9d52b89addc25bdf2f6407a3d6d9454706 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 b3c4ad605e81ba254f065e6ecade6263d9c924d8..aae723cd6d797ef64b25a50b9c758cfd3f3b8ffd 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 f418892b0c7127681a31acee118dbd2cad3405a2..c54138c3a3768f07962e2bed294e9d827f85681f 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 a9630c2d6cb335029ea7197fa39a30f6479e7205..b8be3ee4d3b8f968940b60b774ff60638ee2db77 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 147fb28287ae331561eb719a582a151e213b92ef..0f58a74f25d1d33b9f47849e1f6fa65a4280a77f 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 cc45d98f9bb5fb749071b2f0bd0e15e16e6cf423..cd8b01727734fef7f121bd1bd0c9ce97b471b2fc 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 8703f56b794774ac4130a7b487472e293ebe7cdf..eaf26d9b5f1115976dda7b81272b88c3c8fd9f0b 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 e5582bab7e3c926999088d848e5a37669cf1399b..9e0e5392b6ecb93cb1d6569c0eaaf7bacb48728f 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 5820b7020ae5ab07dad986ddf5fb91ac17a0ca43..04d98db75c64ac4c6978999e1a8cf89f5c40ac03 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 e336e3901876deefc983bd5b2db731f71bdd6847..a3effab98407c06d8c76633d6461f52fa3650493 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) */