xhci: don't mess with ->d_iname
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Jan 2025 08:06:58 +0000 (08:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jan 2025 12:14:37 +0000 (13:14 +0100)
use debugs_{creat_file,get}_aux() instead

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lore.kernel.org/r/20250112080705.141166-14-viro@zeniv.linux.org.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-debugfs.c

index 4f0c1b96e208f2af82a658b5014caf61256c5bcb..1f5ef174abeaf03d9080a285562a2eb36860e140 100644 (file)
@@ -232,16 +232,7 @@ static struct xhci_file_map ring_files[] = {
 
 static int xhci_ring_open(struct inode *inode, struct file *file)
 {
-       int                     i;
-       struct xhci_file_map    *f_map;
-       const char              *file_name = file_dentry(file)->d_iname;
-
-       for (i = 0; i < ARRAY_SIZE(ring_files); i++) {
-               f_map = &ring_files[i];
-
-               if (strcmp(f_map->name, file_name) == 0)
-                       break;
-       }
+       const struct xhci_file_map *f_map = debugfs_get_aux(file);
 
        return single_open(file, f_map->show, inode->i_private);
 }
@@ -318,16 +309,7 @@ static struct xhci_file_map context_files[] = {
 
 static int xhci_context_open(struct inode *inode, struct file *file)
 {
-       int                     i;
-       struct xhci_file_map    *f_map;
-       const char              *file_name = file_dentry(file)->d_iname;
-
-       for (i = 0; i < ARRAY_SIZE(context_files); i++) {
-               f_map = &context_files[i];
-
-               if (strcmp(f_map->name, file_name) == 0)
-                       break;
-       }
+       const struct xhci_file_map *f_map = debugfs_get_aux(file);
 
        return single_open(file, f_map->show, inode->i_private);
 }
@@ -410,7 +392,8 @@ static void xhci_debugfs_create_files(struct xhci_hcd *xhci,
        int                     i;
 
        for (i = 0; i < nentries; i++)
-               debugfs_create_file(files[i].name, 0444, parent, data, fops);
+               debugfs_create_file_aux(files[i].name, 0444, parent,
+                                       data, &files[i], fops);
 }
 
 static struct dentry *xhci_debugfs_create_ring_dir(struct xhci_hcd *xhci,