Re: [libgpiod] Rethinking struct gpiod_line_bulk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 20, 2020 at 05:53:31PM +0200, Bartosz Golaszewski wrote:
> On Tue, Oct 20, 2020 at 5:06 PM Kent Gibson <warthog618@xxxxxxxxx> wrote:
> >
> 
[snip]
> > >
> > > I'm now actually leaning more towards making it opaque but I need to
> > > find a way to make gpiod_line_bulk_foreach_line work with hidden bulk
> > > struct.
> > >
> >
> > Why not just drop it in favour of gpiod_line_bulk_foreach_line_off()?
> >
> 
> The one with the line being supplied to the user automatically is more
> elegant. If anything - I'd prefer to drop
> gpiod_line_bulk_foreach_line_off(). Callbacks as suggested by Andy is
> a good idea - something like what GLib does in a lot of helpers for
> lists etc.
> 

Not sure what you mean here - they both return the line, the difference
is how they store the loop state, with gpiod_line_bulk_foreach_line()
exposing the bulk->lines array via the lineptr.  That is the source of
your problem if you go opaque - that array becomes hidden, as it
probably should be.

Cheers,
Kent.



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux