[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241214121626.4701b84a@jic23-huawei>
Date: Sat, 14 Dec 2024 12:16:26 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Lothar Rubusch <l.rubusch@...il.com>
Cc: lars@...afoo.de, Michael.Hennerich@...log.com, robh@...nel.org,
krzk+dt@...nel.org, conor+dt@...nel.org, devicetree@...r.kernel.org,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
eraretuya@...il.com
Subject: Re: [PATCH v7 4/7] iio: accel: adxl345: introduce interrupt
handling
On Fri, 13 Dec 2024 21:19:06 +0000
Lothar Rubusch <l.rubusch@...il.com> wrote:
> Add the possibility to claim an interrupt. Init the state structure
> with an interrupt line obtained from the DT. The adxl345 can use
> two different interrupt lines for event handling. Only one is used.
>
> Signed-off-by: Lothar Rubusch <l.rubusch@...il.com>
> ---
> drivers/iio/accel/adxl345_core.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c
> index b48bc838c..fb3b45d99 100644
> --- a/drivers/iio/accel/adxl345_core.c
> +++ b/drivers/iio/accel/adxl345_core.c
> @@ -11,15 +11,22 @@
> #include <linux/property.h>
> #include <linux/regmap.h>
> #include <linux/units.h>
> +#include <linux/interrupt.h>
Keep to local style. Headers in alphabetical order (with IIO ones
separate obviously!)
>
> #include <linux/iio/iio.h>
> #include <linux/iio/sysfs.h>
>
> #include "adxl345.h"
>
> +#define ADXL345_INT_NONE 0xff
> +#define ADXL345_INT1 0
> +#define ADXL345_INT2 1
> +
> struct adxl345_state {
> + int irq;
Whilst it doesn't really matter. I'm not seeing any logic in having this as first
element and intio as last. Might as well put them both at the end.
> const struct adxl345_chip_info *info;
> struct regmap *regmap;
> + u8 intio;
> };
>
> #define ADXL345_CHANNEL(index, axis) { \
> @@ -213,6 +220,7 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap,
>
> st = iio_priv(indio_dev);
> st->regmap = regmap;
> +
Check patches for unrelated changes like this and drop them as they are noise.
If you want to tidy this sort of whitespace up, separate patch.
> st->info = device_get_match_data(dev);
> if (!st->info)
> return -ENODEV;
> @@ -263,6 +271,15 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap,
> if (ret < 0)
> return ret;
>
> + st->intio = ADXL345_INT1;
> + st->irq = fwnode_irq_get_byname(dev_fwnode(dev), "INT1");
> + if (st->irq < 0) {
> + st->intio = ADXL345_INT2;
> + st->irq = fwnode_irq_get_byname(dev_fwnode(dev), "INT2");
> + if (st->irq < 0)
> + st->intio = ADXL345_INT_NONE;
As in the DT binding, maybe we can fall back to an assumption of default.
So if interrupt names missing we assume INT1.
> + }
> +
> return devm_iio_device_register(dev, indio_dev);
> }
> EXPORT_SYMBOL_NS_GPL(adxl345_core_probe, IIO_ADXL345);
Powered by blists - more mailing lists