Linux PCI Non-Transparent Bridge framework and drivers
 help / color / mirror / Atom feed
From: Jon Mason <jdmason@kudzu.us>
To: Gary R Hook <gary.hook@amd.com>
Cc: linux-ntb@googlegroups.com, Allen.Hubbe@emc.com, dave.jiang@intel.com
Subject: Re: [PATCH V3 2/3] ntb: Remove debug-fs variables from the context structure
Date: Sun, 14 May 2017 09:32:07 -0400	[thread overview]
Message-ID: <20170514133206.GA6027@kudzu.us> (raw)
In-Reply-To: <20170509143328.12995.19706.stgit@taos.amd.com>

On Tue, May 09, 2017 at 09:33:28AM -0500, Gary R Hook wrote:
> The Debug FS entries manage themselves; we don't need to hang onto
> them in the context structure.
> 
> Signed-off-by: Gary R Hook <gary.hook@amd.com>
> ---
>  drivers/ntb/test/ntb_perf.c |   28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
> index 0ec9f56f6999..60e0dd320aef 100644
> --- a/drivers/ntb/test/ntb_perf.c
> +++ b/drivers/ntb/test/ntb_perf.c
> @@ -140,9 +140,6 @@ struct perf_ctx {
>  	bool			link_is_up;
>  	struct delayed_work	link_work;
>  	wait_queue_head_t	link_wq;
> -	struct dentry		*debugfs_node_dir;
> -	struct dentry		*debugfs_run;
> -	struct dentry		*debugfs_threads;
>  	u8			perf_threads;
>  	/* mutex ensures only one set of threads run at once */
>  	struct mutex		run_mutex;
> @@ -737,6 +734,9 @@ static ssize_t debugfs_run_write(struct file *filp, const char __user *ubuf,
>  static int perf_debugfs_setup(struct perf_ctx *perf)
>  {
>  	struct pci_dev *pdev = perf->ntb->pdev;
> +	struct dentry *debugfs_node_dir;
> +	struct dentry *debugfs_run;
> +	struct dentry *debugfs_threads;
>  
>  	if (!debugfs_initialized())
>  		return -ENODEV;
> @@ -747,21 +747,21 @@ static int perf_debugfs_setup(struct perf_ctx *perf)
>  			return -ENODEV;
>  	}
>  
> -	perf->debugfs_node_dir = debugfs_create_dir(pci_name(pdev),
> -						    perf_debugfs_dir);
> -	if (!perf->debugfs_node_dir)
> +	debugfs_node_dir = debugfs_create_dir(pci_name(pdev),
> +					      perf_debugfs_dir);
> +	if (!debugfs_node_dir)
>  		return -ENODEV;
>  
> -	perf->debugfs_run = debugfs_create_file("run", S_IRUSR | S_IWUSR,
> -						perf->debugfs_node_dir, perf,
> -						&ntb_perf_debugfs_run);
> -	if (!perf->debugfs_run)
> +	debugfs_run = debugfs_create_file("run", S_IRUSR | S_IWUSR,
> +					  debugfs_node_dir, perf,
> +					  &ntb_perf_debugfs_run);
> +	if (!debugfs_run)
>  		return -ENODEV;
>  
> -	perf->debugfs_threads = debugfs_create_u8("threads", S_IRUSR | S_IWUSR,
> -						  perf->debugfs_node_dir,
> -						  &perf->perf_threads);
> -	if (!perf->debugfs_threads)
> +	debugfs_threads = debugfs_create_u8("threads", S_IRUSR | S_IWUSR,
> +					    debugfs_node_dir,
> +					    &perf->perf_threads);
> +	if (!debugfs_threads)
>  		return -ENODEV;

I'm going to apply this, since it isn't that different then what
exists now.  However, I would like to see this have an error path that
unrolls the creation if one of them fails.

Thanks,
Jon

>  
>  	return 0;
> 

  reply	other threads:[~2017-05-14 13:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09 14:33 [PATCH V3 0/3] Add/expose control features for the NTB perf test module Gary R Hook
2017-05-09 14:33 ` [PATCH V3 1/3] ntb: Add a module option to control affinity of DMA channels Gary R Hook
2017-05-09 14:33 ` [PATCH V3 2/3] ntb: Remove debug-fs variables from the context structure Gary R Hook
2017-05-14 13:32   ` Jon Mason [this message]
2017-05-15 13:48     ` Gary R Hook
2017-05-09 14:33 ` [PATCH V3 3/3] ntb: Add more debugfs support for ntb_perf testing options Gary R Hook
2017-05-14 13:33   ` Jon Mason
2017-05-09 18:02 ` [PATCH V3 0/3] Add/expose control features for the NTB perf test module Dave Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170514133206.GA6027@kudzu.us \
    --to=jdmason@kudzu.us \
    --cc=Allen.Hubbe@emc.com \
    --cc=dave.jiang@intel.com \
    --cc=gary.hook@amd.com \
    --cc=linux-ntb@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox