All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: snic: debugfs: remove local storage of debugfs files
@ 2021-05-18 16:16 Greg Kroah-Hartman
  2021-05-18 16:29 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-18 16:16 UTC (permalink / raw)
  To: martin.petersen, jejb
  Cc: Greg Kroah-Hartman, Karan Tilak Kumar, Sesidhar Baddela, linux-scsi

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/snic/snic_debugfs.c | 23 +++++++++--------------
 drivers/scsi/snic/snic_trc.h     |  3 ---
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/snic/snic_debugfs.c b/drivers/scsi/snic/snic_debugfs.c
index 3aeee856d5c7..5e0faeba516e 100644
--- a/drivers/scsi/snic/snic_debugfs.c
+++ b/drivers/scsi/snic/snic_debugfs.c
@@ -430,21 +430,19 @@ static const struct seq_operations snic_trc_sops = {
 
 DEFINE_SEQ_ATTRIBUTE(snic_trc);
 
+#define TRC_ENABLE_FILE	"tracing_enable"
+#define TRC_FILE	"trace"
 /*
  * snic_trc_debugfs_init : creates trace/tracing_enable files for trace
  * under debugfs
  */
 void snic_trc_debugfs_init(void)
 {
-	snic_glob->trc.trc_enable = debugfs_create_bool("tracing_enable",
-							S_IFREG | S_IRUGO | S_IWUSR,
-							snic_glob->trc_root,
-							&snic_glob->trc.enable);
-
-	snic_glob->trc.trc_file = debugfs_create_file("trace",
-						      S_IFREG | S_IRUGO | S_IWUSR,
-						      snic_glob->trc_root, NULL,
-						      &snic_trc_fops);
+	debugfs_create_bool(TRC_ENABLE_FILE, S_IFREG | S_IRUGO | S_IWUSR,
+			    snic_glob->trc_root, &snic_glob->trc.enable);
+
+	debugfs_create_file(TRC_FILE, S_IFREG | S_IRUGO | S_IWUSR,
+			    snic_glob->trc_root, NULL, &snic_trc_fops);
 }
 
 /*
@@ -453,9 +451,6 @@ void snic_trc_debugfs_init(void)
 void
 snic_trc_debugfs_term(void)
 {
-	debugfs_remove(snic_glob->trc.trc_file);
-	snic_glob->trc.trc_file = NULL;
-
-	debugfs_remove(snic_glob->trc.trc_enable);
-	snic_glob->trc.trc_enable = NULL;
+	debugfs_remove(debugfs_lookup(TRC_FILE, snic_glob->trc_root));
+	debugfs_remove(debugfs_lookup(TRC_ENABLE_FILE, snic_glob->trc_root));
 }
diff --git a/drivers/scsi/snic/snic_trc.h b/drivers/scsi/snic/snic_trc.h
index 87dcc7457d15..ce305b4b8fa2 100644
--- a/drivers/scsi/snic/snic_trc.h
+++ b/drivers/scsi/snic/snic_trc.h
@@ -46,9 +46,6 @@ struct snic_trc {
 	u32	rd_idx;
 	u32	wr_idx;
 	bool	enable;			/* Control Variable for Tracing */
-
-	struct dentry *trc_enable;	/* debugfs file object */
-	struct dentry *trc_file;
 };
 
 int snic_trc_init(void);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: snic: debugfs: remove local storage of debugfs files
  2021-05-18 16:16 [PATCH] scsi: snic: debugfs: remove local storage of debugfs files Greg Kroah-Hartman
@ 2021-05-18 16:29 ` Greg Kroah-Hartman
  2021-05-21 20:36   ` Martin K. Petersen
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-18 16:29 UTC (permalink / raw)
  To: martin.petersen, jejb; +Cc: Karan Tilak Kumar, Sesidhar Baddela, linux-scsi

On Tue, May 18, 2021 at 06:16:25PM +0200, Greg Kroah-Hartman wrote:
> 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
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/scsi/snic/snic_debugfs.c | 23 +++++++++--------------
>  drivers/scsi/snic/snic_trc.h     |  3 ---
>  2 files changed, 9 insertions(+), 17 deletions(-)

I can take this through my debugfs tree so I can clean up the
debugfs_create_bool() api if no one objects.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: snic: debugfs: remove local storage of debugfs files
  2021-05-18 16:29 ` Greg Kroah-Hartman
@ 2021-05-21 20:36   ` Martin K. Petersen
  2021-05-21 20:47     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Martin K. Petersen @ 2021-05-21 20:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: martin.petersen, jejb, Karan Tilak Kumar, Sesidhar Baddela, linux-scsi


Greg,

>>  drivers/scsi/snic/snic_debugfs.c | 23 +++++++++--------------
>>  drivers/scsi/snic/snic_trc.h     |  3 ---
>>  2 files changed, 9 insertions(+), 17 deletions(-)
>
> I can take this through my debugfs tree so I can clean up the
> debugfs_create_bool() api if no one objects.

Sure, not a problem.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: snic: debugfs: remove local storage of debugfs files
  2021-05-21 20:36   ` Martin K. Petersen
@ 2021-05-21 20:47     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-21 20:47 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: jejb, Karan Tilak Kumar, Sesidhar Baddela, linux-scsi

On Fri, May 21, 2021 at 04:36:19PM -0400, Martin K. Petersen wrote:
> 
> Greg,
> 
> >>  drivers/scsi/snic/snic_debugfs.c | 23 +++++++++--------------
> >>  drivers/scsi/snic/snic_trc.h     |  3 ---
> >>  2 files changed, 9 insertions(+), 17 deletions(-)
> >
> > I can take this through my debugfs tree so I can clean up the
> > debugfs_create_bool() api if no one objects.
> 
> Sure, not a problem.

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-21 20:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 16:16 [PATCH] scsi: snic: debugfs: remove local storage of debugfs files Greg Kroah-Hartman
2021-05-18 16:29 ` Greg Kroah-Hartman
2021-05-21 20:36   ` Martin K. Petersen
2021-05-21 20:47     ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.