linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Yang Jihong <yangjihong1@huawei.com>,
	peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
	jolsa@kernel.org, namhyung@kernel.org, irogers@google.com,
	carsten.haitzler@arm.com, leo.yan@linaro.org,
	ravi.bangoria@amd.com, martin.lau@kernel.org, ak@linux.intel.com,
	masami.hiramatsu.pt@hitachi.com,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] perf probe: Check -v and -q options in the right place
Date: Tue, 20 Dec 2022 13:12:27 +0200	[thread overview]
Message-ID: <6e24e97c-899c-53d0-5e55-a6337a555327@intel.com> (raw)
In-Reply-To: <20221220035702.188413-4-yangjihong1@huawei.com>

On 20/12/22 05:57, Yang Jihong wrote:
> Check the -q and -v options first to return earlier on error.
> 
> Before:
>   # perf probe -q -v test
>   probe-definition(0): test
>   symbol:test file:(null) line:0 offset:0 return:0 lazy:(null)
>   0 arguments
>     Error: -v and -q are exclusive.
> 
> After:
>   # perf probe -q -v test
>     Error: -v and -q are exclusive.
> 
> Fixes: 5e17b28f1e24 ("perf probe: Add --quiet option to suppress output result message")
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>

Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  tools/perf/builtin-probe.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> index 2ae50fc9e597..ed73d0b89ca2 100644
> --- a/tools/perf/builtin-probe.c
> +++ b/tools/perf/builtin-probe.c
> @@ -612,6 +612,15 @@ __cmd_probe(int argc, const char **argv)
>  
>  	argc = parse_options(argc, argv, options, probe_usage,
>  			     PARSE_OPT_STOP_AT_NON_OPTION);
> +
> +	if (quiet) {
> +		if (verbose != 0) {
> +			pr_err("  Error: -v and -q are exclusive.\n");
> +			return -EINVAL;
> +		}
> +		verbose = -1;
> +	}
> +
>  	if (argc > 0) {
>  		if (strcmp(argv[0], "-") == 0) {
>  			usage_with_options_msg(probe_usage, options,
> @@ -633,14 +642,6 @@ __cmd_probe(int argc, const char **argv)
>  	if (ret)
>  		return ret;
>  
> -	if (quiet) {
> -		if (verbose != 0) {
> -			pr_err("  Error: -v and -q are exclusive.\n");
> -			return -EINVAL;
> -		}
> -		verbose = -1;
> -	}
> -
>  	if (probe_conf.max_probes == 0)
>  		probe_conf.max_probes = MAX_PROBES;
>  


      reply	other threads:[~2022-12-20 11:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20  3:56 [PATCH 0/3] Fixes for debug variables Yang Jihong
2022-12-20  3:57 ` [PATCH 1/3] perf tools: Set debug_peo_args and redirect_to_stderr to correct values in perf_quiet_option Yang Jihong
2022-12-20  7:35   ` Adrian Hunter
2022-12-20 18:17     ` Arnaldo Carvalho de Melo
2022-12-20  3:57 ` [PATCH 2/3] perf tools: Fix usage of the verbose variable Yang Jihong
2022-12-20  7:44   ` Adrian Hunter
2022-12-20  3:57 ` [PATCH 3/3] perf probe: Check -v and -q options in the right place Yang Jihong
2022-12-20 11:12   ` Adrian Hunter [this message]

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=6e24e97c-899c-53d0-5e55-a6337a555327@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=carsten.haitzler@arm.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=martin.lau@kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=yangjihong1@huawei.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;
as well as URLs for NNTP newsgroup(s).