Skip to contentSkip to conversation

drivers: habanalabs: remove unused dentry pointer for debugfs files

PATCH In review Greg Kroah-Hartman 2 participants 2 messages Feb 16, 2021 Char and misc drivers

lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 1/1 drivers: habanalabs: remove unused dentry pointer for debugfs files

The dentry for the created debugfs file was being saved, but never used anywhere. As the pointer isn't needed for anything, and the debugfs files are being properly removed by removing the parent directory, remove the saved pointer as well, saving a tiny bit of memory and logic.

Cc Oded Gabbay <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Tomer Tayar <[email protected]>
Cc Moti Haimovski <[email protected]>
Cc Omer Shpigelman <[email protected]>
Cc Ofir Bitton <[email protected]>
---
 drivers/misc/habanalabs/common/debugfs.c    | 5 +----
 drivers/misc/habanalabs/common/habanalabs.h | 2 --
 2 files changed, 1 insertion(+), 6 deletions(-)
drivers/misc/habanalabs/common/debugfs.c +1 -4
index cef716643979..770b0131397d 100644
@@ -965,7 +965,6 @@ void hl_debugfs_add_device(struct hl_device *hdev)
 	struct hl_dbg_device_entry *dev_entry = &hdev->hl_debugfs;
 	int count = ARRAY_SIZE(hl_debugfs_list);
 	struct hl_debugfs_entry *entry;
-	struct dentry *ent;
 	int i;
 
 	dev_entry->hdev = hdev;
@@ -1072,13 +1071,11 @@ void hl_debugfs_add_device(struct hl_device *hdev)
 				&hl_stop_on_err_fops);
 
 	for (i = 0, entry = dev_entry->entry_arr ; i < count ; i++, entry++) {
-
-		ent = debugfs_create_file(hl_debugfs_list[i].name,
+		debugfs_create_file(hl_debugfs_list[i].name,
 					0444,
 					dev_entry->root,
 					entry,
 					&hl_debugfs_fops);
-		entry->dent = ent;
 		entry->info_ent = &hl_debugfs_list[i];
 		entry->dev_entry = dev_entry;
 	}
drivers/misc/habanalabs/common/habanalabs.h +0 -2
index 60e16dc4bcac..48937e9eed83 100644
@@ -1393,12 +1393,10 @@ struct hl_info_list {
 
 /**
  * struct hl_debugfs_entry - debugfs dentry wrapper.
- * @dent: base debugfs entry structure.
  * @info_ent: dentry realted ops.
  * @dev_entry: ASIC specific debugfs manager.
  */
 struct hl_debugfs_entry {
-	struct dentry			*dent;
 	const struct hl_info_list	*info_ent;
 	struct hl_dbg_device_entry	*dev_entry;
 };
Signature · 1 line
2.30.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 64 lines · Greg Kroah-Hartman

The dentry for the created debugfs file was being saved, but never used anywhere. As the pointer isn't needed for anything, and the debugfs files are being properly removed by removing the parent directory, remove the saved pointer as well, saving a tiny bit of memory and logic.

Cc Oded Gabbay <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Tomer Tayar <[email protected]>
Cc Moti Haimovski <[email protected]>
Cc Omer Shpigelman <[email protected]>
Cc Ofir Bitton <[email protected]>
---
 drivers/misc/habanalabs/common/debugfs.c    | 5 +----
 drivers/misc/habanalabs/common/habanalabs.h | 2 --
 2 files changed, 1 insertion(+), 6 deletions(-)
drivers/misc/habanalabs/common/debugfs.c +1 -4
index cef716643979..770b0131397d 100644
@@ -965,7 +965,6 @@ void hl_debugfs_add_device(struct hl_device *hdev)
        struct hl_dbg_device_entry *dev_entry = &hdev->hl_debugfs;
        int count = ARRAY_SIZE(hl_debugfs_list);
        struct hl_debugfs_entry *entry;
-       struct dentry *ent;
        int i;
 
        dev_entry->hdev = hdev;
@@ -1072,13 +1071,11 @@ void hl_debugfs_add_device(struct hl_device *hdev)
                                &hl_stop_on_err_fops);
 
        for (i = 0, entry = dev_entry->entry_arr ; i < count ; i++, entry++) {
-
-               ent = debugfs_create_file(hl_debugfs_list[i].name,
+               debugfs_create_file(hl_debugfs_list[i].name,
                                        0444,
                                        dev_entry->root,
                                        entry,
                                        &hl_debugfs_fops);
-               entry->dent = ent;
                entry->info_ent = &hl_debugfs_list[i];
                entry->dev_entry = dev_entry;
        }
drivers/misc/habanalabs/common/habanalabs.h +0 -3
index 60e16dc4bcac..48937e9eed83 100644
@@ -1393,12 +1393,10 @@ struct hl_info_list {
 
 /**
  * struct hl_debugfs_entry - debugfs dentry wrapper.
- * @dent: base debugfs entry structure.
  * @info_ent: dentry realted ops.
  * @dev_entry: ASIC specific debugfs manager.
  */
 struct hl_debugfs_entry {
-       struct dentry                   *dent;
        const struct hl_info_list       *info_ent;
        struct hl_dbg_device_entry      *dev_entry;
 };
--
Quoted 2 lines

2.30.1

This patch is:

Thanks,
Oded