From: Jean Delvare <jdelvare@suse.de>
To: "Benoît Monin" <benoit.monin@bootlin.com>
Cc: linux-i2c@vger.kernel.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>
Subject: Re: [PATCH i2c-tools v2 2/2] i2ctransfer: Add optional message modifier flags
Date: Tue, 20 Jan 2026 15:45:05 +0100 [thread overview]
Message-ID: <20260120154505.7e860faa@endymion> (raw)
In-Reply-To: <20251223-msg-flags-v2-2-8d934a4366e2@bootlin.com>
On Tue, 23 Dec 2025 14:22:43 +0100, Benoît Monin wrote:
> @@ -202,12 +209,21 @@ int main(int argc, char *argv[])
> case PARSE_GET_DESC:
> flags = 0;
>
> - switch (*arg_ptr++) {
> - case 'r': flags |= I2C_M_RD; break;
> - case 'w': break;
> - default:
> - fprintf(stderr, "Error: Invalid direction\n");
> - goto err_out_with_arg;
> + for (int done = 0; !done; ) {
For compatibility with older C compilers, please declare "done" at the
beginning of the while loop.
> + switch (*arg_ptr++) {
> + /* optional flags */
> + case 'i': flags |= I2C_M_IGNORE_NAK; break;
> + case 'n': flags |= I2C_M_NO_RD_ACK; break;
> + case 'p': flags |= I2C_M_STOP; break;
> + case 's': flags |= I2C_M_NOSTART; break;
> + case 't': flags |= I2C_M_REV_DIR_ADDR; break;
> + /* mandatory flags */
I would write "mandatory direction flag" (singular because only one can
and must be present).
> + case 'r': flags |= I2C_M_RD; done = 1; break;
> + case 'w': done = 1; break;
> + default:
> + fprintf(stderr, "Error: Invalid flag\n");
> + goto err_out_with_arg;
> + }
> }
>
> if (*arg_ptr == '?') {
>
--
Jean Delvare
SUSE L3 Support
next prev parent reply other threads:[~2026-01-20 14:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 13:22 [PATCH i2c-tools v2 0/2] Add support for message modifier flags Benoît Monin
2025-12-23 13:22 ` [PATCH i2c-tools v2 1/2] i2cdetect: Display mangling and nostart support Benoît Monin
2026-01-13 17:22 ` Wolfram Sang
2025-12-23 13:22 ` [PATCH i2c-tools v2 2/2] i2ctransfer: Add optional message modifier flags Benoît Monin
2026-01-13 17:33 ` Wolfram Sang
2026-01-16 13:01 ` Benoît Monin
2026-01-20 15:06 ` Jean Delvare
2026-01-20 14:45 ` Jean Delvare [this message]
2026-01-13 17:21 ` [PATCH i2c-tools v2 0/2] Add support for " Wolfram Sang
2026-01-20 14:15 ` Jean Delvare
2026-01-21 10:00 ` Benoît Monin
2026-01-21 18:37 ` Jean Delvare
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=20260120154505.7e860faa@endymion \
--to=jdelvare@suse.de \
--cc=benoit.monin@bootlin.com \
--cc=linux-i2c@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=wsa+renesas@sang-engineering.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 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.