Linux I2C development
 help / color / mirror / Atom feed
From: "Benoît Monin" <benoit.monin@bootlin.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-i2c@vger.kernel.org, Jean Delvare <jdelvare@suse.de>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH i2c-tools v3 2/2] i2ctransfer: Add optional message modifier flags
Date: Mon, 08 Jun 2026 15:26:13 +0200	[thread overview]
Message-ID: <m8YevGrnTd62S0MZYhSJYw@bootlin.com> (raw)
In-Reply-To: <aiaJmtl-n-mNtsDt@shikoro>

Hi Wolfram,

On Monday, 8 June 2026 at 11:21:30 CEST, Wolfram Sang wrote:
> > @@ -202,6 +202,20 @@ static int add_flag_if_supported(__u16 *flags, unsigned long funcs, char arg)
> >                         break;
> >  #endif
> >  
> > +               case '0':
> > +               case '1':
> > +               case '2':
> > +               case '3':
> > +               case '4':
> > +               case '5':
> > +               case '6':
> > +               case '7':
> > +               case '8':
> > +               case '9':
> > +               case '?':
> > +               case '@':
> > +                       return 0;
> > +
> >                 default:
> > 
> > 
> > With this we get out of the flags parsing and the "Missing direction flag"
> > error message is shown. What's your opinion on this?
> 
> Basically fine with me, but we need another adaption then because this
> documentation is not precise anymore:
> 
> + * 0 if the argument is a valid and supported optional flag
> 
> Doesn't fit anymore because for the above cases, the argument is not
> valid.
> 
> I think we should return a dedicated value for this 'unexpected' case.
> 
> Which brings something again to the table I was close to suggesting last
> time already but back then refrained from doing so. Now, it might be
> good after all:
> 
> It is about not using magic numbers for the return values of that
> function but an enum with descriptive entries. Example:
> 
> enum supported_flags_retval {
> 	FLAGS_GOT_RW,
> 	FLAGS_GOT_OPTIONAL,
> 	FLAGS_UNEXPECTED,
> 	FLAGS_UNKNOWN,
> };
> 
> I think this will make life for future hackers quite easier. What do you
> think?
> 
Good idea! I'll update to patch and resend.

Best regards,
-- 
Benoît Monin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com




  reply	other threads:[~2026-06-08 13:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27  9:25 [PATCH i2c-tools v3 0/2] Add support for message modifier flags Benoît Monin
2026-01-27  9:25 ` [PATCH i2c-tools v3 1/2] i2cdetect: Display mangling and nostart support Benoît Monin
2026-06-03  7:33   ` Wolfram Sang
2026-01-27  9:25 ` [PATCH i2c-tools v3 2/2] i2ctransfer: Add optional message modifier flags Benoît Monin
2026-06-03  7:33   ` Wolfram Sang
2026-06-04 16:00     ` Benoît Monin
2026-06-08  9:21       ` Wolfram Sang
2026-06-08 13:26         ` Benoît Monin [this message]
2026-02-17 12:13 ` [PATCH i2c-tools v3 0/2] Add support for " Jean Delvare
2026-03-23  9:12   ` Benoît Monin
2026-05-29 19:58     ` Wolfram Sang

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=m8YevGrnTd62S0MZYhSJYw@bootlin.com \
    --to=benoit.monin@bootlin.com \
    --cc=jdelvare@suse.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox