[PATCH 1/8] drm/file: Define drm_show_fdinfo as NULL when CONFIG_PROC_FS is disabled

From: Fei Shao

Date: Thu Nov 26 2026 - 01:24:31 EST


Define drm_show_fdinfo() as NULL when CONFIG_PROC_FS is disabled
(matching drm_compat_ioctl() and drm_gem_get_unmapped_area()) and guard
its definition. This prepares for simplifying .show_fdinfo assignment in
the DEFINE_DRM_*_FOPS() helpers.

Signed-off-by: Fei Shao <fshao@xxxxxxxxxxxx>
---
drivers/gpu/drm/drm_file.c | 2 ++
include/drm/drm_file.h | 4 ++++
2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index ec820686b302..bcc1b47616c0 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -961,6 +961,7 @@ void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file)
}
EXPORT_SYMBOL(drm_show_memory_stats);

+#ifdef CONFIG_PROC_FS
/**
* drm_show_fdinfo - helper for drm file fops
* @m: output stream
@@ -1003,6 +1004,7 @@ void drm_show_fdinfo(struct seq_file *m, struct file *f)
drm_dev_exit(idx);
}
EXPORT_SYMBOL(drm_show_fdinfo);
+#endif

/**
* drm_file_err - log process name, pid and client_name associated with a drm_file
diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
index 6ee70ad65e1f..6fc3d7060f30 100644
--- a/include/drm/drm_file.h
+++ b/include/drm/drm_file.h
@@ -525,7 +525,11 @@ void drm_print_memory_stats(struct drm_printer *p,
const char *region);

void drm_show_memory_stats(struct drm_printer *p, struct drm_file *file);
+#ifdef CONFIG_PROC_FS
void drm_show_fdinfo(struct seq_file *m, struct file *f);
+#else
+#define drm_show_fdinfo NULL
+#endif

struct file *mock_drm_getfile(struct drm_minor *minor, unsigned int flags);


--
2.56.1.839.g22a8290db9-goog