linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
To: Tiezhu Yang <yangtiezhu-cXZgJK919ebM1kAEIRd3EQ@public.gmane.org>
Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-spi <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 2/4] spi: spidev_test: Check input_tx and input_file first after parse options
Date: Thu, 13 Feb 2020 09:26:19 +0100	[thread overview]
Message-ID: <CAMuHMdXi4ieMvZY1J8RjuOeR+vKrTmASq-40MK27xutZPv4deQ@mail.gmail.com> (raw)
In-Reply-To: <1581567368-8055-2-git-send-email-yangtiezhu-cXZgJK919ebM1kAEIRd3EQ@public.gmane.org>

Hi Tiezhu,

On Thu, Feb 13, 2020 at 5:17 AM Tiezhu Yang <yangtiezhu-cXZgJK919ebM1kAEIRd3EQ@public.gmane.org> wrote:
> It is better to check input_tx and input_file first after parse options.
> Otherwise, it will do some useless operations when both -p and --input
> are selected.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu-cXZgJK919ebM1kAEIRd3EQ@public.gmane.org>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>

> --- a/tools/spi/spidev_test.c
> +++ b/tools/spi/spidev_test.c
> @@ -404,6 +404,9 @@ int main(int argc, char *argv[])
>
>         parse_opts(argc, argv);
>
> +       if (input_tx && input_file)
> +               pabort("only one of -p and --input may be selected");
> +

Alternatively, this check could be moved to the end of parse_opts().

>         fd = open(device, O_RDWR);
>         if (fd < 0)
>                 pabort("can't open device");

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  parent reply	other threads:[~2020-02-13  8:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  4:16 [PATCH 1/4] spi: spidev_test: Remove break after exit statement Tiezhu Yang
2020-02-13  4:16 ` [PATCH 2/4] spi: spidev_test: Check input_tx and input_file first after parse options Tiezhu Yang
     [not found]   ` <1581567368-8055-2-git-send-email-yangtiezhu-cXZgJK919ebM1kAEIRd3EQ@public.gmane.org>
2020-02-13  8:26     ` Geert Uytterhoeven [this message]
2020-02-13 13:32   ` Applied "spi: spidev_test: Check input_tx and input_file first after parse options" to the spi tree Mark Brown
2020-02-13  4:16 ` [PATCH 3/4] spi: spidev_test: Use perror() only if errno is not 0 Tiezhu Yang
     [not found]   ` <1581567368-8055-3-git-send-email-yangtiezhu-cXZgJK919ebM1kAEIRd3EQ@public.gmane.org>
2020-02-13  8:27     ` Geert Uytterhoeven
2020-02-13 13:32   ` Applied "spi: spidev_test: Use perror() only if errno is not 0" to the spi tree Mark Brown
     [not found] ` <1581567368-8055-1-git-send-email-yangtiezhu-cXZgJK919ebM1kAEIRd3EQ@public.gmane.org>
2020-02-13  4:16   ` [PATCH 4/4] spi: spidev_test: Remove the whole "include" directory when make clean Tiezhu Yang
     [not found]     ` <1581567368-8055-4-git-send-email-yangtiezhu-cXZgJK919ebM1kAEIRd3EQ@public.gmane.org>
2020-02-13 13:32       ` Applied "spi: spidev_test: Remove the whole "include" directory when make clean" to the spi tree Mark Brown
2020-02-13  8:23   ` [PATCH 1/4] spi: spidev_test: Remove break after exit statement Geert Uytterhoeven
2020-02-13 13:32   ` Applied "spi: spidev_test: Remove break after exit statement" to the spi tree Mark Brown

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=CAMuHMdXi4ieMvZY1J8RjuOeR+vKrTmASq-40MK27xutZPv4deQ@mail.gmail.com \
    --to=geert-td1emuhucqxl1znqvxdv9g@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=yangtiezhu-cXZgJK919ebM1kAEIRd3EQ@public.gmane.org \
    /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).