lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFukWp2Z0OCrJdTy+wzVs9jdCm70YNR-66q06=xoyGhaHg=aog@mail.gmail.com>
Date:   Thu, 24 Aug 2023 15:44:29 +0200
From:   Mehdi Djait <mehdi.djait.k@...il.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Matti Vaittinen <mazziesaccount@...il.com>, jic23@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, robh+dt@...nel.org,
        lars@...afoo.de, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v8 6/7] iio: accel: kionix-kx022a: Add a function to
 retrieve number of bytes in buffer

Hello Andy,
Thank you for the review.

On Thu, Aug 24, 2023 at 3:39 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Thu, Aug 24, 2023 at 03:52:56PM +0300, Matti Vaittinen wrote:
> > On 8/24/23 14:58, Andy Shevchenko wrote:
> > > On Wed, Aug 23, 2023 at 11:16:40PM +0200, Mehdi Djait wrote:
>
> ...
>
> > > > + int ret, fifo_bytes;
> > > > +
> > > > + ret = regmap_read(data->regmap, KX022A_REG_BUF_STATUS_1, &fifo_bytes);
> > > > + if (ret) {
> > > > +         dev_err(data->dev, "Error reading buffer status\n");
> > > > +         return ret;
> > > > + }
> > > > +
> > > > + if (fifo_bytes == KX022A_FIFO_FULL_VALUE)
> > > > +         return KX022A_FIFO_MAX_BYTES;
> > > > +
> > > > + return fifo_bytes;
> > >
> > > This will be called each time ->get_fifo_bytes() called.
> > > Do you expect the fifo_bytes to be changed over times?
> > > Shouldn't we simply cache the value?
> >
> > I think this value tells how many samples there currently is in the FIFO.
> > Caching it does not sound meaningful unless I am missing something.
>
> 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:

@@ -99,6 +101,7 @@ struct device;
  * @inc5: interrupt control register 5
  * @inc6: interrupt control register 6
  * @xout_l: x-axis output least significant byte
+ * @get_fifo_bytes: function pointer to get number of bytes in the FIFO buffer
  */
 struct kx022a_chip_info {
  const char *name;
@@ -121,6 +124,7 @@ struct kx022a_chip_info {
  u8 inc5;
  u8 inc6;
  u8 xout_l;
+ int (*get_fifo_bytes)(struct kx022a_data *);
 };

--
Kind Regards
Mehdi Djait

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ