From: Julien Stephan <jstephan@baylibre.com>
To: Mudit Sharma <muditsharma.info@gmail.com>,
Jonathan Cameron <jic23@kernel.org>,
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>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
chrome-platform@lists.linux.dev,
Julien Stephan <jstephan@baylibre.com>
Subject: [PATCH 1/7] iio: light: bh1745: simplify code in write_event_config callback
Date: Thu, 24 Oct 2024 11:11:23 +0200 [thread overview]
Message-ID: <20241024-iio-fix-write-event-config-signature-v1-1-7d29e5a31b00@baylibre.com> (raw)
In-Reply-To: <20241024-iio-fix-write-event-config-signature-v1-0-7d29e5a31b00@baylibre.com>
iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.
Remove useless code in write_event_config callback.
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
---
drivers/iio/light/bh1745.c | 48 +++++++++++++++++++++-------------------------
1 file changed, 22 insertions(+), 26 deletions(-)
diff --git a/drivers/iio/light/bh1745.c b/drivers/iio/light/bh1745.c
index 2e458e9d5d85308fb6a13d9dbd845fa03b56a40e..fc6bf062d4f510886f909509d8115f0cf892f3c4 100644
--- a/drivers/iio/light/bh1745.c
+++ b/drivers/iio/light/bh1745.c
@@ -643,41 +643,37 @@ static int bh1745_write_event_config(struct iio_dev *indio_dev,
struct bh1745_data *data = iio_priv(indio_dev);
int value;
- if (state == 0)
+ if (!state)
return regmap_clear_bits(data->regmap,
BH1745_INTR, BH1745_INTR_ENABLE);
- if (state == 1) {
- /* Latch is always enabled when enabling interrupt */
- value = BH1745_INTR_ENABLE;
+ /* Latch is always enabled when enabling interrupt */
+ value = BH1745_INTR_ENABLE;
- switch (chan->channel2) {
- case IIO_MOD_LIGHT_RED:
- return regmap_write(data->regmap, BH1745_INTR,
- value | FIELD_PREP(BH1745_INTR_SOURCE_MASK,
- BH1745_INTR_SOURCE_RED));
+ switch (chan->channel2) {
+ case IIO_MOD_LIGHT_RED:
+ return regmap_write(data->regmap, BH1745_INTR,
+ value | FIELD_PREP(BH1745_INTR_SOURCE_MASK,
+ BH1745_INTR_SOURCE_RED));
- case IIO_MOD_LIGHT_GREEN:
- return regmap_write(data->regmap, BH1745_INTR,
- value | FIELD_PREP(BH1745_INTR_SOURCE_MASK,
- BH1745_INTR_SOURCE_GREEN));
+ case IIO_MOD_LIGHT_GREEN:
+ return regmap_write(data->regmap, BH1745_INTR,
+ value | FIELD_PREP(BH1745_INTR_SOURCE_MASK,
+ BH1745_INTR_SOURCE_GREEN));
- case IIO_MOD_LIGHT_BLUE:
- return regmap_write(data->regmap, BH1745_INTR,
- value | FIELD_PREP(BH1745_INTR_SOURCE_MASK,
- BH1745_INTR_SOURCE_BLUE));
+ case IIO_MOD_LIGHT_BLUE:
+ return regmap_write(data->regmap, BH1745_INTR,
+ value | FIELD_PREP(BH1745_INTR_SOURCE_MASK,
+ BH1745_INTR_SOURCE_BLUE));
- case IIO_MOD_LIGHT_CLEAR:
- return regmap_write(data->regmap, BH1745_INTR,
- value | FIELD_PREP(BH1745_INTR_SOURCE_MASK,
- BH1745_INTR_SOURCE_CLEAR));
+ case IIO_MOD_LIGHT_CLEAR:
+ return regmap_write(data->regmap, BH1745_INTR,
+ value | FIELD_PREP(BH1745_INTR_SOURCE_MASK,
+ BH1745_INTR_SOURCE_CLEAR));
- default:
- return -EINVAL;
- }
+ default:
+ return -EINVAL;
}
-
- return -EINVAL;
}
static int bh1745_read_avail(struct iio_dev *indio_dev,
--
2.47.0
next prev parent reply other threads:[~2024-10-24 9:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 9:11 [PATCH 0/7] iio: fix write_event_config signature Julien Stephan
2024-10-24 9:11 ` Julien Stephan [this message]
2024-10-26 12:20 ` [PATCH 1/7] iio: light: bh1745: simplify code in write_event_config callback Jonathan Cameron
2024-10-24 9:11 ` [PATCH 2/7] iio: light: ltr390: " Julien Stephan
2024-10-26 12:22 ` Jonathan Cameron
2024-10-24 9:11 ` [PATCH 3/7] iio: light: ltr501: " Julien Stephan
2024-10-26 12:23 ` Jonathan Cameron
2024-10-24 9:11 ` [PATCH 4/7] iio: light: veml6030: " Julien Stephan
2024-10-26 12:25 ` Jonathan Cameron
2024-10-24 9:11 ` [PATCH 5/7] iio: imu: inv_mpu6050: " Julien Stephan
2024-10-24 12:16 ` Jean-Baptiste Maneyrol
2024-10-26 12:27 ` Jonathan Cameron
2024-10-24 9:11 ` [PATCH 6/7] iio: light: stk3310: " Julien Stephan
2024-10-26 12:30 ` Jonathan Cameron
2024-10-24 9:11 ` [PATCH 7/7] iio: fix write_event_config signature Julien Stephan
2024-10-26 12:59 ` Jonathan Cameron
2024-10-30 14:07 ` Julien Stephan
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=20241024-iio-fix-write-event-config-signature-v1-1-7d29e5a31b00@baylibre.com \
--to=jstephan@baylibre.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=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;
as well as URLs for NNTP newsgroup(s).