From: Kent Gibson <warthog618@gmail.com>
To: andy.shevchenko@gmail.com, Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-gpio@vger.kernel.org
Subject: Re: [libgpiod][PATCH 1/2] bindings: python: examples: fix potential glitch in gpioset.py
Date: Mon, 12 Jun 2023 22:53:54 +0800 [thread overview]
Message-ID: <ZIcxghbvNPtCr8+o@sol> (raw)
In-Reply-To: <CAMRc=MeYRKpoU8TaOGnYCqrBy2BdxfNPKhorUx=5rkRNNC7dkg@mail.gmail.com>
On Mon, Jun 12, 2023 at 04:26:46PM +0200, Bartosz Golaszewski wrote:
> On Fri, Jun 9, 2023 at 10:19 PM <andy.shevchenko@gmail.com> wrote:
> >
> > Fri, Jun 09, 2023 at 11:36:06PM +0800, Kent Gibson kirjoitti:
> > > gpioset.py requests lines without setting their output value, and so
> > > sets them all inactive, and subsequently sets them to their requested
> > > value. This can result in glitches on lines which were active and
> > > are set active.
> > >
> > > As this is example code, it is also important to demonstrate that the
> > > output value can be set by the request itself.
> > >
> > > Request the lines with the correct output values set in the request
> > > itself.
> >
> > Do we need a comment in the code to specify this?
> >
Andy, I'm not ignoring you - I'm still not getting mail from you, and I
hadn't looked on the list for replies. Weird.
In answer to your point - yes and no. The code is not doing anything
unusual, so no. OTOH it does serve as example code, so a bit of
commentary wouldn't hurt.
> > ...
> >
> > > + config = dict([(l, settings(v)) for (l, v) in lvs])
> >
> > Aren't [] not needed?
> >
Ok, but now I did get this one:
> Think about it in dynamic:
> In [1]: x= [(1,2),(2,4)]
> In [2]: dict((a,b)for a,b in x)
> Out[2]: {1: 2, 2: 4}
> [] are redundant, so I remembered that correctly 😄
Terrible example - which 2 is which?
1,2,3,4 would've been better.
True - dict() accepts an iterable, so the [] are redundant in thise case.
Cheers,
Kent.
next prev parent reply other threads:[~2023-06-12 14:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 15:36 [libgpiod][PATCH 0/2] fix potential glitches in bindings example gpiosets Kent Gibson
2023-06-09 15:36 ` [libgpiod][PATCH 1/2] bindings: python: examples: fix potential glitch in gpioset.py Kent Gibson
2023-06-09 20:18 ` andy.shevchenko
2023-06-12 14:26 ` Bartosz Golaszewski
2023-06-12 14:44 ` Andy Shevchenko
2023-06-12 14:53 ` Kent Gibson [this message]
2023-06-12 14:58 ` Bartosz Golaszewski
2023-06-12 14:27 ` Bartosz Golaszewski
2023-06-09 15:36 ` [libgpiod][PATCH 2/2] bindings: cxx: examples: fix potential glitch in gpiosetcxx Kent Gibson
2023-06-09 20:19 ` andy.shevchenko
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=ZIcxghbvNPtCr8+o@sol \
--to=warthog618@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linux-gpio@vger.kernel.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 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.