[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aQJM6u9pGSdds0X3@debian-BULLSEYE-live-builder-AMD64>
Date: Wed, 29 Oct 2025 14:20:42 -0300
From: Marcelo Schmitt <marcelo.schmitt1@...il.com>
To: Antoni Pokusinski <apokusinski01@...il.com>
Cc: jic23@...nel.org, dlechner@...libre.com, nuno.sa@...log.com,
andy@...nel.org, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] iio: mpl3115: add ctrl_reg4 to mpl3115_data
Hi Antoni,
The patch itself looks good to me.
I just wonder if it would make more sense to squash it with patch 2 since part
of the code here is changed again in that patch (the mpl3115_set_trigger_state()).
On 10/28, Antoni Pokusinski wrote:
> Cache the value of CTRL_REG4 in the mpl3115_data structure. This is a
> preparation for adding support for the threshold events.
>
> Signed-off-by: Antoni Pokusinski <apokusinski01@...il.com>
> ---
> drivers/iio/pressure/mpl3115.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c
> index c212dfdf59ff..4cc103e20a39 100644
> --- a/drivers/iio/pressure/mpl3115.c
> +++ b/drivers/iio/pressure/mpl3115.c
> @@ -83,6 +83,7 @@ struct mpl3115_data {
> struct iio_trigger *drdy_trig;
> struct mutex lock;
> u8 ctrl_reg1;
> + u8 ctrl_reg4;
I think this ...
> };
>
> enum mpl3115_irq_pin {
> @@ -376,6 +377,7 @@ static int mpl3115_config_interrupt(struct mpl3115_data *data,
> goto reg1_cleanup;
>
> data->ctrl_reg1 = ctrl_reg1;
> + data->ctrl_reg4 = ctrl_reg4;
>
> return 0;
>
> @@ -390,12 +392,15 @@ static int mpl3115_set_trigger_state(struct iio_trigger *trig, bool state)
> struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
> struct mpl3115_data *data = iio_priv(indio_dev);
> u8 ctrl_reg1 = data->ctrl_reg1;
> - u8 ctrl_reg4 = state ? MPL3115_CTRL4_INT_EN_DRDY : 0;
> + u8 ctrl_reg4 = data->ctrl_reg4;
and also this is changed again in patch 2.
I don't see much advantage in having it separated from patch 2.
Might be simpler to just squash patch 1 and 2.
>
> - if (state)
> + if (state) {
> ctrl_reg1 |= MPL3115_CTRL1_ACTIVE;
> - else
> + ctrl_reg4 |= MPL3115_CTRL4_INT_EN_DRDY;
> + } else {
> ctrl_reg1 &= ~MPL3115_CTRL1_ACTIVE;
> + ctrl_reg4 &= ~MPL3115_CTRL4_INT_EN_DRDY;
> + }
>
> guard(mutex)(&data->lock);
>
> --
> 2.25.1
>
Powered by blists - more mailing lists