From: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
To: Julien Stephan <jstephan@baylibre.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Mudit Sharma <muditsharma.info@gmail.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Anshul Dalal <anshulusr@gmail.com>,
Javier Carrasco <javier.carrasco.cruz@gmail.com>,
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Cosmin Tanislav <cosmin.tanislav@analog.com>,
Ramona Gradinariu <ramona.gradinariu@analog.com>,
Antoniu Miclaus <antoniu.miclaus@analog.com>,
Dan Robertson <dan@dlrobertson.com>,
Marcelo Schmitt <marcelo.schmitt@analog.com>,
Matteo Martelli <matteomartelli3@gmail.com>,
Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>,
Michal Simek <michal.simek@amd.com>,
Mariel Tinaco <Mariel.Tinaco@analog.com>,
Jagath Jog J <jagathjog1996@gmail.com>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Kevin Tsai <ktsai@capellamicro.com>,
Linus Walleij <linus.walleij@linaro.org>,
Benson Leung <bleung@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
chrome-platform@lists.linux.dev
Subject: Re: [PATCH v2 13/15] iio: light: apds9306: simplifies if branch in apds9306_write_event_config
Date: Sun, 3 Nov 2024 01:39:25 +1030 [thread overview]
Message-ID: <43b07db2-6856-4dd2-8616-560a24d9f09a@tweaklogic.com> (raw)
In-Reply-To: <CAEHHSva6+Br9rXE9n0wqXuwQqetXN=Ae5vg0rxmPRfCVdw9atA@mail.gmail.com>
On 3/11/24 00:59, Julien Stephan wrote:
> Le sam. 2 nov. 2024 à 14:21, Subhajit Ghosh
> <subhajit.ghosh@tweaklogic.com> a écrit :
>>
>> On 2/11/24 03:11, Jonathan Cameron wrote:
>>> On Thu, 31 Oct 2024 16:27:08 +0100
>>> Julien Stephan <jstephan@baylibre.com> wrote:
>>>
>>>> Simplifies the regmap_wite if branch in apds9306_write_event_config.
>>> Applied.
>>>>
>>>> Signed-off-by: Julien Stephan <jstephan@baylibre.com>
>>>> ---
>>>> drivers/iio/light/apds9306.c | 5 +----
>>>> 1 file changed, 1 insertion(+), 4 deletions(-)
>>>>
>>>> diff --git a/drivers/iio/light/apds9306.c b/drivers/iio/light/apds9306.c
>>>> index 8adc74040db2bddf93fbb773e3519abcc726b9a6..9c08e7c3ad0c17519689a630d42fe9b90438dfe8 100644
>>>> --- a/drivers/iio/light/apds9306.c
>>>> +++ b/drivers/iio/light/apds9306.c
>>>> @@ -1125,10 +1125,7 @@ static int apds9306_write_event_config(struct iio_dev *indio_dev,
>>>> }
>>>> }
>>>> case IIO_EV_TYPE_THRESH_ADAPTIVE:
>>>> - if (state)
>>>> - return regmap_field_write(rf->int_thresh_var_en, 1);
>>>> - else
>>>> - return regmap_field_write(rf->int_thresh_var_en, 0);
>>>> + return regmap_field_write(rf->int_thresh_var_en, state);
>>>> default:
>>>> return -EINVAL;
>>>> }
>>>>
>>>
>> Hi Julien,
>> Sorry for the delay.
>> "int_thresh_var_en" corresponds to APDS9306_INT_CFG_REG bit 3 (Datasheet: INT_CFG, Address: 0x19) which
>> is a single bit value only. If user does "echo 4 > /sys/bus/iio/devices/iio:device0/events/thresh_adaptive_either_en",
>> which trickles down to the "state" variable, do we really want to write any other value except "0" or "1"?
>> Correct me if I am wrong here.
>
> Hi Subhajit,
> In drivers/iio/industrialio-event.c, iio_ev_state_store is actually
> using kstrtobool to check user input, then gives the converted boolean
> value to write_event_configOhh ok, that's handy.
> So state is a boolean. By the way the purpose of this series is to
> clean up code and use a bool instead of int for the state parameter.
Thank you Julien for your efforts.
>
> So new code is equivalent to what was there before.
> Cheers
> Julien
>
Since it is already applied, nothing much for me to do here.
Regards,
Subhajit Ghosh
next prev parent reply other threads:[~2024-11-02 15:09 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 15:26 [PATCH v2 00/15] iio: fix write_event_config signature Julien Stephan
2024-10-31 15:26 ` [PATCH v2 01/15] iio: light: ltr390: simplify code in write_event_config callback Julien Stephan
2024-11-01 15:32 ` Jonathan Cameron
2024-10-31 15:26 ` [PATCH v2 02/15] iio: proximity: hx9023s: " Julien Stephan
2024-11-01 15:34 ` Jonathan Cameron
2024-10-31 15:26 ` [PATCH v2 03/15] iio: light: tsl2772: " Julien Stephan
2024-11-01 15:35 ` Jonathan Cameron
2024-10-31 15:26 ` [PATCH v2 04/15] iio: proximity: irsd200: " Julien Stephan
2024-11-01 15:36 ` Jonathan Cameron
2024-10-31 15:27 ` [PATCH v2 05/15] iio: proximity: sx9500: " Julien Stephan
2024-11-01 15:36 ` Jonathan Cameron
2024-10-31 15:27 ` [PATCH v2 06/15] iio: light: adux1020: write_event_config: use local variable for interrupt value Julien Stephan
2024-10-31 16:27 ` David Lechner
2024-11-01 15:44 ` Jonathan Cameron
2024-11-01 18:18 ` Julien Stephan
2024-10-31 15:27 ` [PATCH v2 07/15] iio: fix write_event_config signature Julien Stephan
2024-11-01 16:32 ` Jonathan Cameron
2024-10-31 15:27 ` [PATCH v2 08/15] iio: accel: mma9551: use bool for event state Julien Stephan
2024-11-01 16:33 ` Jonathan Cameron
2024-10-31 15:27 ` [PATCH v2 09/15] iio: accel: sca3000: " Julien Stephan
2024-11-01 16:34 ` Jonathan Cameron
2024-10-31 15:27 ` [PATCH v2 10/15] iio: imu: bmi323: " Julien Stephan
2024-11-01 16:35 ` Jonathan Cameron
2024-10-31 15:27 ` [PATCH v2 11/15] iio: imu: st_lsm6dsx: " Julien Stephan
2024-11-01 16:36 ` Jonathan Cameron
2024-10-31 15:27 ` [PATCH v2 12/15] iio: light: apds9300: " Julien Stephan
2024-11-01 16:40 ` Jonathan Cameron
2024-10-31 15:27 ` [PATCH v2 13/15] iio: light: apds9306: simplifies if branch in apds9306_write_event_config Julien Stephan
2024-11-01 16:41 ` Jonathan Cameron
2024-11-02 13:21 ` Subhajit Ghosh
2024-11-02 14:29 ` Julien Stephan
2024-11-02 15:09 ` Subhajit Ghosh [this message]
2024-10-31 15:27 ` [PATCH v2 14/15] iio: light: apds9960: convert als_int and pxs_int to bool Julien Stephan
2024-11-01 16:42 ` Jonathan Cameron
2024-10-31 15:27 ` [PATCH v2 15/15] iio: light: apds9960: remove useless return Julien Stephan
2024-11-01 16:44 ` 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=43b07db2-6856-4dd2-8616-560a24d9f09a@tweaklogic.com \
--to=subhajit.ghosh@tweaklogic.com \
--cc=Mariel.Tinaco@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=anand.ashok.dumbre@xilinx.com \
--cc=anshulusr@gmail.com \
--cc=antoniu.miclaus@analog.com \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=cosmin.tanislav@analog.com \
--cc=dan@dlrobertson.com \
--cc=groeck@chromium.org \
--cc=jagathjog1996@gmail.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=jic23@kernel.org \
--cc=jstephan@baylibre.com \
--cc=ktsai@capellamicro.com \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=marcelo.schmitt@analog.com \
--cc=matteomartelli3@gmail.com \
--cc=michal.simek@amd.com \
--cc=muditsharma.info@gmail.com \
--cc=ramona.gradinariu@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox