All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Puranjay Mohan <puranjay12@gmail.com>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	"Bogdan, Dragos" <Dragos.Bogdan@analog.com>,
	Darius <Darius.Berghe@analog.com>
Subject: Re: [PATCH] iio: accel: adxl355: Add triggered buffer support
Date: Fri, 13 Aug 2021 13:03:25 +0300	[thread overview]
Message-ID: <CAHp75VfK3BwVBSQu-A03aiWoapXb1Eo+NhThnKLPp=WA15365Q@mail.gmail.com> (raw)
In-Reply-To: <20210813083455.252986-1-puranjay12@gmail.com>

On Fri, Aug 13, 2021 at 11:35 AM Puranjay Mohan <puranjay12@gmail.com> wrote:
>
> Provide a way for continuous data capture by setting up buffer support. The
> data ready signal exposed at the DRDY pin of the ADXL355 is exploited as
> a hardware interrupt which triggers to fill the buffer.

...

>   *
>   * Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/adxl354_adxl355.pdf
>   */
> -

Unrelated change.

...

> +#include <linux/iio/buffer.h>
>  #include <linux/iio/iio.h>
> +#include <linux/iio/trigger.h>
> +#include <linux/iio/triggered_buffer.h>
> +#include <linux/iio/trigger_consumer.h>

I would rather regroup this like

linux/*

asm/*

linux/iio*

...

> +#include <linux/of_irq.h>

Okay, this is due to the absence of generic fwnode_irq_get_byname() or so.

...

>  struct adxl355_data {

> +       int irq;

Depending on container_of and frequency of usage this is not a good
location for this.
Strating from regmap pointer is much better (no pointer arithmetics involved).

>         struct regmap *regmap;
>         struct device *dev;
>         struct mutex lock; /* lock to protect op_mode */

>  };

...

> +       ret = regmap_bulk_read(data->regmap, ADXL355_XDATA3_REG,
> +                              &data->buffer.buf[1],
> +                              3);

ARRAY_SIZE()? Or put this 3 to the previous line, it will be easier to read.

Ditto for the rest of the similar code.

> +       if (ret)
> +               goto out_unlock_notify;

...

> +       /*
> +        * Would be good to move it to the generic version.

Something like "TODO: Would be..." ?

> +        */
> +       ret = of_irq_get_byname(dev->of_node, "DRDY");
> +       if (ret > 0)
> +               data->irq = ret;

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2021-08-13 10:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13  8:34 [PATCH] iio: accel: adxl355: Add triggered buffer support Puranjay Mohan
2021-08-13 10:03 ` Andy Shevchenko [this message]
2021-08-15 15:04 ` Jonathan Cameron

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='CAHp75VfK3BwVBSQu-A03aiWoapXb1Eo+NhThnKLPp=WA15365Q@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=Darius.Berghe@analog.com \
    --cc=Dragos.Bogdan@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=puranjay12@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.