linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mehdi Djait <mehdi.djait.k@gmail.com>,
	krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org,
	lars@metafoo.de, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v8 6/7] iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer
Date: Mon, 28 Aug 2023 09:24:25 +0300	[thread overview]
Message-ID: <61247547-690c-fb8b-3a45-cd60754836a7@gmail.com> (raw)
In-Reply-To: <20230827190732.5e2215d0@jic23-huawei>

On 8/27/23 21:09, Jonathan Cameron wrote:
> 
>>>>>> 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 :)

If this was a democracy (which it isn't) - my vote would go for "leave 
as it is" because the concept of a data collecting fifo where amount of 
data acquired in FIFO is readable from a register is common enough. I 
think that people who work on a driver like this should guess what this 
is for. Besides, if anything more than looking at the code is needed, 
then the plain guessing won't do and one needs anyway to open the 
data-sheet.

 From my perspective this series adds a nice value and is good to go.

Just my 10 cents though :)

Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~


  reply	other threads:[~2023-08-28  6:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23 21:16 [PATCH v8 0/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-08-23 21:16 ` [PATCH v8 1/7] dt-bindings: iio: Add " Mehdi Djait
2023-08-23 21:16 ` [PATCH v8 2/7] iio: accel: kionix-kx022a: Remove blank lines Mehdi Djait
2023-08-24 11:49   ` Andy Shevchenko
2023-08-23 21:16 ` [PATCH v8 3/7] iio: accel: kionix-kx022a: Warn on failed matches and assume compatibility Mehdi Djait
2023-08-24 11:51   ` Andy Shevchenko
2023-08-27 17:57     ` Jonathan Cameron
2023-08-23 21:16 ` [PATCH v8 4/7] iio: accel: kionix-kx022a: Add an i2c_device_id table Mehdi Djait
2023-08-24 11:52   ` Andy Shevchenko
2023-08-23 21:16 ` [PATCH v8 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure Mehdi Djait
2023-08-24 11:55   ` Andy Shevchenko
2023-08-23 21:16 ` [PATCH v8 6/7] iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer Mehdi Djait
2023-08-24 11:58   ` Andy Shevchenko
2023-08-24 12:52     ` Matti Vaittinen
2023-08-24 13:39       ` Andy Shevchenko
2023-08-24 13:44         ` Mehdi Djait
2023-08-24 13:47           ` Andy Shevchenko
2023-08-24 14:23             ` Mehdi Djait
2023-08-24 14:39               ` Andy Shevchenko
2023-08-27 18:09                 ` Jonathan Cameron
2023-08-28  6:24                   ` Matti Vaittinen [this message]
2023-08-28 10:53                     ` Andy Shevchenko
2023-08-29  6:33                       ` Matti Vaittinen
2023-09-06 16:03                         ` Andy Shevchenko
2023-09-07  6:33                           ` Matti Vaittinen
2023-09-11 13:03                             ` Andy Shevchenko
2023-08-23 21:16 ` [PATCH v8 7/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-08-24 12:02   ` Andy Shevchenko
2023-08-24 12:51     ` Matti Vaittinen
2023-08-24 13:39       ` 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=61247547-690c-fb8b-3a45-cd60754836a7@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mehdi.djait.k@gmail.com \
    --cc=robh+dt@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).