From: Jonathan Cameron <jic23@kernel.org>
To: Julien Stephan <jstephan@baylibre.com>
Cc: 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>,
Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>,
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 12/15] iio: light: apds9300: use bool for event state
Date: Fri, 1 Nov 2024 16:40:29 +0000 [thread overview]
Message-ID: <20241101164029.2d15fb6d@jic23-huawei> (raw)
In-Reply-To: <20241031-iio-fix-write-event-config-signature-v2-12-2bcacbb517a2@baylibre.com>
On Thu, 31 Oct 2024 16:27:07 +0100
Julien Stephan <jstephan@baylibre.com> wrote:
> Since the write_event_config callback now uses a bool for the state
> parameter, update apds9300_set_intr_state accordingly and change intr_en
> to bool.
>
> Also update apds9300_set_power_state and power_state for consistency.
>
> Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> ---
> drivers/iio/light/apds9300.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/light/apds9300.c b/drivers/iio/light/apds9300.c
> index 95861b2a5b2d94011d894959289c5c4f06cc1efe..98bdf8bc298b664aba71d3c38d7f224808e5997d 100644
> --- a/drivers/iio/light/apds9300.c
> +++ b/drivers/iio/light/apds9300.c
> @@ -46,10 +46,10 @@
> struct apds9300_data {
> struct i2c_client *client;
> struct mutex mutex;
> - int power_state;
> + bool power_state;
> int thresh_low;
> int thresh_hi;
> - int intr_en;
> + bool intr_en;
> };
>
> /* Lux calculation */
> @@ -148,7 +148,7 @@ static int apds9300_set_thresh_hi(struct apds9300_data *data, int value)
> return 0;
> }
>
> -static int apds9300_set_intr_state(struct apds9300_data *data, int state)
> +static int apds9300_set_intr_state(struct apds9300_data *data, bool state)
> {
> int ret;
> u8 cmd;
> @@ -169,7 +169,7 @@ static int apds9300_set_intr_state(struct apds9300_data *data, int state)
> return 0;
> }
>
> -static int apds9300_set_power_state(struct apds9300_data *data, int state)
> +static int apds9300_set_power_state(struct apds9300_data *data, bool state)
There are a few calls of this where an explicit 1 or 0 is used. Those should be
updated to be bools.
I added this diff whilst applying. Shout if you disagree with it.
diff --git a/drivers/iio/light/apds9300.c b/drivers/iio/light/apds9300.c
index 98bdf8bc298b..938d76f7e312 100644
--- a/drivers/iio/light/apds9300.c
+++ b/drivers/iio/light/apds9300.c
@@ -221,7 +221,7 @@ static int apds9300_chip_init(struct apds9300_data *data)
* Disable interrupt to ensure thai it is doesn't enable
* i.e. after device soft reset
*/
- ret = apds9300_set_intr_state(data, 0);
+ ret = apds9300_set_intr_state(data, false);
if (ret < 0)
goto err;
@@ -459,8 +459,8 @@ static void apds9300_remove(struct i2c_client *client)
iio_device_unregister(indio_dev);
/* Ensure that power off and interrupts are disabled */
- apds9300_set_intr_state(data, 0);
- apds9300_set_power_state(data, 0);
+ apds9300_set_intr_state(data, false);
+ apds9300_set_power_state(data, false);
}
static int apds9300_suspend(struct device *dev)
@@ -470,7 +470,7 @@ static int apds9300_suspend(struct device *dev)
int ret;
mutex_lock(&data->mutex);
- ret = apds9300_set_power_state(data, 0);
+ ret = apds9300_set_power_state(data, false);
mutex_unlock(&data->mutex);
return ret;
@@ -483,7 +483,7 @@ static int apds9300_resume(struct device *dev)
int ret;
mutex_lock(&data->mutex);
- ret = apds9300_set_power_state(data, 1);
+ ret = apds9300_set_power_state(data, true);
mutex_unlock(&data->mutex);
return ret;
> {
> int ret;
> u8 cmd;
>
next prev parent reply other threads:[~2024-11-01 16:50 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 [this message]
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
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=20241101164029.2d15fb6d@jic23-huawei \
--to=jic23@kernel.org \
--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=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 \
--cc=subhajit.ghosh@tweaklogic.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