mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 00:28:52 +02:00 
			
		
		
		
	 f2ede40e46
			
		
	
	
		f2ede40e46
		
	
	
	
	
		
			
			Currently, vc4 has its own debugfs infrastructure that adds the debugfs files on drm_dev_register(). With the introduction of the new debugfs, functions, replace the vc4 debugfs structure with the DRM debugfs device-centered function, drm_debugfs_add_file(). Moreover, remove the explicit error handling of debugfs related functions, considering that the only failure mode is -ENOMEM and also that error handling is not recommended for debugfs functions, as pointed out in [1]. [1] https://lore.kernel.org/all/YWAmZdRwnAt6wh9B@kroah.com/ Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Melissa Wen <mwen@igalia.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20221219120621.15086-5-mcanal@igalia.com
		
			
				
	
	
		
			58 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| // SPDX-License-Identifier: GPL-2.0-only
 | |
| /*
 | |
|  *  Copyright © 2014 Broadcom
 | |
|  */
 | |
| 
 | |
| #include <drm/drm_drv.h>
 | |
| 
 | |
| #include <linux/seq_file.h>
 | |
| #include <linux/circ_buf.h>
 | |
| #include <linux/ctype.h>
 | |
| #include <linux/debugfs.h>
 | |
| #include <linux/platform_device.h>
 | |
| 
 | |
| #include "vc4_drv.h"
 | |
| #include "vc4_regs.h"
 | |
| 
 | |
| /*
 | |
|  * Called at drm_dev_register() time on each of the minors registered
 | |
|  * by the DRM device, to attach the debugfs files.
 | |
|  */
 | |
| void
 | |
| vc4_debugfs_init(struct drm_minor *minor)
 | |
| {
 | |
| 	struct vc4_dev *vc4 = to_vc4_dev(minor->dev);
 | |
| 	struct drm_device *drm = &vc4->base;
 | |
| 
 | |
| 	drm_WARN_ON(drm, vc4_hvs_debugfs_init(minor));
 | |
| 
 | |
| 	if (vc4->v3d) {
 | |
| 		drm_WARN_ON(drm, vc4_bo_debugfs_init(minor));
 | |
| 		drm_WARN_ON(drm, vc4_v3d_debugfs_init(minor));
 | |
| 	}
 | |
| }
 | |
| 
 | |
| static int vc4_debugfs_regset32(struct seq_file *m, void *unused)
 | |
| {
 | |
| 	struct drm_debugfs_entry *entry = m->private;
 | |
| 	struct drm_device *drm = entry->dev;
 | |
| 	struct debugfs_regset32 *regset = entry->file.data;
 | |
| 	struct drm_printer p = drm_seq_file_printer(m);
 | |
| 	int idx;
 | |
| 
 | |
| 	if (!drm_dev_enter(drm, &idx))
 | |
| 		return -ENODEV;
 | |
| 
 | |
| 	drm_print_regset32(&p, regset);
 | |
| 
 | |
| 	drm_dev_exit(idx);
 | |
| 
 | |
| 	return 0;
 | |
| }
 | |
| 
 | |
| void vc4_debugfs_add_regset32(struct drm_device *drm,
 | |
| 			      const char *name,
 | |
| 			      struct debugfs_regset32 *regset)
 | |
| {
 | |
| 	drm_debugfs_add_file(drm, name, vc4_debugfs_regset32, regset);
 | |
| }
 |