Skip to content

Commit e777ba7

Browse files
Al Virogregkh
authored andcommitted
xhci: don't mess with ->d_iname
use debugs_{creat_file,get}_aux() instead Signed-off-by: Al Viro <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c63254a commit e777ba7

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

drivers/usb/host/xhci-debugfs.c

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,7 @@ static struct xhci_file_map ring_files[] = {
232232

233233
static int xhci_ring_open(struct inode *inode, struct file *file)
234234
{
235-
int i;
236-
struct xhci_file_map *f_map;
237-
const char *file_name = file_dentry(file)->d_iname;
238-
239-
for (i = 0; i < ARRAY_SIZE(ring_files); i++) {
240-
f_map = &ring_files[i];
241-
242-
if (strcmp(f_map->name, file_name) == 0)
243-
break;
244-
}
235+
const struct xhci_file_map *f_map = debugfs_get_aux(file);
245236

246237
return single_open(file, f_map->show, inode->i_private);
247238
}
@@ -318,16 +309,7 @@ static struct xhci_file_map context_files[] = {
318309

319310
static int xhci_context_open(struct inode *inode, struct file *file)
320311
{
321-
int i;
322-
struct xhci_file_map *f_map;
323-
const char *file_name = file_dentry(file)->d_iname;
324-
325-
for (i = 0; i < ARRAY_SIZE(context_files); i++) {
326-
f_map = &context_files[i];
327-
328-
if (strcmp(f_map->name, file_name) == 0)
329-
break;
330-
}
312+
const struct xhci_file_map *f_map = debugfs_get_aux(file);
331313

332314
return single_open(file, f_map->show, inode->i_private);
333315
}
@@ -410,7 +392,8 @@ static void xhci_debugfs_create_files(struct xhci_hcd *xhci,
410392
int i;
411393

412394
for (i = 0; i < nentries; i++)
413-
debugfs_create_file(files[i].name, 0444, parent, data, fops);
395+
debugfs_create_file_aux(files[i].name, 0444, parent,
396+
data, &files[i], fops);
414397
}
415398

416399
static struct dentry *xhci_debugfs_create_ring_dir(struct xhci_hcd *xhci,

0 commit comments

Comments
 (0)