Wire drm_show_fdinfo() into DEFINE_DRM_*_FOPS() in the DRM headers, so
drivers using the default fops helpers support showing standard fdinfo
out of the box.

Signed-off-by: Fei Shao <[email protected]>
---
 include/drm/drm_accel.h          | 1 +
 include/drm/drm_gem.h            | 2 ++
 include/drm/drm_gem_dma_helper.h | 1 +
 3 files changed, 4 insertions(+)

diff --git a/include/drm/drm_accel.h b/include/drm/drm_accel.h
index 20a665ec6f16..1f3088002e52 100644
--- a/include/drm/drm_accel.h
+++ b/include/drm/drm_accel.h
@@ -48,6 +48,7 @@
        static const struct file_operations name = {\
                .owner          = THIS_MODULE,\
                DRM_ACCEL_FOPS,\
+               .show_fdinfo    = drm_show_fdinfo,\
        }
 
 #if IS_ENABLED(CONFIG_DRM_ACCEL)
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 56dd15921c7a..d0c30bf23e58 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -43,6 +43,7 @@
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 #include <drm/drm_device.h>
 #endif
+#include <drm/drm_file.h>
 #include <drm/drm_vma_manager.h>
 
 struct iosys_map;
@@ -501,6 +502,7 @@ struct drm_gem_object {
        static const struct file_operations name = {\
                .owner          = THIS_MODULE,\
                DRM_GEM_FOPS,\
+               .show_fdinfo    = drm_show_fdinfo,\
        }
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
diff --git a/include/drm/drm_gem_dma_helper.h b/include/drm/drm_gem_dma_helper.h
index f2678e7ecb98..3fc22b426070 100644
--- a/include/drm/drm_gem_dma_helper.h
+++ b/include/drm/drm_gem_dma_helper.h
@@ -267,6 +267,7 @@ unsigned long drm_gem_dma_get_unmapped_area(struct file 
*filp,
                .read           = drm_read,\
                .llseek         = noop_llseek,\
                .mmap           = drm_gem_mmap,\
+               .show_fdinfo    = drm_show_fdinfo,\
                .fop_flags = FOP_UNSIGNED_OFFSET, \
                DRM_GEM_DMA_UNMAPPED_AREA_FOPS \
        }

-- 
2.56.1.839.g22a8290db9-goog

Reply via email to