Re: [PATCH v8 6/7] iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer

From: Jonathan Cameron
Date: Sun Aug 27 2023 - 14:12:45 EST



> > > > > I see. I think my confusion can be easily cured by renaming the callback to
> > > > >
> > > > > get_amount_bytes_in_fifo()
> > > > >
> > > > > or
> > > > >
> > > > > get_bytes_in_fifo()
> > > > >
> > > > > or alike.
> > > >
> > > > or leave it as is. The function is documented:
> > >
> > > > + * @get_fifo_bytes: function pointer to get number of bytes in the FIFO buffer
> > >
> > > Do you find it unambiguous? I do not.
> > >
> > > Still needs more words to explain if it's a capacity of FIFO or is it amount of
> > > valid bytes for the current transfer or what?
> >
> > how about change the description to:
> > function pointer to get amount of acceleration data bytes currently
> > stored in the sensor's FIFO buffer
> >
> > and change the function to "get_amount_bytes_in_fifo()"
>
> Sounds good to me, thank you!
>
Bikeshedding time ;)

I don't like "amount" in this - it ends up adding little meaning
and to me it is ugly English. It's making it clear that we are dealing
with some sort of count but that is already true of get_bytes_in_fifo()
So to my reading it adds nothing wrt to removing ambiguity.

get_number_of_bytes_in_fifo() flows better but also adds nothing over
get_bytes_in_fifo()

You could make it clear it is something that changes over time.

get_current_bytes_in_fifo()

Which at least implies it changes - though it doesn't rule out a weird
variable max size fifo.

get_fifo_bytes_available() might be the clearest option and is the one
I would prefer. It's still a little messy as it could mean
'number of bytes of data that haven't been used yet in the fifo and
are available for samples in the future'.

Sigh. Maybe least ambiguous is something longer like.

get_fifo_bytes_available_to_read()
get_fifo_bytes_available_out()

Honestly I don't care that much what you go with :)

Jonathan