linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: andy pugh <bodgesoc@gmail.com>
Cc: linux-gpio@vger.kernel.org
Subject: Re: [libgpiod] gpiod_line_get_value_bulk may be broken?
Date: Sun, 6 Aug 2023 09:02:09 +0800	[thread overview]
Message-ID: <ZM7xEbr0essN2qY3@sol> (raw)
In-Reply-To: <CAN1+YZW-EcQq=D=dLQoH-WsDD7RWjTUgqbQMynV+OXV0EjLOAw@mail.gmail.com>

On Sat, Aug 05, 2023 at 11:55:44PM +0100, andy pugh wrote:
> On Sat, 29 Jul 2023 at 03:03, Kent Gibson <warthog618@gmail.com> wrote:
> 
> > > Unfortunately I won't know what chip the line is on, but I have
> > > already considered that and plan to have an array of structs
> > > containing the "bulk" and the "chip" for each chip that is needed
> > > according to the IO line list submitted by the (pesky!) users.
> > >
> >
> > So the IO lines are specified by name?
> 
> Yes, they are.
> 
> Before I go too far down the wrong path, it has occurred to me that I
> probably can't allow the lines to go out of scope?
> 
> ie, this (pseudocode) won't work
> 
> for each lineName in lineList
>     temp_line = gpiod_chip_find_line(chip, lineName)
>     gpiod_line_bulk_add(&bulk, temp_line);
> next
> 
> As each line in the bulk will actually point to the same (last found) line?
> Or am I missing a subtlety?
> 

This pseudocode is fine, as the gpiod_chip_find_line() returns a new
gpiod_line object for each line, and that is passed to the bulk.
So they are definitely not using the same gpiod_line object.

That pseudocode is essentially what gpiod_chip_find_lines() does too,
though that requires all the lines being on the same chip, and I assume
you have a separate bulk for each chip, so there is more going on in the
loop than you show.

And I maintain that the wrong path here is to use v1, rather than v2.
So v2 is absolutely not an option?

Cheers,
Kent.

  reply	other threads:[~2023-08-06  1:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 15:14 [libgpiod] gpiod_line_get_value_bulk may be broken? andy pugh
2023-07-27 20:53 ` Kent Gibson
2023-07-27 21:17   ` andy pugh
2023-07-27 21:55     ` Kent Gibson
2023-07-27 22:10       ` andy pugh
2023-07-27 22:36         ` Kent Gibson
2023-07-28  0:39       ` andy pugh
2023-07-28  1:07         ` andy pugh
2023-07-28  5:57         ` Kent Gibson
2023-07-28 19:01           ` andy pugh
2023-07-29  2:03             ` Kent Gibson
2023-08-05 22:55               ` andy pugh
2023-08-06  1:02                 ` Kent Gibson [this message]
2023-08-06  9:13                   ` andy pugh
2023-08-06  9:29                     ` Kent Gibson
2023-08-10  0:17                       ` andy pugh
2023-08-10  0:46                         ` Kent Gibson
2023-08-10 22:07                           ` andy pugh
2023-08-11  0:59                             ` Kent Gibson
2023-08-11  1:26                               ` andy pugh
2023-08-11  1:36                                 ` Kent Gibson
2023-08-14 22:25                                   ` How to use gpiod_line_set_flags andy pugh
2023-08-15  0:49                                     ` Kent Gibson
2023-08-15 18:03                                       ` andy pugh
2023-08-11 12:19               ` [libgpiod] gpiod_line_get_value_bulk may be broken? Bartosz Golaszewski

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=ZM7xEbr0essN2qY3@sol \
    --to=warthog618@gmail.com \
    --cc=bodgesoc@gmail.com \
    --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 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).