Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: snic: debugfs: remove local storage of debugfs files

There is no need to keep the dentry around for the debugfs trace files,
as we can just look it up when we want to remove it later on. Simplify
the structure by removing the dentries and relying on debugfs to find
the dentry to remove when we want to.

By doing this change, we remove the last in-kernel user that was storing
the result of debugfs_create_bool(), so that api can be cleaned up.

Cc: Karan Tilak Kumar <kartilak@cisco.com>
Cc: Sesidhar Baddela <sebaddel@cisco.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>
Link: https://lore.kernel.org/r/20210518161625.3696996-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+8 -16
+8 -13
drivers/scsi/snic/snic_debugfs.c
··· 430 430 431 431 DEFINE_SEQ_ATTRIBUTE(snic_trc); 432 432 433 + #define TRC_ENABLE_FILE "tracing_enable" 434 + #define TRC_FILE "trace" 433 435 /* 434 436 * snic_trc_debugfs_init : creates trace/tracing_enable files for trace 435 437 * under debugfs 436 438 */ 437 439 void snic_trc_debugfs_init(void) 438 440 { 439 - snic_glob->trc.trc_enable = debugfs_create_bool("tracing_enable", 440 - S_IFREG | S_IRUGO | S_IWUSR, 441 - snic_glob->trc_root, 442 - &snic_glob->trc.enable); 441 + debugfs_create_bool(TRC_ENABLE_FILE, S_IFREG | S_IRUGO | S_IWUSR, 442 + snic_glob->trc_root, &snic_glob->trc.enable); 443 443 444 - snic_glob->trc.trc_file = debugfs_create_file("trace", 445 - S_IFREG | S_IRUGO | S_IWUSR, 446 - snic_glob->trc_root, NULL, 447 - &snic_trc_fops); 444 + debugfs_create_file(TRC_FILE, S_IFREG | S_IRUGO | S_IWUSR, 445 + snic_glob->trc_root, NULL, &snic_trc_fops); 448 446 } 449 447 450 448 /* ··· 451 453 void 452 454 snic_trc_debugfs_term(void) 453 455 { 454 - debugfs_remove(snic_glob->trc.trc_file); 455 - snic_glob->trc.trc_file = NULL; 456 - 457 - debugfs_remove(snic_glob->trc.trc_enable); 458 - snic_glob->trc.trc_enable = NULL; 456 + debugfs_remove(debugfs_lookup(TRC_FILE, snic_glob->trc_root)); 457 + debugfs_remove(debugfs_lookup(TRC_ENABLE_FILE, snic_glob->trc_root)); 459 458 }
-3
drivers/scsi/snic/snic_trc.h
··· 46 46 u32 rd_idx; 47 47 u32 wr_idx; 48 48 bool enable; /* Control Variable for Tracing */ 49 - 50 - struct dentry *trc_enable; /* debugfs file object */ 51 - struct dentry *trc_file; 52 49 }; 53 50 54 51 int snic_trc_init(void);