diff mbox series

[v2,6/6] drm/debugfs: Make the struct drm_debugfs_entry independent of DRM device

Message ID 20230130123008.287141-7-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series drm/debugfs: Make the debugfs structure more generic | expand

Commit Message

Maíra Canal Jan. 30, 2023, 12:30 p.m. UTC
In order to turn the API more expansible to other DRM objects, such as
the struct drm_connector, make the struct drm_debugfs_entry hold a void
pointer and cast the void pointer to the struct drm_device when needed.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 drivers/gpu/drm/drm_debugfs.c | 4 ++--
 include/drm/drm_debugfs.h     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

kernel test robot Jan. 30, 2023, 7:32 p.m. UTC | #1
Hi Maíra,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on drm-intel/for-linux-next drm-tip/drm-tip]
[cannot apply to drm-intel/for-linux-next-fixes linus/master v6.2-rc6]
[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/Ma-ra-Canal/drm-debugfs-Introduce-wrapper-for-debugfs-list/20230130-203549
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20230130123008.287141-7-mcanal%40igalia.com
patch subject: [PATCH v2 6/6] drm/debugfs: Make the struct drm_debugfs_entry independent of DRM device
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20230131/202301310356.XzCDAfmm-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/2b098c9687b25368fa4a9e128963a13723aace67
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ma-ra-Canal/drm-debugfs-Introduce-wrapper-for-debugfs-list/20230130-203549
        git checkout 2b098c9687b25368fa4a9e128963a13723aace67
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/drm_gem_vram_helper.c:961:35: error: no member named 'dev' in 'struct drm_debugfs_entry'
           struct drm_vram_mm *vmm = entry->dev->vram_mm;
                                     ~~~~~  ^
   1 error generated.


vim +961 drivers/gpu/drm/drm_gem_vram_helper.c

6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  953  
6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  954  /*
6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  955   * struct drm_vram_mm
6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  956   */
6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  957  
6454c853ce9fa83 Maíra Canal       2023-01-30  958  static int drm_vram_mm_debugfs(struct seq_file *m, struct drm_device *dev, void *data)
6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  959  {
6fd80729f14e3f7 Maíra Canal       2022-12-19  960  	struct drm_debugfs_entry *entry = m->private;
6fd80729f14e3f7 Maíra Canal       2022-12-19 @961  	struct drm_vram_mm *vmm = entry->dev->vram_mm;
9de59bc201496f2 Dave Airlie       2020-08-04  962  	struct ttm_resource_manager *man = ttm_manager_type(&vmm->bdev, TTM_PL_VRAM);
6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  963  	struct drm_printer p = drm_seq_file_printer(m);
6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  964  
9de59bc201496f2 Dave Airlie       2020-08-04  965  	ttm_resource_manager_debug(man, &p);
6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  966  	return 0;
6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  967  }
6b5ce4a1fb84898 Thomas Zimmermann 2019-09-11  968
kernel test robot Jan. 30, 2023, 8:03 p.m. UTC | #2
Hi Maíra,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on drm-intel/for-linux-next drm-tip/drm-tip next-20230130]
[cannot apply to drm-intel/for-linux-next-fixes linus/master v6.2-rc6]
[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/Ma-ra-Canal/drm-debugfs-Introduce-wrapper-for-debugfs-list/20230130-203549
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20230130123008.287141-7-mcanal%40igalia.com
patch subject: [PATCH v2 6/6] drm/debugfs: Make the struct drm_debugfs_entry independent of DRM device
config: x86_64-rhel-8.3-kselftests (https://download.01.org/0day-ci/archive/20230131/202301310330.jVo5mu9t-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/2b098c9687b25368fa4a9e128963a13723aace67
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ma-ra-Canal/drm-debugfs-Introduce-wrapper-for-debugfs-list/20230130-203549
        git checkout 2b098c9687b25368fa4a9e128963a13723aace67
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/drm_gem_vram_helper.c: In function 'drm_vram_mm_debugfs':
>> drivers/gpu/drm/drm_gem_vram_helper.c:961:40: error: 'struct drm_debugfs_entry' has no member named 'dev'
     961 |         struct drm_vram_mm *vmm = entry->dev->vram_mm;
         |                                        ^~


vim +961 drivers/gpu/drm/drm_gem_vram_helper.c

6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  953  
6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  954  /*
6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  955   * struct drm_vram_mm
6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  956   */
6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  957  
6454c853ce9fa8 Maíra Canal       2023-01-30  958  static int drm_vram_mm_debugfs(struct seq_file *m, struct drm_device *dev, void *data)
6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  959  {
6fd80729f14e3f Maíra Canal       2022-12-19  960  	struct drm_debugfs_entry *entry = m->private;
6fd80729f14e3f Maíra Canal       2022-12-19 @961  	struct drm_vram_mm *vmm = entry->dev->vram_mm;
9de59bc201496f Dave Airlie       2020-08-04  962  	struct ttm_resource_manager *man = ttm_manager_type(&vmm->bdev, TTM_PL_VRAM);
6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  963  	struct drm_printer p = drm_seq_file_printer(m);
6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  964  
9de59bc201496f Dave Airlie       2020-08-04  965  	ttm_resource_manager_debug(man, &p);
6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  966  	return 0;
6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  967  }
6b5ce4a1fb8489 Thomas Zimmermann 2019-09-11  968
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 21f01c7d0ab1..f12c3fdf61bb 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -141,7 +141,7 @@  static int drm_debugfs_dev_show(struct seq_file *m, void *unused)
 	struct drm_debugfs_entry *entry = m->private;
 	int (*show)(struct seq_file *, struct drm_device *, void *) = entry->file.show;
 
-	return show(m, entry->dev, entry->file.data);
+	return show(m, entry->object, entry->file.data);
 }
 
 static int drm_debugfs_open(struct inode *inode, struct file *file)
@@ -362,7 +362,7 @@  void drm_debugfs_add_file(struct drm_device *dev, const char *name,
 	entry->file.name = name;
 	entry->file.show = show;
 	entry->file.data = data;
-	entry->dev = dev;
+	entry->object = dev;
 
 	drm_debugfs_files_add(dev->debugfs_files, &entry->list);
 }
diff --git a/include/drm/drm_debugfs.h b/include/drm/drm_debugfs.h
index 0fb7ad5f6893..4ab0557f55e0 100644
--- a/include/drm/drm_debugfs.h
+++ b/include/drm/drm_debugfs.h
@@ -130,8 +130,8 @@  struct drm_debugfs_info {
  * drm_debugfs_info on a &struct drm_device.
  */
 struct drm_debugfs_entry {
-	/** @dev: &struct drm_device for this node. */
-	struct drm_device *dev;
+	/** @object: The DRM object that owns this node. */
+	void *object;
 
 	/** @file: Template for this node. */
 	struct drm_debugfs_info file;