drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor
Subsystems (3)
cover drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor
This patch updates the MIPI DBI driver to use drm_device.debugfs_root instead of drm_minor for creating debugfs files. The debugfs setup is now done earlier in probe(), before drm_dev_register(), and the drivers can avoid using the .debugfs_init callback.
This is an initial version, and only a few drivers are updated for now.
I noticed that some newer drivers or patches still use drm_debugfs_create_files(), which relies on drm_minor. I was wondering if there is a specific reason for this, or if there's a plan to switch to drm_debugfs_add_files? I can send patches to update more drivers if that helps.
This patch helps move toward the debugfs cleanup task listed here:
https://docs.kernel.org/gpu/todo.html#clean-up-the-debugfs-support
Looking forward to your feedback.
Jagath Jog J (1):
drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor and
.debugfs_init
drivers/gpu/drm/drm_mipi_dbi.c | 8 ++++---- drivers/gpu/drm/tiny/ili9163.c | 3 ++- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 3 ++- include/drm/drm_mipi_dbi.h | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-)
Signature · 1 line
2.20.1
RFC 1/1 drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor and .debugfs_init
Refactor to use drm_device.debugfs_root instead of drm_minor for debugfs file creation. The driver can now initialize debugfs directly in probe(), before drm_dev_register(). This also removes the use of .debugfs_init callback.
--- drivers/gpu/drm/drm_mipi_dbi.c | 8 ++++---- drivers/gpu/drm/tiny/ili9163.c | 3 ++- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 3 ++- include/drm/drm_mipi_dbi.h | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_mipi_dbi.c +4 -4
@@ -1488,17 +1488,17 @@ static const struct file_operations mipi_dbi_debugfs_command_fops = {* * This function creates a 'command' debugfs file for sending commands to the * controller or getting the read command values. -* Drivers can use this as their &drm_driver->debugfs_init callback. +* Drivers can call this function before registering their device to drm. * */ -void mipi_dbi_debugfs_init (struct drm_minor *minor) +void mipi_dbi_debugfs_init (struct mipi_dbi_dev *dbidev) { -struct mipi_dbi_dev *dbidev =drm_to_mipi_dbi_dev (minor->dev);umode_t mode =S_IFREG |S_IWUSR ;if (dbidev->dbi.read_commands) mode |=S_IRUGO ; -debugfs_create_file ("command" , mode, minor->debugfs_root, dbidev, + +debugfs_create_file ("command" , mode, dbidev->drm.debugfs_root, dbidev, &mipi_dbi_debugfs_command_fops); }EXPORT_SYMBOL (mipi_dbi_debugfs_init);
drivers/gpu/drm/tiny/ili9163.c +2 -1
@@ -115,7 +115,6 @@ static struct drm_driver ili9163_driver = { .fops = &ili9163_fops,DRM_GEM_DMA_DRIVER_OPS_VMAP ,DRM_FBDEV_DMA_DRIVER_OPS , - .debugfs_init = mipi_dbi_debugfs_init, .name = "ili9163", .desc = "Ilitek ILI9163", .major = 1,
@@ -182,6 +181,8 @@ static int ili9163_probe(struct spi_device *spi)drm_mode_config_reset (drm); +mipi_dbi_debugfs_init (dbidev); + ret =drm_dev_register (drm,0 );if (ret)return ret;
drivers/gpu/drm/tiny/panel-mipi-dbi.c +2 -1
@@ -267,7 +267,6 @@ static const struct drm_driver panel_mipi_dbi_driver = { .fops = &panel_mipi_dbi_fops,DRM_GEM_DMA_DRIVER_OPS_VMAP ,DRM_FBDEV_DMA_DRIVER_OPS , - .debugfs_init = mipi_dbi_debugfs_init, .name = "panel-mipi-dbi", .desc = "MIPI DBI compatible display panel", .major = 1,
@@ -384,6 +383,8 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)drm_mode_config_reset (drm); +mipi_dbi_debugfs_init (dbidev); + ret =drm_dev_register (drm,0 );if (ret)return ret;
include/drm/drm_mipi_dbi.h +2 -2
@@ -230,9 +230,9 @@ int mipi_dbi_buf_copy(void *dst, struct iosys_map *src, struct drm_framebuffer * })#ifdef CONFIG_DEBUG_FS -void mipi_dbi_debugfs_init (struct drm_minor *minor); +void mipi_dbi_debugfs_init (struct mipi_dbi_dev *dbidev);#else -static inline void mipi_dbi_debugfs_init (struct drm_minor *minor) {} +static inline void mipi_dbi_debugfs_init (struct mipi_dbi_dev *dbidev) {}#endif /**
Signature · 1 line
2.20.1
Re: [RFC 1/1] drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor and .debugfs_init
Quoted 4 lines · Jagath Jog J
Refactor to use drm_device.debugfs_root instead of
drm_minorfor debugfs file creation. The driver can now initialize debugfs directly inprobe(), beforedrm_dev_register(). This also removes the use of .debugfs_init callback.
Why? The callback was designed to add debugfs files. Likewise most if not all DRM drivers add files under the corresponding minor node.
Quoted 96 lines
Signed-off-by Jagath Jog J <[email protected]>--- drivers/gpu/drm/drm_mipi_dbi.c | 8 ++++---- drivers/gpu/drm/tiny/ili9163.c | 3 ++- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 3 ++- include/drm/drm_mipi_dbi.h | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-)drivers/gpu/drm/drm_mipi_dbi.c +4
-4@@ -1488,17 +1488,17 @@ static const struct file_operations mipi_dbi_debugfs_command_fops = {* * This function creates a 'command' debugfs file for sending commands to the * controller or getting the read command values. -* Drivers can use this as their &drm_driver->debugfs_init callback. +* Drivers can call this function before registering their device to drm. * */ -void mipi_dbi_debugfs_init (struct drm_minor *minor) +void mipi_dbi_debugfs_init (struct mipi_dbi_dev *dbidev) { -struct mipi_dbi_dev *dbidev =drm_to_mipi_dbi_dev (minor->dev);umode_t mode =S_IFREG |S_IWUSR ;if (dbidev->dbi.read_commands) mode |=S_IRUGO ; -debugfs_create_file ("command" , mode, minor->debugfs_root, dbidev, + +debugfs_create_file ("command" , mode, dbidev->drm.debugfs_root, dbidev, &mipi_dbi_debugfs_command_fops); }EXPORT_SYMBOL (mipi_dbi_debugfs_init);drivers/gpu/drm/tiny/ili9163.c +2
-1@@ -115,7 +115,6 @@ static struct drm_driver ili9163_driver = { .fops = &ili9163_fops,DRM_GEM_DMA_DRIVER_OPS_VMAP ,DRM_FBDEV_DMA_DRIVER_OPS , - .debugfs_init = mipi_dbi_debugfs_init, .name = "ili9163", .desc = "Ilitek ILI9163", .major = 1,@@ -182,6 +181,8 @@ static int ili9163_probe(struct spi_device *spi)drm_mode_config_reset (drm); +mipi_dbi_debugfs_init (dbidev); + ret =drm_dev_register (drm,0 );if (ret)return ret;drivers/gpu/drm/tiny/panel-mipi-dbi.c +2
-1@@ -267,7 +267,6 @@ static const struct drm_driver panel_mipi_dbi_driver = { .fops = &panel_mipi_dbi_fops,DRM_GEM_DMA_DRIVER_OPS_VMAP ,DRM_FBDEV_DMA_DRIVER_OPS , - .debugfs_init = mipi_dbi_debugfs_init, .name = "panel-mipi-dbi", .desc = "MIPI DBI compatible display panel", .major = 1,@@ -384,6 +383,8 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)drm_mode_config_reset (drm); +mipi_dbi_debugfs_init (dbidev); + ret =drm_dev_register (drm,0 );if (ret)return ret;include/drm/drm_mipi_dbi.h +2
-2@@ -230,9 +230,9 @@ int mipi_dbi_buf_copy(void *dst, struct iosys_map *src, struct drm_framebuffer * })#ifdef CONFIG_DEBUG_FS -void mipi_dbi_debugfs_init (struct drm_minor *minor); +void mipi_dbi_debugfs_init (struct mipi_dbi_dev *dbidev);#else -static inline void mipi_dbi_debugfs_init (struct drm_minor *minor) {} +static inline void mipi_dbi_debugfs_init (struct mipi_dbi_dev *dbidev) {}#endif /** Signature · 1 line
2.20.1
Signature · 2 lines
With best wishes Dmitry
Re: [RFC 1/1] drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor and .debugfs_init
Hi Dmitry
Thanks for the reply
Quoted 9 lines · Dmitry Baryshkov
Quoted 4 lines · Jagath Jog J
Refactor to use drm_device.debugfs_root instead of
drm_minorfor debugfs file creation. The driver can now initialize debugfs directly inprobe(), beforedrm_dev_register(). This also removes the use of .debugfs_init callback.Why? The callback was designed to add debugfs files. Likewise most if not all DRM drivers add files under the corresponding minor node.
My intention here was to follow the direction suggested in the DRM TODO list
https://docs.kernel.org/gpu/todo.html#clean-up-the-debugfs-support
It recommends using drm_device instead of drm_minor, transitioning towards drm_device.debugfs_root, and avoiding .debugfs_init. The RFC patch was an initial
step to gather feedback.
Related to this todo, some drivers use drm_debugfs_add_files() instead of drm_debugfs_create_files(). For example
hdlcd - https://patchwork.freedesktop.org/patch/msgid/[email protected]
v3d - https://patchwork.freedesktop.org/patch/msgid/[email protected]
https://elixir.bootlin.com/linux/v6.14.3/source/include/drm/drm_device.h#L92
Please let me know your thoughts on this.
Regards
Jagath
Quoted 101 lines
Quoted 95 lines
Signed-off-by Jagath Jog J <[email protected]>--- drivers/gpu/drm/drm_mipi_dbi.c | 8 ++++---- drivers/gpu/drm/tiny/ili9163.c | 3 ++- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 3 ++- include/drm/drm_mipi_dbi.h | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-)drivers/gpu/drm/drm_mipi_dbi.c +4
-4@@ -1488,17 +1488,17 @@ static const struct file_operations mipi_dbi_debugfs_command_fops = {* * This function creates a 'command' debugfs file for sending commands to the * controller or getting the read command values. -* Drivers can use this as their &drm_driver->debugfs_init callback. +* Drivers can call this function before registering their device to drm. * */ -void mipi_dbi_debugfs_init (struct drm_minor *minor) +void mipi_dbi_debugfs_init (struct mipi_dbi_dev *dbidev) { -struct mipi_dbi_dev *dbidev =drm_to_mipi_dbi_dev (minor->dev);umode_t mode =S_IFREG |S_IWUSR ;if (dbidev->dbi.read_commands) mode |=S_IRUGO ; -debugfs_create_file ("command" , mode, minor->debugfs_root, dbidev, + +debugfs_create_file ("command" , mode, dbidev->drm.debugfs_root, dbidev, &mipi_dbi_debugfs_command_fops); }EXPORT_SYMBOL (mipi_dbi_debugfs_init);drivers/gpu/drm/tiny/ili9163.c +2
-1@@ -115,7 +115,6 @@ static struct drm_driver ili9163_driver = { .fops = &ili9163_fops,DRM_GEM_DMA_DRIVER_OPS_VMAP ,DRM_FBDEV_DMA_DRIVER_OPS , - .debugfs_init = mipi_dbi_debugfs_init, .name = "ili9163", .desc = "Ilitek ILI9163", .major = 1,@@ -182,6 +181,8 @@ static int ili9163_probe(struct spi_device *spi)drm_mode_config_reset (drm); +mipi_dbi_debugfs_init (dbidev); + ret =drm_dev_register (drm,0 );if (ret)return ret;drivers/gpu/drm/tiny/panel-mipi-dbi.c +2
-1@@ -267,7 +267,6 @@ static const struct drm_driver panel_mipi_dbi_driver = { .fops = &panel_mipi_dbi_fops,DRM_GEM_DMA_DRIVER_OPS_VMAP ,DRM_FBDEV_DMA_DRIVER_OPS , - .debugfs_init = mipi_dbi_debugfs_init, .name = "panel-mipi-dbi", .desc = "MIPI DBI compatible display panel", .major = 1,@@ -384,6 +383,8 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)drm_mode_config_reset (drm); +mipi_dbi_debugfs_init (dbidev); + ret =drm_dev_register (drm,0 );if (ret)return ret;include/drm/drm_mipi_dbi.h +2
-3@@ -230,9 +230,9 @@ int mipi_dbi_buf_copy(void *dst, struct iosys_map *src, struct drm_framebuffer * })#ifdef CONFIG_DEBUG_FS -void mipi_dbi_debugfs_init (struct drm_minor *minor); +void mipi_dbi_debugfs_init (struct mipi_dbi_dev *dbidev);#else -static inline void mipi_dbi_debugfs_init (struct drm_minor *minor) {} +static inline void mipi_dbi_debugfs_init (struct mipi_dbi_dev *dbidev) {}#endif /** -- Quoted 2 lines
2.20.1
--
With best wishes
Dmitry
kernel test robot
build botRe: [RFC 1/1] drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor and .debugfs_init
In reply to Jagath Jog Jkernel test robot noticed the following build errors:
Hi Jagath,
[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.15-rc3 next-20250417]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jagath-Jog-J/drm-mipi-dbi-Use-drm_device-for-debugfs-drop-drm_minor-and-debugfs_init/20250421-170105 base: linus/master patch link: https://lore.kernel.org/r/20250421085907.24972-2-jagathjog1996%40gmail.com patch subject: [RFC 1/1] drm/mipi-dbi: Use drm_device for debugfs, drop drm_minor and .debugfs_init config: hexagon-randconfig-002-20250421 (https://download.01.org/0day-ci/archive/20250421/[email protected]/config) compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250421/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/tiny/ili9341.c:155:19: error: incompatible function pointer types initializing 'void (*)(struct drm_minor *)' with an expression of type 'void (struct mipi_dbi_dev *)' [-Wincompatible-function-pointer-types]
155 | .debugfs_init = mipi_dbi_debugfs_init,
| ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
--
>> drivers/gpu/drm/tiny/hx8357d.c:199:19: error: incompatible function pointer types initializing 'void (*)(struct drm_minor *)' with an expression of type 'void (struct mipi_dbi_dev *)' [-Wincompatible-function-pointer-types]
199 | .debugfs_init = mipi_dbi_debugfs_init,
| ^~~~~~~~~~~~~~~~~~~~~
1 error generated.
vim +155 drivers/gpu/drm/tiny/ili9341.c
3fa0e8f6f9609b drivers/gpu/drm/tinydrm/ili9341.c David Lechner 2018-05-25 149
70a59dd82959f8 drivers/gpu/drm/tiny/ili9341.c Simona Vetter 2020-11-04 150 static const struct drm_driver ili9341_driver = {
0424fdaf883a68 drivers/gpu/drm/tinydrm/ili9341.c Simona Vetter 2019-06-17 151 .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
3fa0e8f6f9609b drivers/gpu/drm/tinydrm/ili9341.c David Lechner 2018-05-25 152 .fops = &ili9341_fops,
4a83c26a1d8702 drivers/gpu/drm/tiny/ili9341.c Danilo Krummrich 2022-08-02 153 DRM_GEM_DMA_DRIVER_OPS_VMAP,
df0cc9eaff170e drivers/gpu/drm/tiny/ili9341.c Thomas Zimmermann 2024-09-24 154 DRM_FBDEV_DMA_DRIVER_OPS,
3fa0e8f6f9609b drivers/gpu/drm/tinydrm/ili9341.c David Lechner 2018-05-25 @155 .debugfs_init = mipi_dbi_debugfs_init,
3fa0e8f6f9609b drivers/gpu/drm/tinydrm/ili9341.c David Lechner 2018-05-25 156 .name = "ili9341",
3fa0e8f6f9609b drivers/gpu/drm/tinydrm/ili9341.c David Lechner 2018-05-25 157 .desc = "Ilitek ILI9341",
3fa0e8f6f9609b drivers/gpu/drm/tinydrm/ili9341.c David Lechner 2018-05-25 158 .major = 1,
3fa0e8f6f9609b drivers/gpu/drm/tinydrm/ili9341.c David Lechner 2018-05-25 159 .minor = 0,
3fa0e8f6f9609b drivers/gpu/drm/tinydrm/ili9341.c David Lechner 2018-05-25 160 };
3fa0e8f6f9609b drivers/gpu/drm/tinydrm/ili9341.c David Lechner 2018-05-25 161 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Jagath,
Quoted 5 lines · Jagath Jog J
This patch updates the MIPI DBI driver to use drm_device.debugfs_root instead of
drm_minorfor creating debugfs files. The debugfs setup is now done earlier inprobe(), beforedrm_dev_register(), and the drivers can avoid using the .debugfs_init callback.
Quoted 7 lines
This is an initial version, and only a few drivers are updated for now.
I noticed that some newer drivers or patches still use
drm_debugfs_create_files(), which relies ondrm_minor. I was wondering if there is a specific reason for this, or if there's a plan to switch todrm_debugfs_add_files? I can send patches to update more drivers if that helps.
Yes, there was a plan to switch to drm_debugfs_add_files(), as it centers the debugfs files management on the drm_device instead of drm_minor.
But, in the end, we concluded that we needed a few more changes in the infrastructure to make things more generic. Here are some discussions [1][2] and this was my plan to make things more generic [3], which needed some improvements.
It would be create if you help us to cleanup debugfs and feel free to use my patches as a base for it.
[1] https://lore.kernel.org/dri-devel/[email protected]/
[2] https://lore.kernel.org/dri-devel/[email protected]/
[3] https://lore.kernel.org/dri-devel/[email protected]/
Best Regards,
- Maíra
Quoted 16 lines
This patch helps move toward the debugfs cleanup task listed here:
https://docs.kernel.org/gpu/todo.html#clean-up-the-debugfs-supportLooking forward to your feedback.
Jagath Jog J (1):
drm/mipi-dbi: Usedrm_devicefor debugfs, dropdrm_minorand
.debugfs_initdrivers/gpu/drm/drm_mipi_dbi.c | 8 ++++---- drivers/gpu/drm/tiny/ili9163.c | 3 ++- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 3 ++- include/drm/drm_mipi_dbi.h | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-)
Hi Maíra,
Quoted 26 lines · Maíra Canal
Hi Jagath,
Quoted 5 lines · Jagath Jog J
This patch updates the MIPI DBI driver to use drm_device.debugfs_root instead of
drm_minorfor creating debugfs files. The debugfs setup is now done earlier inprobe(), beforedrm_dev_register(), and the drivers can avoid using the .debugfs_init callback.Quoted 7 lines
This is an initial version, and only a few drivers are updated for now.
I noticed that some newer drivers or patches still use
drm_debugfs_create_files(), which relies ondrm_minor. I was wondering if there is a specific reason for this, or if there's a plan to switch todrm_debugfs_add_files? I can send patches to update more drivers if that helps.Yes, there was a plan to switch to
drm_debugfs_add_files(), as it centers the debugfs files management on thedrm_deviceinstead ofdrm_minor.But, in the end, we concluded that we needed a few more changes in the infrastructure to make things more generic. Here are some discussions [1][2] and this was my plan to make things more generic [3], which needed some improvements.
Quoted 8 lines
It would be create if you help us to cleanup debugfs and feel free to use my patches as a base for it.
[1]
https://lore.kernel.org/dri-devel/[email protected]/
[2] https://lore.kernel.org/dri-devel/[email protected]/
[3]
https://lore.kernel.org/dri-devel/[email protected]/
Thanks for sharing the links. I had missed these discussions.
I will go through them and get back soon. Since these touch core DRM infra, I will study the changes more closely before proceeding.
Thanks for sharing your patches as a base, that should help a lot.
Regards
Jagath
Quoted 21 lines
Best Regards,
- MaíraQuoted 16 lines
This patch helps move toward the debugfs cleanup task listed here:
https://docs.kernel.org/gpu/todo.html#clean-up-the-debugfs-supportLooking forward to your feedback.
Jagath Jog J (1):
drm/mipi-dbi: Usedrm_devicefor debugfs, dropdrm_minorand
.debugfs_initdrivers/gpu/drm/drm_mipi_dbi.c | 8 ++++---- drivers/gpu/drm/tiny/ili9163.c | 3 ++- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 3 ++- include/drm/drm_mipi_dbi.h | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-)