DRM debugfs cleanup take 5 (resend)
Subsystems (5)
Hi guys,
sorry for the delay, just sending it out to the list once more to get some acks and rbs.
Apart from that the CI systems seems to be happy with that and I think it can get merged now.
Regards,
Christian.
PATCH 1/5 drm/debugfs: drop debugfs_init() for the render and accel node v2
We want to remove per minor debugfs directories. Start by stopping drivers from adding anything inside of those in the mid layer callback.
v2: drop it for the accel node as well
--- drivers/accel/drm_accel.c | 3 --- drivers/gpu/drm/drm_debugfs.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/accel/drm_accel.c +0 -3
@@ -99,9 +99,6 @@ void accel_debugfs_init(struct drm_minor *minor, int minor_id)drm_debugfs_create_files (accel_debugfs_list,ACCEL_DEBUGFS_ENTRIES , minor->debugfs_root, minor); - -if (dev->driver->debugfs_init) - dev->driver->debugfs_init (minor); }/**
drivers/gpu/drm/drm_debugfs.c +1 -1
@@ -242,7 +242,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,drm_client_debugfs_init (minor); } -if (dev->driver->debugfs_init) +if (dev->driver->debugfs_init && dev->render != minor) dev->driver->debugfs_init (minor);list_for_each_entry_safe (entry, tmp, &dev->debugfs_list, list) {
Signature · 1 line
2.34.1
PATCH 2/5 drm/debugfs: disallow debugfs access when device isn't registered
In reply to Christian KönigDuring device bringup it might be that we can't access the debugfs files. Return -ENODEV until the registration is completed on access.
--- drivers/gpu/drm/drm_debugfs.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_debugfs.c +7 -0
@@ -148,6 +148,9 @@ static int drm_debugfs_open(struct inode *inode, struct file *file) {struct drm_info_node *node = inode->i_private; +if (!device_is_registered (node->minor->kdev)) +return -ENODEV ; +return single_open (file, node->info_ent->show, node); }
@@ -155,6 +158,10 @@ static int drm_debugfs_entry_open(struct inode *inode, struct file *file) {struct drm_debugfs_entry *entry = inode->i_private;struct drm_debugfs_info *node = &entry->file; +struct drm_minor *minor = entry->dev->primary ?: entry->dev->accel; + +if (!device_is_registered (minor->kdev)) +return -ENODEV ;return single_open (file, node->show, entry); }
Signature · 1 line
2.34.1
PATCH 3/5 drm/debugfs: rework debugfs directory creation v4
In reply to Christian KönigInstead of the per minor directories only create a single debugfs directory for the whole device directly when the device is initialized.
For DRM devices each minor gets a symlink to the per device directory for now until we can be sure that this isn't useful any more in any way.
Accel devices create only the per device directory and also drops the mid layer callback to create driver specific files.
v2: cleanup accel component as well
v3: fix typo when debugfs is disabled
v4: call drm_debugfs_dev_fini() during release as well,
some kerneldoc typos fixed
--- drivers/accel/drm_accel.c | 27 +++++++---- drivers/gpu/drm/drm_atomic.c | 4 +- drivers/gpu/drm/drm_client.c | 4 +- drivers/gpu/drm/drm_crtc_internal.h | 2 +- drivers/gpu/drm/drm_debugfs.c | 73 ++++++++++++++++++++--------- drivers/gpu/drm/drm_drv.c | 21 +++++++-- drivers/gpu/drm/drm_framebuffer.c | 4 +- drivers/gpu/drm/drm_internal.h | 20 ++++++-- include/drm/drm_accel.h | 9 +++- include/drm/drm_client.h | 2 +- include/drm/drm_device.h | 7 +++ include/drm/drm_drv.h | 8 ++++ include/drm/drm_file.h | 1 + 13 files changed, 130 insertions(+), 52 deletions(-)
drivers/accel/drm_accel.c +17 -10
@@ -79,26 +79,33 @@ static const struct drm_info_list accel_debugfs_list[] = {#define ACCEL_DEBUGFS_ENTRIES ARRAY_SIZE(accel_debugfs_list)/** -* accel_debugfs_init() - Initialize debugfs for accel minor +* accel_debugfs_init() - Initialize debugfs for device +* @dev: Pointer to the device instance. +* +* This function creates a root directory for the device in debugfs. +*/ +void accel_debugfs_init (struct drm_device *dev) +{ +drm_debugfs_dev_init (dev, accel_debugfs_root); +} + +/** +* accel_debugfs_register() - Register debugfs for device * @minor: Pointer to the drm_minor instance. * @minor_id: The minor's id * -* This function initializes the drm minor's debugfs members and creates -* a root directory for the minor in debugfs. It also creates common files -* for accelerators and calls the driver's debugfs init callback. +* Creates common files for accelerators. */ -void accel_debugfs_init (struct drm_minor *minor,int minor_id) +void accel_debugfs_register (struct drm_device *dev) { -struct drm_device *dev = minor->dev; -char name[64 ]; +struct drm_minor *minor = dev->accel;INIT_LIST_HEAD (&minor->debugfs_list);mutex_init (&minor->debugfs_lock); -sprintf (name,"%d" , minor_id); - minor->debugfs_root =debugfs_create_dir (name, accel_debugfs_root); + minor->debugfs_root = dev->debugfs_root;drm_debugfs_create_files (accel_debugfs_list,ACCEL_DEBUGFS_ENTRIES , - minor->debugfs_root, minor); + dev->debugfs_root, minor); }/**
drivers/gpu/drm/drm_atomic.c +2 -2
@@ -1832,9 +1832,9 @@ static const struct drm_debugfs_info drm_atomic_debugfs_list[] = { {"state", drm_state_info, 0}, }; -void drm_atomic_debugfs_init(struct drm_minor *minor) +void drm_atomic_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_atomic_debugfs_list, + drm_debugfs_add_files(dev, drm_atomic_debugfs_list, ARRAY_SIZE(drm_atomic_debugfs_list)); } #endif
drivers/gpu/drm/drm_client.c +2 -2
@@ -514,9 +514,9 @@ static const struct drm_debugfs_info drm_client_debugfs_list[] = { { "internal_clients", drm_client_debugfs_internal_clients, 0 }, }; -void drm_client_debugfs_init(struct drm_minor *minor) +void drm_client_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_client_debugfs_list, + drm_debugfs_add_files(dev, drm_client_debugfs_list, ARRAY_SIZE(drm_client_debugfs_list)); } #endif
drivers/gpu/drm/drm_crtc_internal.h +1 -1
@@ -232,7 +232,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,/* drm_atomic.c */ #ifdef CONFIG_DEBUG_FS struct drm_minor ; -void drm_atomic_debugfs_init (struct drm_minor *minor); +void drm_atomic_debugfs_init (struct drm_device *dev);#endif int __drm_atomic_helper_disable_plane(struct drm_plane *plane,
drivers/gpu/drm/drm_debugfs.c +50 -23
117 lines not on this page · raw message
drivers/gpu/drm/drm_drv.c +17 -4
@@ -172,10 +172,9 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)if (!minor)return 0 ; -if (minor->type ==DRM_MINOR_ACCEL ) { -accel_debugfs_init (minor, minor->index); - }else { - ret =drm_debugfs_init (minor, minor->index, drm_debugfs_root); +if (minor->type !=DRM_MINOR_ACCEL ) { + ret =drm_debugfs_register (minor, minor->index, + drm_debugfs_root);if (ret) {DRM_ERROR ("DRM: Failed to initialize /sys/kernel/debug/dri.\n" ); goto err_debugfs;
@@ -697,6 +696,11 @@ static int drm_dev_init(struct drm_device *dev, goto err; } +if (drm_core_check_feature (dev,DRIVER_COMPUTE_ACCEL )) +accel_debugfs_init (dev); +else +drm_debugfs_dev_init (dev, drm_debugfs_root); +return 0 ; err:
@@ -786,6 +790,9 @@ static void drm_dev_release(struct kref *ref) { struct drm_device *dev = container_of(ref, struct drm_device, ref); +/* Just in case register/unregister was never called */ +drm_debugfs_dev_fini (dev); +if (dev->driver->release) dev->driver->release (dev);
@@ -916,6 +923,11 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)if (drm_dev_needs_global_mutex (dev))mutex_lock (&drm_global_mutex); +if (drm_core_check_feature (dev,DRIVER_COMPUTE_ACCEL )) +accel_debugfs_register (dev); +else +drm_debugfs_dev_register (dev); + ret =drm_minor_register (dev,DRM_MINOR_RENDER );if (ret) goto err_minors;
@@ -1001,6 +1013,7 @@ void drm_dev_unregister(struct drm_device *dev)drm_minor_unregister (dev,DRM_MINOR_ACCEL );drm_minor_unregister (dev,DRM_MINOR_PRIMARY );drm_minor_unregister (dev,DRM_MINOR_RENDER ); +drm_debugfs_dev_fini (dev); }EXPORT_SYMBOL (drm_dev_unregister);
drivers/gpu/drm/drm_framebuffer.c +2 -2
@@ -1222,9 +1222,9 @@ static const struct drm_debugfs_info drm_framebuffer_debugfs_list[] = { { "framebuffer", drm_framebuffer_info, 0 }, }; -void drm_framebuffer_debugfs_init(struct drm_minor *minor) +void drm_framebuffer_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_framebuffer_debugfs_list, + drm_debugfs_add_files(dev, drm_framebuffer_debugfs_list, ARRAY_SIZE(drm_framebuffer_debugfs_list)); } #endif
drivers/gpu/drm/drm_internal.h +15 -5
@@ -180,8 +180,10 @@ void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map);/* drm_debugfs.c drm_debugfs_crc.c */ #if defined(CONFIG_DEBUG_FS ) -int drm_debugfs_init (struct drm_minor *minor,int minor_id, -struct dentry *root); +void drm_debugfs_dev_fini (struct drm_device *dev); +void drm_debugfs_dev_register (struct drm_device *dev); +int drm_debugfs_register (struct drm_minor *minor,int minor_id, +struct dentry *root);void drm_debugfs_cleanup (struct drm_minor *minor);void drm_debugfs_late_register (struct drm_device *dev);void drm_debugfs_connector_add (struct drm_connector *connector);
@@ -190,8 +192,16 @@ void drm_debugfs_crtc_add(struct drm_crtc *crtc);void drm_debugfs_crtc_remove (struct drm_crtc *crtc);void drm_debugfs_crtc_crc_add (struct drm_crtc *crtc);#else -static inline int drm_debugfs_init (struct drm_minor *minor,int minor_id, -struct dentry *root) +static inline void drm_debugfs_dev_fini (struct drm_device *dev) +{ +} + +static inline void drm_debugfs_dev_register (struct drm_device *dev) +{ +} + +static inline int drm_debugfs_register (struct drm_minor *minor,int minor_id, +struct dentry *root) {return 0 ; }
@@ -257,4 +267,4 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,/* drm_framebuffer.c */ void drm_framebuffer_print_info (struct drm_printer *p,unsigned int indent,const struct drm_framebuffer *fb); -void drm_framebuffer_debugfs_init (struct drm_minor *minor); +void drm_framebuffer_debugfs_init (struct drm_device *dev);
include/drm/drm_accel.h +7 -2
@@ -58,7 +58,8 @@ int accel_minor_alloc(void);void accel_minor_replace (struct drm_minor *minor,int index);void accel_set_device_instance_params (struct device *kdev,int index);int accel_open (struct inode *inode,struct file *filp); -void accel_debugfs_init (struct drm_minor *minor,int minor_id); +void accel_debugfs_init (struct drm_device *dev); +void accel_debugfs_register (struct drm_device *dev);#else
@@ -89,7 +90,11 @@ static inline void accel_set_device_instance_params(struct device *kdev, int ind { } -static inline void accel_debugfs_init (struct drm_minor *minor,int minor_id) +static inline void accel_debugfs_init (struct drm_device *dev) +{ +} + +static inline void accel_debugfs_register (struct drm_device *dev) { }
include/drm/drm_client.h +1 -1
@@ -195,6 +195,6 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode); drm_for_each_connector_iter(connector, iter) \if (connector->connector_type !=DRM_MODE_CONNECTOR_WRITEBACK ) -void drm_client_debugfs_init(struct drm_minor *minor); +void drm_client_debugfs_init(struct drm_device *dev);#endif
include/drm/drm_device.h +7 -0
@@ -311,6 +311,13 @@ struct drm_device {*/ struct drm_fb_helper *fb_helper; +/** +* @debugfs_root: +* +* Root directory for debugfs files. +*/ +struct dentry *debugfs_root; +/** * @debugfs_mutex: *
include/drm/drm_drv.h +8 -0
@@ -575,4 +575,12 @@ static inline bool drm_firmware_drivers_only(void) return video_firmware_drivers_only(); } +#if defined(CONFIG_DEBUG_FS ) +void drm_debugfs_dev_init (struct drm_device *dev,struct dentry *root); +#else +static void drm_debugfs_dev_init (struct drm_device *dev,struct dentry *root) +{ +} +#endif +#endif
include/drm/drm_file.h +1 -0
@@ -79,6 +79,7 @@ struct drm_minor {struct device *kdev;/* Linux device */ struct drm_device *dev; +struct dentry *debugfs_symlink;struct dentry *debugfs_root;struct list_head debugfs_list;
Signature · 1 line
2.34.1
Re: [PATCH 3/5] drm/debugfs: rework debugfs directory creation v4
Quoted 44 lines · Christian König
Instead of the per minor directories only create a single debugfs directory for the whole device directly when the device is initialized.
For DRM devices each minor gets a symlink to the per device directory for now until we can be sure that this isn't useful any more in any way.
Accel devices create only the per device directory and also drops the mid layer callback to create driver specific files.
v2: cleanup accel component as well
v3: fix typo when debugfs is disabled
v4: calldrm_debugfs_dev_fini()during release as well,
some kerneldoc typos fixedSigned-off-by Christian König <[email protected]>--- drivers/accel/drm_accel.c | 27 +++++++---- drivers/gpu/drm/drm_atomic.c | 4 +- drivers/gpu/drm/drm_client.c | 4 +- drivers/gpu/drm/drm_crtc_internal.h | 2 +- drivers/gpu/drm/drm_debugfs.c | 73 ++++++++++++++++++++--------- drivers/gpu/drm/drm_drv.c | 21 +++++++-- drivers/gpu/drm/drm_framebuffer.c | 4 +- drivers/gpu/drm/drm_internal.h | 20 ++++++-- include/drm/drm_accel.h | 9 +++- include/drm/drm_client.h | 2 +- include/drm/drm_device.h | 7 +++ include/drm/drm_drv.h | 8 ++++ include/drm/drm_file.h | 1 + 13 files changed, 130 insertions(+), 52 deletions(-)drivers/accel/drm_accel.c +4
-1@@ -79,26 +79,33 @@ static const struct drm_info_list accel_debugfs_list[] = {#define ACCEL_DEBUGFS_ENTRIES ARRAY_SIZE(accel_debugfs_list)/** -* accel_debugfs_init() - Initialize debugfs for accel minor +* accel_debugfs_init() - Initialize debugfs for device +* @dev: Pointer to the device instance. +* +* This function creates a root directory for the device in debugfs.
drivers/accel/drm_accel.c static const struct drm_info_list accel_debugfs_list[] = { · line 95
Quoted 10 lines
drivers/accel/drm_accel.c +8
-0+*/ +void accel_debugfs_init (struct drm_device *dev) +{ +drm_debugfs_dev_init (dev, accel_debugfs_root); +} + +/** +* accel_debugfs_register() - Register debugfs for device * @minor: Pointer to the drm_minor instance. * @minor_id: The minor's id
Sorry that I missed that in the previous review, but 'minor' and 'minor_id' should be replaced with 'dev'.
Thanks,
Tomer
Quoted 401 lines
drivers/accel/drm_accel.c +5
-9* -* This function initializes the drm minor's debugfs members and creates -* a root directory for the minor in debugfs. It also creates common files -* for accelerators and calls the driver's debugfs init callback. +* Creates common files for accelerators. */ -void accel_debugfs_init (struct drm_minor *minor,int minor_id) +void accel_debugfs_register (struct drm_device *dev) { -struct drm_device *dev = minor->dev; -char name[64 ]; +struct drm_minor *minor = dev->accel;INIT_LIST_HEAD (&minor->debugfs_list);mutex_init (&minor->debugfs_lock); -sprintf (name,"%d" , minor_id); - minor->debugfs_root =debugfs_create_dir (name, accel_debugfs_root); + minor->debugfs_root = dev->debugfs_root;drm_debugfs_create_files (accel_debugfs_list,ACCEL_DEBUGFS_ENTRIES , - minor->debugfs_root, minor); + dev->debugfs_root, minor); }/** drivers/gpu/drm/drm_atomic.c +2
-2@@ -1832,9 +1832,9 @@ static const struct drm_debugfs_info drm_atomic_debugfs_list[] = { {"state", drm_state_info, 0}, }; -void drm_atomic_debugfs_init(struct drm_minor *minor) +void drm_atomic_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_atomic_debugfs_list, + drm_debugfs_add_files(dev, drm_atomic_debugfs_list, ARRAY_SIZE(drm_atomic_debugfs_list)); } #endifdrivers/gpu/drm/drm_client.c +2
-2@@ -514,9 +514,9 @@ static const struct drm_debugfs_info drm_client_debugfs_list[] = { { "internal_clients", drm_client_debugfs_internal_clients, 0 }, }; -void drm_client_debugfs_init(struct drm_minor *minor) +void drm_client_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_client_debugfs_list, + drm_debugfs_add_files(dev, drm_client_debugfs_list, ARRAY_SIZE(drm_client_debugfs_list)); } #endifdrivers/gpu/drm/drm_crtc_internal.h +1
-1@@ -232,7 +232,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,/* drm_atomic.c */ #ifdef CONFIG_DEBUG_FS struct drm_minor ; -void drm_atomic_debugfs_init (struct drm_minor *minor); +void drm_atomic_debugfs_init (struct drm_device *dev);#endif int __drm_atomic_helper_disable_plane(struct drm_plane *plane,drivers/gpu/drm/drm_debugfs.c +50
-23@@ -225,8 +225,44 @@ void drm_debugfs_create_files(const struct drm_info_list *files, int count, }EXPORT_SYMBOL (drm_debugfs_create_files); -int drm_debugfs_init (struct drm_minor *minor,int minor_id, -struct dentry *root) +/** +* drm_debugfs_dev_init - create debugfs directory for the device +* @dev: the device which we want to create the directory for +* @root: the parent directory depending on the device type +* +* Creates the debugfs directory for the device under the given root directory. +*/ +void drm_debugfs_dev_init (struct drm_device *dev,struct dentry *root) +{ + dev->debugfs_root =debugfs_create_dir (dev->unique, root); +} + +/** +* drm_debugfs_dev_fini - cleanup debugfs directory +* @dev: the device to cleanup the debugfs stuff +* +* Remove the debugfs directory, might be called multiple times. +*/ +void drm_debugfs_dev_fini (struct drm_device *dev) +{ +debugfs_remove_recursive (dev->debugfs_root); + dev->debugfs_root =NULL ; +} + +void drm_debugfs_dev_register (struct drm_device *dev) +{ +drm_debugfs_add_files (dev, drm_debugfs_list,DRM_DEBUGFS_ENTRIES ); + +if (drm_core_check_feature (dev,DRIVER_MODESET )) { +drm_framebuffer_debugfs_init (dev); +drm_client_debugfs_init (dev); + } +if (drm_drv_uses_atomic_modeset (dev)) +drm_atomic_debugfs_init (dev); +} + +int drm_debugfs_register (struct drm_minor *minor,int minor_id, +struct dentry *root) {struct drm_device *dev = minor->dev;struct drm_debugfs_entry *entry, *tmp;@@ -235,19 +271,11 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,INIT_LIST_HEAD (&minor->debugfs_list);mutex_init (&minor->debugfs_lock);sprintf (name,"%d" , minor_id); - minor->debugfs_root =debugfs_create_dir (name, root); - -drm_debugfs_add_files (minor->dev, drm_debugfs_list,DRM_DEBUGFS_ENTRIES ); + minor->debugfs_symlink =debugfs_create_symlink (name, root, + dev->unique); -if (drm_drv_uses_atomic_modeset (dev)) { -drm_atomic_debugfs_init (minor); - } - -if (drm_core_check_feature (dev,DRIVER_MODESET )) { -drm_framebuffer_debugfs_init (minor); - -drm_client_debugfs_init (minor); - } +/* TODO: Only for compatibility with drivers */ + minor->debugfs_root = dev->debugfs_root;if (dev->driver->debugfs_init && dev->render != minor) dev->driver->debugfs_init (minor);@@ -314,13 +342,12 @@ static void drm_debugfs_remove_all_files(struct drm_minor *minor)void drm_debugfs_cleanup (struct drm_minor *minor) { -if (!minor->debugfs_root) +if (!minor->debugfs_symlink)return ;drm_debugfs_remove_all_files (minor); - -debugfs_remove_recursive (minor->debugfs_root); - minor->debugfs_root =NULL ; +debugfs_remove (minor->debugfs_symlink); + minor->debugfs_symlink =NULL ; }/** @@ -505,13 +532,13 @@ static const struct file_operations drm_connector_fops = {void drm_debugfs_connector_add (struct drm_connector *connector) { -struct drm_minor *minor = connector->dev->primary; +struct drm_device *dev = connector->dev;struct dentry *root; -if (!minor->debugfs_root) +if (!dev->debugfs_root)return ; - root =debugfs_create_dir (connector->name, minor->debugfs_root); + root =debugfs_create_dir (connector->name, dev->debugfs_root); connector->debugfs_entry = root;/* force */ @@ -546,7 +573,7 @@ void drm_debugfs_connector_remove(struct drm_connector *connector)void drm_debugfs_crtc_add (struct drm_crtc *crtc) { -struct drm_minor *minor = crtc->dev->primary; +struct drm_device *dev = crtc->dev;struct dentry *root;char *name;@@ -554,7 +581,7 @@ void drm_debugfs_crtc_add(struct drm_crtc *crtc)if (!name)return ; - root =debugfs_create_dir (name, minor->debugfs_root); + root =debugfs_create_dir (name, dev->debugfs_root);kfree (name); crtc->debugfs_entry = root;drivers/gpu/drm/drm_drv.c +17
-4@@ -172,10 +172,9 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)if (!minor)return 0 ; -if (minor->type ==DRM_MINOR_ACCEL ) { -accel_debugfs_init (minor, minor->index); - }else { - ret =drm_debugfs_init (minor, minor->index, drm_debugfs_root); +if (minor->type !=DRM_MINOR_ACCEL ) { + ret =drm_debugfs_register (minor, minor->index, + drm_debugfs_root);if (ret) {DRM_ERROR ("DRM: Failed to initialize /sys/kernel/debug/dri.\n" ); goto err_debugfs;@@ -697,6 +696,11 @@ static int drm_dev_init(struct drm_device *dev, goto err; } +if (drm_core_check_feature (dev,DRIVER_COMPUTE_ACCEL )) +accel_debugfs_init (dev); +else +drm_debugfs_dev_init (dev, drm_debugfs_root); +return 0 ; err:@@ -786,6 +790,9 @@ static void drm_dev_release(struct kref *ref) { struct drm_device *dev = container_of(ref, struct drm_device, ref); +/* Just in case register/unregister was never called */ +drm_debugfs_dev_fini (dev); +if (dev->driver->release) dev->driver->release (dev);@@ -916,6 +923,11 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)if (drm_dev_needs_global_mutex (dev))mutex_lock (&drm_global_mutex); +if (drm_core_check_feature (dev,DRIVER_COMPUTE_ACCEL )) +accel_debugfs_register (dev); +else +drm_debugfs_dev_register (dev); + ret =drm_minor_register (dev,DRM_MINOR_RENDER );if (ret) goto err_minors;@@ -1001,6 +1013,7 @@ void drm_dev_unregister(struct drm_device *dev)drm_minor_unregister (dev,DRM_MINOR_ACCEL );drm_minor_unregister (dev,DRM_MINOR_PRIMARY );drm_minor_unregister (dev,DRM_MINOR_RENDER ); +drm_debugfs_dev_fini (dev); }EXPORT_SYMBOL (drm_dev_unregister);drivers/gpu/drm/drm_framebuffer.c +2
-2@@ -1222,9 +1222,9 @@ static const struct drm_debugfs_info drm_framebuffer_debugfs_list[] = { { "framebuffer", drm_framebuffer_info, 0 }, }; -void drm_framebuffer_debugfs_init(struct drm_minor *minor) +void drm_framebuffer_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_framebuffer_debugfs_list, + drm_debugfs_add_files(dev, drm_framebuffer_debugfs_list, ARRAY_SIZE(drm_framebuffer_debugfs_list)); } #endifdrivers/gpu/drm/drm_internal.h +15
-5@@ -180,8 +180,10 @@ void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map);/* drm_debugfs.c drm_debugfs_crc.c */ #if defined(CONFIG_DEBUG_FS ) -int drm_debugfs_init (struct drm_minor *minor,int minor_id, -struct dentry *root); +void drm_debugfs_dev_fini (struct drm_device *dev); +void drm_debugfs_dev_register (struct drm_device *dev); +int drm_debugfs_register (struct drm_minor *minor,int minor_id, +struct dentry *root);void drm_debugfs_cleanup (struct drm_minor *minor);void drm_debugfs_late_register (struct drm_device *dev);void drm_debugfs_connector_add (struct drm_connector *connector);@@ -190,8 +192,16 @@ void drm_debugfs_crtc_add(struct drm_crtc *crtc);void drm_debugfs_crtc_remove (struct drm_crtc *crtc);void drm_debugfs_crtc_crc_add (struct drm_crtc *crtc);#else -static inline int drm_debugfs_init (struct drm_minor *minor,int minor_id, -struct dentry *root) +static inline void drm_debugfs_dev_fini (struct drm_device *dev) +{ +} + +static inline void drm_debugfs_dev_register (struct drm_device *dev) +{ +} + +static inline int drm_debugfs_register (struct drm_minor *minor,int minor_id, +struct dentry *root) {return 0 ; }@@ -257,4 +267,4 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,/* drm_framebuffer.c */ void drm_framebuffer_print_info (struct drm_printer *p,unsigned int indent,const struct drm_framebuffer *fb); -void drm_framebuffer_debugfs_init (struct drm_minor *minor); +void drm_framebuffer_debugfs_init (struct drm_device *dev);include/drm/drm_accel.h +7
-2@@ -58,7 +58,8 @@ int accel_minor_alloc(void);void accel_minor_replace (struct drm_minor *minor,int index);void accel_set_device_instance_params (struct device *kdev,int index);int accel_open (struct inode *inode,struct file *filp); -void accel_debugfs_init (struct drm_minor *minor,int minor_id); +void accel_debugfs_init (struct drm_device *dev); +void accel_debugfs_register (struct drm_device *dev);#else @@ -89,7 +90,11 @@ static inline void accel_set_device_instance_params(struct device *kdev, int ind { } -static inline void accel_debugfs_init (struct drm_minor *minor,int minor_id) +static inline void accel_debugfs_init (struct drm_device *dev) +{ +} + +static inline void accel_debugfs_register (struct drm_device *dev) { }include/drm/drm_client.h +1
-1@@ -195,6 +195,6 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode); drm_for_each_connector_iter(connector, iter) \if (connector->connector_type !=DRM_MODE_CONNECTOR_WRITEBACK ) -void drm_client_debugfs_init(struct drm_minor *minor); +void drm_client_debugfs_init(struct drm_device *dev);#endif include/drm/drm_device.h +7
-0@@ -311,6 +311,13 @@ struct drm_device {*/ struct drm_fb_helper *fb_helper; +/** +* @debugfs_root: +* +* Root directory for debugfs files. +*/ +struct dentry *debugfs_root; +/** * @debugfs_mutex: * include/drm/drm_drv.h +8
-0@@ -575,4 +575,12 @@ static inline bool drm_firmware_drivers_only(void) return video_firmware_drivers_only(); } +#if defined(CONFIG_DEBUG_FS ) +void drm_debugfs_dev_init (struct drm_device *dev,struct dentry *root); +#else +static void drm_debugfs_dev_init (struct drm_device *dev,struct dentry *root) +{ +} +#endif +#endif include/drm/drm_file.h +1
-0@@ -79,6 +79,7 @@ struct drm_minor {struct device *kdev;/* Linux device */ struct drm_device *dev; +struct dentry *debugfs_symlink;struct dentry *debugfs_root;struct list_head debugfs_list;
PATCH 4/5 drm/debugfs: remove dev->debugfs_list and debugfs_mutex v2
In reply to Christian KönigThe mutex was completely pointless in the first place since any parallel adding of files to this list would result in random behavior since the list is filled and consumed multiple times.
Completely drop that approach and just create the files directly but return -ENODEV while opening the file when the minors are not registered yet.
v2: rebase on debugfs directory rework, limit access before minors are
registered.
--- drivers/gpu/drm/drm_debugfs.c | 27 ++------------------------- drivers/gpu/drm/drm_drv.c | 3 --- drivers/gpu/drm/drm_internal.h | 5 ----- drivers/gpu/drm/drm_mode_config.c | 2 -- include/drm/drm_device.h | 15 --------------- 5 files changed, 2 insertions(+), 50 deletions(-)
drivers/gpu/drm/drm_debugfs.c +2 -25
@@ -265,7 +265,6 @@ int drm_debugfs_register(struct drm_minor *minor, int minor_id, struct dentry *root) {struct drm_device *dev = minor->dev; -struct drm_debugfs_entry *entry, *tmp;char name[64 ];INIT_LIST_HEAD (&minor->debugfs_list);
@@ -280,30 +279,9 @@ int drm_debugfs_register(struct drm_minor *minor, int minor_id,if (dev->driver->debugfs_init && dev->render != minor) dev->driver->debugfs_init (minor); -list_for_each_entry_safe (entry, tmp, &dev->debugfs_list, list) { -debugfs_create_file (entry->file.name,0444 , - minor->debugfs_root, entry, &drm_debugfs_entry_fops); -list_del (&entry->list); - } -return 0 ; } -void drm_debugfs_late_register (struct drm_device *dev) -{ -struct drm_minor *minor = dev->primary; -struct drm_debugfs_entry *entry, *tmp; - -if (!minor) -return ; - -list_for_each_entry_safe (entry, tmp, &dev->debugfs_list, list) { -debugfs_create_file (entry->file.name,0444 , - minor->debugfs_root, entry, &drm_debugfs_entry_fops); -list_del (&entry->list); - } -} -int drm_debugfs_remove_files (const struct drm_info_list *files,int count,struct drm_minor *minor) {
@@ -373,9 +351,8 @@ void drm_debugfs_add_file(struct drm_device *dev, const char *name, entry->file.data = data; entry->dev = dev; -mutex_lock (&dev->debugfs_mutex); -list_add (&entry->list, &dev->debugfs_list); -mutex_unlock (&dev->debugfs_mutex); +debugfs_create_file (name,0444 , dev->debugfs_root, entry, + &drm_debugfs_entry_fops); }EXPORT_SYMBOL (drm_debugfs_add_file);
drivers/gpu/drm/drm_drv.c +0 -3
@@ -597,7 +597,6 @@ static void drm_dev_init_release(struct drm_device *dev, void *res)mutex_destroy (&dev->clientlist_mutex);mutex_destroy (&dev->filelist_mutex);mutex_destroy (&dev->struct_mutex); -mutex_destroy (&dev->debugfs_mutex);drm_legacy_destroy_members (dev); }
@@ -638,14 +637,12 @@ static int drm_dev_init(struct drm_device *dev,INIT_LIST_HEAD (&dev->filelist_internal);INIT_LIST_HEAD (&dev->clientlist);INIT_LIST_HEAD (&dev->vblank_event_list); -INIT_LIST_HEAD (&dev->debugfs_list);spin_lock_init (&dev->event_lock);mutex_init (&dev->struct_mutex);mutex_init (&dev->filelist_mutex);mutex_init (&dev->clientlist_mutex);mutex_init (&dev->master_mutex); -mutex_init (&dev->debugfs_mutex); ret =drmm_add_action_or_reset (dev, drm_dev_init_release,NULL );if (ret)
drivers/gpu/drm/drm_internal.h +0 -5
@@ -185,7 +185,6 @@ void drm_debugfs_dev_register(struct drm_device *dev);int drm_debugfs_register (struct drm_minor *minor,int minor_id,struct dentry *root);void drm_debugfs_cleanup (struct drm_minor *minor); -void drm_debugfs_late_register (struct drm_device *dev);void drm_debugfs_connector_add (struct drm_connector *connector);void drm_debugfs_connector_remove (struct drm_connector *connector);void drm_debugfs_crtc_add (struct drm_crtc *crtc);
@@ -210,10 +209,6 @@ static inline void drm_debugfs_cleanup(struct drm_minor *minor) { } -static inline void drm_debugfs_late_register (struct drm_device *dev) -{ -} -static inline void drm_debugfs_connector_add (struct drm_connector *connector) { }
drivers/gpu/drm/drm_mode_config.c +0 -2
@@ -54,8 +54,6 @@ int drm_modeset_register_all(struct drm_device *dev)if (ret) goto err_connector; -drm_debugfs_late_register (dev); -return 0 ; err_connector:
include/drm/drm_device.h +0 -15
@@ -318,21 +318,6 @@ struct drm_device {*/ struct dentry *debugfs_root; -/** -* @debugfs_mutex: -* -* Protects &debugfs_list access. -*/ -struct mutex debugfs_mutex; - -/** -* @debugfs_list: -* -* List of debugfs files to be created by the DRM device. The files -* must be added during drm_dev_register(). -*/ -struct list_head debugfs_list; -/* Everything below here is for legacy driver, never use! */ /* private: */ #if IS_ENABLED (CONFIG_DRM_LEGACY )
Signature · 1 line
2.34.1
PATCH 5/5 drm/debugfs: rework drm_debugfs_create_files implementation
In reply to Christian KönigUse managed memory allocation for this. That allows us to not keep track of all the files any more.
--- drivers/accel/drm_accel.c | 2 - drivers/gpu/drm/drm_debugfs.c | 75 +++++++++------------------------- drivers/gpu/drm/drm_drv.c | 2 - drivers/gpu/drm/drm_internal.h | 5 --- drivers/gpu/drm/tegra/dc.c | 9 +++- drivers/gpu/drm/tegra/dsi.c | 1 + drivers/gpu/drm/tegra/hdmi.c | 3 +- drivers/gpu/drm/tegra/sor.c | 1 + include/drm/drm_debugfs.h | 4 +- include/drm/drm_file.h | 4 -- 10 files changed, 34 insertions(+), 72 deletions(-)
drivers/accel/drm_accel.c +0 -2
@@ -100,8 +100,6 @@ void accel_debugfs_register(struct drm_device *dev) {struct drm_minor *minor = dev->accel; -INIT_LIST_HEAD (&minor->debugfs_list); -mutex_init (&minor->debugfs_lock); minor->debugfs_root = dev->debugfs_root; drm_debugfs_create_files(accel_debugfs_list, ACCEL_DEBUGFS_ENTRIES,
drivers/gpu/drm/drm_debugfs.c +20 -55
104 lines not on this page · raw message
drivers/gpu/drm/drm_drv.c +0 -2
@@ -198,7 +198,6 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)return 0 ; err_debugfs: -drm_debugfs_cleanup (minor);return ret; }
@@ -222,7 +221,6 @@ static void drm_minor_unregister(struct drm_device *dev, unsigned int type)device_del (minor->kdev);dev_set_drvdata (minor->kdev,NULL );/* safety belt */ -drm_debugfs_cleanup (minor); }/*
drivers/gpu/drm/drm_internal.h +0 -5
@@ -184,7 +184,6 @@ void drm_debugfs_dev_fini(struct drm_device *dev);void drm_debugfs_dev_register (struct drm_device *dev);int drm_debugfs_register (struct drm_minor *minor,int minor_id,struct dentry *root); -void drm_debugfs_cleanup (struct drm_minor *minor);void drm_debugfs_connector_add (struct drm_connector *connector);void drm_debugfs_connector_remove (struct drm_connector *connector);void drm_debugfs_crtc_add (struct drm_crtc *crtc);
@@ -205,10 +204,6 @@ static inline int drm_debugfs_register(struct drm_minor *minor, int minor_id,return 0 ; } -static inline void drm_debugfs_cleanup (struct drm_minor *minor) -{ -} -static inline void drm_debugfs_connector_add (struct drm_connector *connector) { }
drivers/gpu/drm/tegra/dc.c +8 -1
@@ -1745,8 +1745,15 @@ static void tegra_dc_early_unregister(struct drm_crtc *crtc)unsigned int count =ARRAY_SIZE (debugfs_files);struct drm_minor *minor = crtc->dev->primary;struct tegra_dc *dc =to_tegra_dc (crtc); +struct dentry *root; + +#ifdef CONFIG_DEBUG_FS + root = crtc->debugfs_entry; +#else + root =NULL ; +#endif -drm_debugfs_remove_files (dc->debugfs_files, count, minor); +drm_debugfs_remove_files (dc->debugfs_files, count, root, minor);kfree (dc->debugfs_files); dc->debugfs_files =NULL ; }
drivers/gpu/drm/tegra/dsi.c +1 -0
@@ -256,6 +256,7 @@ static void tegra_dsi_early_unregister(struct drm_connector *connector)struct tegra_dsi *dsi =to_dsi (output);drm_debugfs_remove_files (dsi->debugfs_files, count, + connector->debugfs_entry, connector->dev->primary);kfree (dsi->debugfs_files); dsi->debugfs_files =NULL ;
drivers/gpu/drm/tegra/hdmi.c +2 -1
@@ -1114,7 +1114,8 @@ static void tegra_hdmi_early_unregister(struct drm_connector *connector)unsigned int count =ARRAY_SIZE (debugfs_files);struct tegra_hdmi *hdmi =to_hdmi (output); -drm_debugfs_remove_files (hdmi->debugfs_files, count, minor); +drm_debugfs_remove_files (hdmi->debugfs_files, count, + connector->debugfs_entry, minor);kfree (hdmi->debugfs_files); hdmi->debugfs_files =NULL ; }
drivers/gpu/drm/tegra/sor.c +1 -0
@@ -1707,6 +1707,7 @@ static void tegra_sor_early_unregister(struct drm_connector *connector)struct tegra_sor *sor =to_sor (output);drm_debugfs_remove_files (sor->debugfs_files, count, + connector->debugfs_entry, connector->dev->primary);kfree (sor->debugfs_files); sor->debugfs_files =NULL ;
include/drm/drm_debugfs.h +2 -2
@@ -126,8 +126,8 @@ struct drm_debugfs_entry {void drm_debugfs_create_files (const struct drm_info_list *files,int count,struct dentry *root,struct drm_minor *minor); -int drm_debugfs_remove_files (const struct drm_info_list *files, -int count,struct drm_minor *minor); +int drm_debugfs_remove_files (const struct drm_info_list *files,int count, +struct dentry *root,struct drm_minor *minor);void drm_debugfs_add_file (struct drm_device *dev,const char *name,int (*show)(struct seq_file *,void *),void *data);
include/drm/drm_file.h +0 -4
@@ -79,11 +79,7 @@ struct drm_minor {struct device *kdev;/* Linux device */ struct drm_device *dev; -struct dentry *debugfs_symlink;struct dentry *debugfs_root; - -struct list_head debugfs_list; -struct mutex debugfs_lock;/* Protects debugfs_list. */ };/**
Signature · 1 line
2.34.1
Re: [PATCH 5/5] drm/debugfs: rework drm_debugfs_create_files implementation
drivers/gpu/drm/drm_debugfs.c void drm_debugfs_create_files(const struct drm_info_list *files, int count,
Quoted 35 lines · Christian König
Use managed memory allocation for this. That allows us to not keep track of all the files any more.
Signed-off-by Christian König <[email protected]>--- drivers/accel/drm_accel.c | 2 - drivers/gpu/drm/drm_debugfs.c | 75 +++++++++------------------------- drivers/gpu/drm/drm_drv.c | 2 - drivers/gpu/drm/drm_internal.h | 5 --- drivers/gpu/drm/tegra/dc.c | 9 +++- drivers/gpu/drm/tegra/dsi.c | 1 + drivers/gpu/drm/tegra/hdmi.c | 3 +- drivers/gpu/drm/tegra/sor.c | 1 + include/drm/drm_debugfs.h | 4 +- include/drm/drm_file.h | 4 -- 10 files changed, 34 insertions(+), 72 deletions(-)drivers/accel/drm_accel.c +0
-2@@ -100,8 +100,6 @@ void accel_debugfs_register(struct drm_device *dev) {struct drm_minor *minor = dev->accel; -INIT_LIST_HEAD (&minor->debugfs_list); -mutex_init (&minor->debugfs_lock); minor->debugfs_root = dev->debugfs_root; drm_debugfs_create_files(accel_debugfs_list, ACCEL_DEBUGFS_ENTRIES,drivers/gpu/drm/drm_debugfs.c +0
-0@@ -208,7 +208,7 @@ void drm_debugfs_create_files(const struct drm_info_list *files, int count,
Need to remove the "These files will be removed automatically on drm_debugfs_cleanup()" sentence from the description of drm_debugfs_create_files(), because drm_debugfs_cleanup() is removed in this patch.
Quoted 42 lines
drivers/gpu/drm/drm_debugfs.c +19
-5if (features && !drm_core_check_all_features (dev, features))continue ; - tmp =kmalloc (sizeof (struct drm_info_node ),GFP_KERNEL ); + tmp =drmm_kzalloc (dev,sizeof (*tmp),GFP_KERNEL );if (tmp ==NULL )continue ;@@ -217,14 +217,28 @@ void drm_debugfs_create_files(const struct drm_info_list *files, int count,0444 , root, tmp, &drm_debugfs_fops); tmp->info_ent = &files[i]; - -mutex_lock (&minor->debugfs_lock); -list_add (&tmp->list, &minor->debugfs_list); -mutex_unlock (&minor->debugfs_lock); } }EXPORT_SYMBOL (drm_debugfs_create_files); +int drm_debugfs_remove_files (const struct drm_info_list *files,int count, +struct dentry *root,struct drm_minor *minor) +{ +int i; + +for (i =0 ; i < count; i++) { +struct dentry *dent =debugfs_lookup (files[i].name, root); + +if (!dent) +continue ; + +drmm_kfree (minor->dev,d_inode (dent)->i_private); +debugfs_remove (dent); + } +return 0 ; +} +EXPORT_SYMBOL (drm_debugfs_remove_files); +/** * drm_debugfs_dev_init - create debugfs directory for the device * @dev: the device which we want to create the directory for
drivers/gpu/drm/drm_debugfs.c int drm_debugfs_register(struct drm_minor *minor, int minor_id, · line 285
Quoted 9 lines
drivers/gpu/drm/drm_debugfs.c +1
-4@@ -267,11 +281,8 @@ int drm_debugfs_register(struct drm_minor *minor, int minor_id,struct drm_device *dev = minor->dev;char name[64 ]; -INIT_LIST_HEAD (&minor->debugfs_list); -mutex_init (&minor->debugfs_lock);sprintf (name,"%d" , minor_id); - minor->debugfs_symlink =debugfs_create_symlink (name, root, - dev->unique); +debugfs_create_symlink (name, root, dev->unique);
Is it okay to not track the symlink for a later removal? Will it be removed as part of the new drm_debugfs_remove_files()?
Thanks,
Tomer
Quoted 189 lines
drivers/gpu/drm/drm_debugfs.c +0
-46/* TODO: Only for compatibility with drivers */ minor->debugfs_root = dev->debugfs_root;@@ -282,52 +293,6 @@ int drm_debugfs_register(struct drm_minor *minor, int minor_id,return 0 ; } -int drm_debugfs_remove_files (const struct drm_info_list *files,int count, -struct drm_minor *minor) -{ -struct list_head *pos, *q; -struct drm_info_node *tmp; -int i; - -mutex_lock (&minor->debugfs_lock); -for (i =0 ; i < count; i++) { -list_for_each_safe (pos, q, &minor->debugfs_list) { - tmp = list_entry(pos, struct drm_info_node, list); -if (tmp->info_ent == &files[i]) { -debugfs_remove (tmp->dent); -list_del (pos); -kfree (tmp); - } - } - } -mutex_unlock (&minor->debugfs_lock); -return 0 ; -} -EXPORT_SYMBOL (drm_debugfs_remove_files); - -static void drm_debugfs_remove_all_files (struct drm_minor *minor) -{ -struct drm_info_node *node, *tmp; - -mutex_lock (&minor->debugfs_lock); -list_for_each_entry_safe (node, tmp, &minor->debugfs_list, list) { -debugfs_remove (node->dent); -list_del (&node->list); -kfree (node); - } -mutex_unlock (&minor->debugfs_lock); -} - -void drm_debugfs_cleanup (struct drm_minor *minor) -{ -if (!minor->debugfs_symlink) -return ; - -drm_debugfs_remove_all_files (minor); -debugfs_remove (minor->debugfs_symlink); - minor->debugfs_symlink =NULL ; -} -/** * drm_debugfs_add_file - Add a given file to the DRM device debugfs file list * @dev: drm device for the ioctl drivers/gpu/drm/drm_drv.c +0
-2@@ -198,7 +198,6 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)return 0 ; err_debugfs: -drm_debugfs_cleanup (minor);return ret; }@@ -222,7 +221,6 @@ static void drm_minor_unregister(struct drm_device *dev, unsigned int type)device_del (minor->kdev);dev_set_drvdata (minor->kdev,NULL );/* safety belt */ -drm_debugfs_cleanup (minor); }/* drivers/gpu/drm/drm_internal.h +0
-5@@ -184,7 +184,6 @@ void drm_debugfs_dev_fini(struct drm_device *dev);void drm_debugfs_dev_register (struct drm_device *dev);int drm_debugfs_register (struct drm_minor *minor,int minor_id,struct dentry *root); -void drm_debugfs_cleanup (struct drm_minor *minor);void drm_debugfs_connector_add (struct drm_connector *connector);void drm_debugfs_connector_remove (struct drm_connector *connector);void drm_debugfs_crtc_add (struct drm_crtc *crtc);@@ -205,10 +204,6 @@ static inline int drm_debugfs_register(struct drm_minor *minor, int minor_id,return 0 ; } -static inline void drm_debugfs_cleanup (struct drm_minor *minor) -{ -} -static inline void drm_debugfs_connector_add (struct drm_connector *connector) { }drivers/gpu/drm/tegra/dc.c +8
-1@@ -1745,8 +1745,15 @@ static void tegra_dc_early_unregister(struct drm_crtc *crtc)unsigned int count =ARRAY_SIZE (debugfs_files);struct drm_minor *minor = crtc->dev->primary;struct tegra_dc *dc =to_tegra_dc (crtc); +struct dentry *root; + +#ifdef CONFIG_DEBUG_FS + root = crtc->debugfs_entry; +#else + root =NULL ; +#endif -drm_debugfs_remove_files (dc->debugfs_files, count, minor); +drm_debugfs_remove_files (dc->debugfs_files, count, root, minor);kfree (dc->debugfs_files); dc->debugfs_files =NULL ; }drivers/gpu/drm/tegra/dsi.c +1
-0@@ -256,6 +256,7 @@ static void tegra_dsi_early_unregister(struct drm_connector *connector)struct tegra_dsi *dsi =to_dsi (output);drm_debugfs_remove_files (dsi->debugfs_files, count, + connector->debugfs_entry, connector->dev->primary);kfree (dsi->debugfs_files); dsi->debugfs_files =NULL ;drivers/gpu/drm/tegra/hdmi.c +2
-1@@ -1114,7 +1114,8 @@ static void tegra_hdmi_early_unregister(struct drm_connector *connector)unsigned int count =ARRAY_SIZE (debugfs_files);struct tegra_hdmi *hdmi =to_hdmi (output); -drm_debugfs_remove_files (hdmi->debugfs_files, count, minor); +drm_debugfs_remove_files (hdmi->debugfs_files, count, + connector->debugfs_entry, minor);kfree (hdmi->debugfs_files); hdmi->debugfs_files =NULL ; }drivers/gpu/drm/tegra/sor.c +1
-0@@ -1707,6 +1707,7 @@ static void tegra_sor_early_unregister(struct drm_connector *connector)struct tegra_sor *sor =to_sor (output);drm_debugfs_remove_files (sor->debugfs_files, count, + connector->debugfs_entry, connector->dev->primary);kfree (sor->debugfs_files); sor->debugfs_files =NULL ;include/drm/drm_debugfs.h +2
-2@@ -126,8 +126,8 @@ struct drm_debugfs_entry {void drm_debugfs_create_files (const struct drm_info_list *files,int count,struct dentry *root,struct drm_minor *minor); -int drm_debugfs_remove_files (const struct drm_info_list *files, -int count,struct drm_minor *minor); +int drm_debugfs_remove_files (const struct drm_info_list *files,int count, +struct dentry *root,struct drm_minor *minor);void drm_debugfs_add_file (struct drm_device *dev,const char *name,int (*show)(struct seq_file *,void *),void *data);include/drm/drm_file.h +0
-4@@ -79,11 +79,7 @@ struct drm_minor {struct device *kdev;/* Linux device */ struct drm_device *dev; -struct dentry *debugfs_symlink;struct dentry *debugfs_root; - -struct list_head debugfs_list; -struct mutex debugfs_lock;/* Protects debugfs_list. */ };/**