public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and
@ 2026-02-18  4:37 Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 1/9] iio: light: gp2ap020a00f: simplify locking with guard() Ethan Tidmore
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-18  4:37 UTC (permalink / raw)
  To: jic23, andy; +Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Ethan Tidmore

This series performs a general cleanup of the gp2ap020a00f IIO driver.

It integrates my original work switching to the guard() cleanup handler,
fixing a signedness warning from Smatch, and cleanups provided by 
Andy Shevchenko [1].

v4:
 - Integrated Andy Shevchenko's 7-patch cleanup series.
 - Patch 1: Removed redundant 'err' variable and whitespace issues as
   suggested by Andy.
 - Patch 2: Added Reviewed-by tag from Andy Shevchenko.
 - Patch 5: Updated commit message to describe the pre-existing bug fix
   in gp2ap020a00f_buffer_predisable() where errors could be swallowed.
v3:
 - Addressed initial feedback and simplified locking logic.

[1] https://lore.kernel.org/all/20260217102318.1354103-1-andriy.shevchenko@linux.intel.com/

Andy Shevchenko (7):
  iio: light: gp2ap020a00f: Use correct types for 16-bit LE data
  iio: light: gp2ap020a00f: Replace custom implementation of min()
  iio: light: gp2ap020a00f: Return directly from the switch cases
  iio: light: gp2ap020a00f: Use temporary variable for struct device
  iio: light: gp2ap020a00f: Explicitly use string literal for driver
    name
  iio: light: gp2ap020a00f: Remove trailing comma in termination entry
  iio: light: gp2ap020a00f: Join some lines of code to be a single line

Ethan Tidmore (2):
  iio: light: gp2ap020a00f: simplify locking with guard()
  iio: light: gp2ap020a00f: correct return type to int

 drivers/iio/light/gp2ap020a00f.c | 287 ++++++++++++-------------------
 1 file changed, 112 insertions(+), 175 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v4 1/9] iio: light: gp2ap020a00f: simplify locking with guard()
  2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
@ 2026-02-18  4:37 ` Ethan Tidmore
  2026-02-18  7:08   ` Andy Shevchenko
  2026-02-18  4:37 ` [PATCH v4 2/9] iio: light: gp2ap020a00f: correct return type to int Ethan Tidmore
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-18  4:37 UTC (permalink / raw)
  To: jic23, andy; +Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Ethan Tidmore

Use the guard() cleanup handler to manage the device lock.
This simplifies the code by removing the need for manual unlocking
and goto error handling paths.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
v4:
- Remove whitespace between assignment and check.
v3:
- Remove Fixes: tag.
- Added Smatch warning.
v2:
- Fixed gp2ap020a00f_get_thresh_reg() parameter alignment.
- Removed unneeded whitespace between assignment and check.

 drivers/iio/light/gp2ap020a00f.c | 66 ++++++++++----------------------
 1 file changed, 20 insertions(+), 46 deletions(-)

diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index c7df4b258e2c..91fdcb980111 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -31,6 +31,7 @@
  * the other one.
  */
 
+#include <linux/cleanup.h>
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
@@ -1024,17 +1025,13 @@ static int gp2ap020a00f_write_event_val(struct iio_dev *indio_dev,
 	bool event_en = false;
 	u8 thresh_val_id;
 	u8 thresh_reg_l;
-	int err = 0;
 
-	mutex_lock(&data->lock);
+	guard(mutex)(&data->lock);
 
 	thresh_reg_l = gp2ap020a00f_get_thresh_reg(chan, dir);
 	thresh_val_id = GP2AP020A00F_THRESH_VAL_ID(thresh_reg_l);
-
-	if (thresh_val_id > GP2AP020A00F_THRESH_PH) {
-		err = -EINVAL;
-		goto error_unlock;
-	}
+	if (thresh_val_id > GP2AP020A00F_THRESH_PH)
+		return -EINVAL;
 
 	switch (thresh_reg_l) {
 	case GP2AP020A00F_TH_L_REG:
@@ -1046,30 +1043,23 @@ static int gp2ap020a00f_write_event_val(struct iio_dev *indio_dev,
 							&data->flags);
 		break;
 	case GP2AP020A00F_PH_L_REG:
-		if (val == 0) {
-			err = -EINVAL;
-			goto error_unlock;
-		}
+		if (val == 0)
+			return -EINVAL;
+
 		event_en = test_bit(GP2AP020A00F_FLAG_PROX_RISING_EV,
 							&data->flags);
 		break;
 	case GP2AP020A00F_PL_L_REG:
-		if (val == 0) {
-			err = -EINVAL;
-			goto error_unlock;
-		}
+		if (val == 0)
+			return -EINVAL;
+
 		event_en = test_bit(GP2AP020A00F_FLAG_PROX_FALLING_EV,
 							&data->flags);
 		break;
 	}
 
 	data->thresh_val[thresh_val_id] = val;
-	err =  gp2ap020a00f_write_event_threshold(data, thresh_val_id,
-							event_en);
-error_unlock:
-	mutex_unlock(&data->lock);
-
-	return err;
+	return gp2ap020a00f_write_event_threshold(data, thresh_val_id, event_en);
 }
 
 static int gp2ap020a00f_read_event_val(struct iio_dev *indio_dev,
@@ -1081,23 +1071,16 @@ static int gp2ap020a00f_read_event_val(struct iio_dev *indio_dev,
 {
 	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
 	u8 thresh_reg_l;
-	int err = IIO_VAL_INT;
 
-	mutex_lock(&data->lock);
+	guard(mutex)(&data->lock);
 
 	thresh_reg_l = gp2ap020a00f_get_thresh_reg(chan, dir);
-
-	if (thresh_reg_l > GP2AP020A00F_PH_L_REG) {
-		err = -EINVAL;
-		goto error_unlock;
-	}
+	if (thresh_reg_l > GP2AP020A00F_PH_L_REG)
+		return -EINVAL;
 
 	*val = data->thresh_val[GP2AP020A00F_THRESH_VAL_ID(thresh_reg_l)];
 
-error_unlock:
-	mutex_unlock(&data->lock);
-
-	return err;
+	return IIO_VAL_INT;
 }
 
 static int gp2ap020a00f_write_prox_event_config(struct iio_dev *indio_dev,
@@ -1165,7 +1148,7 @@ static int gp2ap020a00f_write_event_config(struct iio_dev *indio_dev,
 	enum gp2ap020a00f_cmd cmd;
 	int err;
 
-	mutex_lock(&data->lock);
+	guard(mutex)(&data->lock);
 
 	switch (chan->type) {
 	case IIO_PROXIMITY:
@@ -1186,8 +1169,6 @@ static int gp2ap020a00f_write_event_config(struct iio_dev *indio_dev,
 		err = -EINVAL;
 	}
 
-	mutex_unlock(&data->lock);
-
 	return err;
 }
 
@@ -1199,7 +1180,7 @@ static int gp2ap020a00f_read_event_config(struct iio_dev *indio_dev,
 	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
 	int event_en = 0;
 
-	mutex_lock(&data->lock);
+	guard(mutex)(&data->lock);
 
 	switch (chan->type) {
 	case IIO_PROXIMITY:
@@ -1223,8 +1204,6 @@ static int gp2ap020a00f_read_event_config(struct iio_dev *indio_dev,
 		break;
 	}
 
-	mutex_unlock(&data->lock);
-
 	return event_en;
 }
 
@@ -1385,7 +1364,7 @@ static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
 	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
 	int i, err = 0;
 
-	mutex_lock(&data->lock);
+	guard(mutex)(&data->lock);
 
 	/*
 	 * Enable triggers according to the scan_mask. Enabling either
@@ -1413,15 +1392,12 @@ static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
 	}
 
 	if (err < 0)
-		goto error_unlock;
+		return err;
 
 	data->buffer = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
 	if (!data->buffer)
 		err = -ENOMEM;
 
-error_unlock:
-	mutex_unlock(&data->lock);
-
 	return err;
 }
 
@@ -1430,7 +1406,7 @@ static int gp2ap020a00f_buffer_predisable(struct iio_dev *indio_dev)
 	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
 	int i, err = 0;
 
-	mutex_lock(&data->lock);
+	guard(mutex)(&data->lock);
 
 	iio_for_each_active_channel(indio_dev, i) {
 		switch (i) {
@@ -1452,8 +1428,6 @@ static int gp2ap020a00f_buffer_predisable(struct iio_dev *indio_dev)
 	if (err == 0)
 		kfree(data->buffer);
 
-	mutex_unlock(&data->lock);
-
 	return err;
 }
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 2/9] iio: light: gp2ap020a00f: correct return type to int
  2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 1/9] iio: light: gp2ap020a00f: simplify locking with guard() Ethan Tidmore
@ 2026-02-18  4:37 ` Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 3/9] iio: light: gp2ap020a00f: Use correct types for 16-bit LE data Ethan Tidmore
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-18  4:37 UTC (permalink / raw)
  To: jic23, andy
  Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Ethan Tidmore,
	Andy Shevchenko

The function gp2ap020a00f_get_thresh_reg() can return -EINVAL in its
error path. Yet, the function has return type of u8. Added error
checking for gp2ap020a00f_get_thresh_reg() return value.

Detected by Smatch:
drivers/iio/light/gp2ap020a00f.c:1013 gp2ap020a00f_get_thresh_reg() warn:
signedness bug returning '(-22)'

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
v4:
- Added Reviewed-by: tag from Andy Shevchenko.
v3:
- Remove Fixes: tag.
- Added Smatch warning.
v2:
- Fixed gp2ap020a00f_get_thresh_reg() parameter alignment.
- Removed unneeded whitespace between assignment and check.

 drivers/iio/light/gp2ap020a00f.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index 91fdcb980111..deca9fd77fdd 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -993,8 +993,8 @@ static irqreturn_t gp2ap020a00f_trigger_handler(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-static u8 gp2ap020a00f_get_thresh_reg(const struct iio_chan_spec *chan,
-					     enum iio_event_direction event_dir)
+static int gp2ap020a00f_get_thresh_reg(const struct iio_chan_spec *chan,
+				       enum iio_event_direction event_dir)
 {
 	switch (chan->type) {
 	case IIO_PROXIMITY:
@@ -1024,11 +1024,14 @@ static int gp2ap020a00f_write_event_val(struct iio_dev *indio_dev,
 	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
 	bool event_en = false;
 	u8 thresh_val_id;
-	u8 thresh_reg_l;
+	int thresh_reg_l;
 
 	guard(mutex)(&data->lock);
 
 	thresh_reg_l = gp2ap020a00f_get_thresh_reg(chan, dir);
+	if (thresh_reg_l < 0)
+		return thresh_reg_l;
+
 	thresh_val_id = GP2AP020A00F_THRESH_VAL_ID(thresh_reg_l);
 	if (thresh_val_id > GP2AP020A00F_THRESH_PH)
 		return -EINVAL;
@@ -1070,11 +1073,13 @@ static int gp2ap020a00f_read_event_val(struct iio_dev *indio_dev,
 				       int *val, int *val2)
 {
 	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
-	u8 thresh_reg_l;
+	int thresh_reg_l;
 
 	guard(mutex)(&data->lock);
 
 	thresh_reg_l = gp2ap020a00f_get_thresh_reg(chan, dir);
+	if (thresh_reg_l < 0)
+		return thresh_reg_l;
 	if (thresh_reg_l > GP2AP020A00F_PH_L_REG)
 		return -EINVAL;
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 3/9] iio: light: gp2ap020a00f: Use correct types for 16-bit LE data
  2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 1/9] iio: light: gp2ap020a00f: simplify locking with guard() Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 2/9] iio: light: gp2ap020a00f: correct return type to int Ethan Tidmore
@ 2026-02-18  4:37 ` Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 4/9] iio: light: gp2ap020a00f: Replace custom implementation of min() Ethan Tidmore
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-18  4:37 UTC (permalink / raw)
  To: jic23, andy
  Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Andy Shevchenko,
	Ethan Tidmore

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Instead of using byte arrays and then explicit castings, change
the types of byte arrays to be __le16 and update the endianness
conversions accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
v4:
- Integrate Andy Shevchenko's cleanups.

 drivers/iio/light/gp2ap020a00f.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index deca9fd77fdd..82b078f6a43d 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -462,7 +462,7 @@ static int gp2ap020a00f_write_event_threshold(struct gp2ap020a00f_data *data,
 
 	return regmap_bulk_write(data->regmap,
 				 GP2AP020A00F_THRESH_REG(th_val_id),
-				 (u8 *)&thresh_buf, 2);
+				 &thresh_buf, sizeof(thresh_buf));
 }
 
 static int gp2ap020a00f_alter_opmode(struct gp2ap020a00f_data *data,
@@ -698,18 +698,18 @@ static int wait_conversion_complete_irq(struct gp2ap020a00f_data *data)
 static int gp2ap020a00f_read_output(struct gp2ap020a00f_data *data,
 					unsigned int output_reg, int *val)
 {
-	u8 reg_buf[2];
+	__le16 reg_buf;
 	int err;
 
 	err = wait_conversion_complete_irq(data);
 	if (err < 0)
 		dev_dbg(&data->client->dev, "data ready timeout\n");
 
-	err = regmap_bulk_read(data->regmap, output_reg, reg_buf, 2);
+	err = regmap_bulk_read(data->regmap, output_reg, &reg_buf, sizeof(reg_buf));
 	if (err < 0)
 		return err;
 
-	*val = le16_to_cpup((__le16 *)reg_buf);
+	*val = le16_to_cpu(reg_buf);
 
 	return err;
 }
@@ -867,8 +867,9 @@ static irqreturn_t gp2ap020a00f_thresh_event_handler(int irq, void *data)
 {
 	struct iio_dev *indio_dev = data;
 	struct gp2ap020a00f_data *priv = iio_priv(indio_dev);
-	u8 op_reg_flags, d0_reg_buf[2];
 	unsigned int output_val, op_reg_val;
+	__le16 d0_reg_buf;
+	u8 op_reg_flags;
 	int thresh_val_id, ret;
 
 	/* Read interrupt flags */
@@ -896,11 +897,11 @@ static irqreturn_t gp2ap020a00f_thresh_event_handler(int irq, void *data)
 		 * transition is required.
 		 */
 		ret = regmap_bulk_read(priv->regmap, GP2AP020A00F_D0_L_REG,
-							d0_reg_buf, 2);
+				       &d0_reg_buf, sizeof(d0_reg_buf));
 		if (ret < 0)
 			goto done;
 
-		output_val = le16_to_cpup((__le16 *)d0_reg_buf);
+		output_val = le16_to_cpu(d0_reg_buf);
 
 		if (gp2ap020a00f_adjust_lux_mode(priv, output_val))
 			goto done;
@@ -967,17 +968,15 @@ static irqreturn_t gp2ap020a00f_trigger_handler(int irq, void *data)
 	int i, out_val, ret;
 
 	iio_for_each_active_channel(indio_dev, i) {
-		ret = regmap_bulk_read(priv->regmap,
-				GP2AP020A00F_DATA_REG(i),
-				&priv->buffer[d_size], 2);
+		ret = regmap_bulk_read(priv->regmap, GP2AP020A00F_DATA_REG(i),
+				       &priv->buffer[d_size], 2);
 		if (ret < 0)
 			goto done;
 
 		if (i == GP2AP020A00F_SCAN_MODE_LIGHT_CLEAR ||
 		    i == GP2AP020A00F_SCAN_MODE_LIGHT_IR) {
-			out_val = le16_to_cpup((__le16 *)&priv->buffer[d_size]);
+			out_val = get_unaligned_le16(&priv->buffer[d_size]);
 			gp2ap020a00f_output_to_lux(priv, &out_val);
-
 			put_unaligned_le32(out_val, &priv->buffer[d_size]);
 			d_size += 4;
 		} else {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 4/9] iio: light: gp2ap020a00f: Replace custom implementation of min()
  2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
                   ` (2 preceding siblings ...)
  2026-02-18  4:37 ` [PATCH v4 3/9] iio: light: gp2ap020a00f: Use correct types for 16-bit LE data Ethan Tidmore
@ 2026-02-18  4:37 ` Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 5/9] iio: light: gp2ap020a00f: Return directly from the switch cases Ethan Tidmore
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-18  4:37 UTC (permalink / raw)
  To: jic23, andy
  Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Andy Shevchenko,
	Ethan Tidmore

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Replace custom implementation of min() to save a few lines of code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
v4:
- Integrate Andy Shevchenko's cleanups.

 drivers/iio/light/gp2ap020a00f.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index 82b078f6a43d..4afdd22499f3 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -38,6 +38,7 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irq_work.h>
+#include <linux/minmax.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
 #include <linux/mutex.h>
@@ -45,6 +46,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/unaligned.h>
+
 #include <linux/iio/buffer.h>
 #include <linux/iio/events.h>
 #include <linux/iio/iio.h>
@@ -454,9 +456,7 @@ static int gp2ap020a00f_write_event_threshold(struct gp2ap020a00f_data *data,
 		 */
 		thresh_reg_val = data->thresh_val[th_val_id] / 16;
 	else
-		thresh_reg_val = data->thresh_val[th_val_id] > 16000 ?
-					16000 :
-					data->thresh_val[th_val_id];
+		thresh_reg_val = min(data->thresh_val[th_val_id], 16000U);
 
 	thresh_buf = cpu_to_le16(thresh_reg_val);
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 5/9] iio: light: gp2ap020a00f: Return directly from the switch cases
  2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
                   ` (3 preceding siblings ...)
  2026-02-18  4:37 ` [PATCH v4 4/9] iio: light: gp2ap020a00f: Replace custom implementation of min() Ethan Tidmore
@ 2026-02-18  4:37 ` Ethan Tidmore
  2026-02-19 19:32   ` Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 6/9] iio: light: gp2ap020a00f: Use temporary variable for struct device Ethan Tidmore
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-18  4:37 UTC (permalink / raw)
  To: jic23, andy
  Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Andy Shevchenko,
	Ethan Tidmore

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Return directly from the switch cases which makes code easier to follow.
In some cases convert pieces to the standard pattern which also unifies
it with the accepted kernel practices.

By doing this, it appears to have fixed a preexisting bug, the variable
err in  gp2ap020a00f_buffer_predisable() is only checked once for errors
after the for loop is finished. This could allow errors to be swallowed.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
v4:
- Integrate Andy Shevchenko's cleanups.

 drivers/iio/light/gp2ap020a00f.c | 96 ++++++++++++--------------------
 1 file changed, 37 insertions(+), 59 deletions(-)

diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index 4afdd22499f3..f9ff8bbbe5ec 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -494,27 +494,24 @@ static int gp2ap020a00f_alter_opmode(struct gp2ap020a00f_data *data,
 static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 					enum gp2ap020a00f_cmd cmd)
 {
-	int err = 0;
+	int err;
 
 	switch (cmd) {
 	case GP2AP020A00F_CMD_READ_RAW_CLEAR:
 		if (data->cur_opmode != GP2AP020A00F_OPMODE_SHUTDOWN)
 			return -EBUSY;
-		err = gp2ap020a00f_set_operation_mode(data,
+		return gp2ap020a00f_set_operation_mode(data,
 					GP2AP020A00F_OPMODE_READ_RAW_CLEAR);
-		break;
 	case GP2AP020A00F_CMD_READ_RAW_IR:
 		if (data->cur_opmode != GP2AP020A00F_OPMODE_SHUTDOWN)
 			return -EBUSY;
-		err = gp2ap020a00f_set_operation_mode(data,
+		return gp2ap020a00f_set_operation_mode(data,
 					GP2AP020A00F_OPMODE_READ_RAW_IR);
-		break;
 	case GP2AP020A00F_CMD_READ_RAW_PROXIMITY:
 		if (data->cur_opmode != GP2AP020A00F_OPMODE_SHUTDOWN)
 			return -EBUSY;
-		err = gp2ap020a00f_set_operation_mode(data,
+		return gp2ap020a00f_set_operation_mode(data,
 					GP2AP020A00F_OPMODE_READ_RAW_PROXIMITY);
-		break;
 	case GP2AP020A00F_CMD_TRIGGER_CLEAR_EN:
 		if (data->cur_opmode == GP2AP020A00F_OPMODE_PROX_DETECT)
 			return -EBUSY;
@@ -522,16 +519,17 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 			err = gp2ap020a00f_alter_opmode(data,
 						GP2AP020A00F_OPMODE_ALS,
 						GP2AP020A00F_ADD_MODE);
+		else
+			err = 0;
 		set_bit(GP2AP020A00F_FLAG_ALS_CLEAR_TRIGGER, &data->flags);
-		break;
+		return err;
 	case GP2AP020A00F_CMD_TRIGGER_CLEAR_DIS:
 		clear_bit(GP2AP020A00F_FLAG_ALS_CLEAR_TRIGGER, &data->flags);
 		if (gp2ap020a00f_als_enabled(data))
 			break;
-		err = gp2ap020a00f_alter_opmode(data,
+		return gp2ap020a00f_alter_opmode(data,
 						GP2AP020A00F_OPMODE_ALS,
 						GP2AP020A00F_SUBTRACT_MODE);
-		break;
 	case GP2AP020A00F_CMD_TRIGGER_IR_EN:
 		if (data->cur_opmode == GP2AP020A00F_OPMODE_PROX_DETECT)
 			return -EBUSY;
@@ -539,16 +537,17 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 			err = gp2ap020a00f_alter_opmode(data,
 						GP2AP020A00F_OPMODE_ALS,
 						GP2AP020A00F_ADD_MODE);
+		else
+			err = 0;
 		set_bit(GP2AP020A00F_FLAG_ALS_IR_TRIGGER, &data->flags);
-		break;
+		return err;
 	case GP2AP020A00F_CMD_TRIGGER_IR_DIS:
 		clear_bit(GP2AP020A00F_FLAG_ALS_IR_TRIGGER, &data->flags);
 		if (gp2ap020a00f_als_enabled(data))
 			break;
-		err = gp2ap020a00f_alter_opmode(data,
+		return gp2ap020a00f_alter_opmode(data,
 						GP2AP020A00F_OPMODE_ALS,
 						GP2AP020A00F_SUBTRACT_MODE);
-		break;
 	case GP2AP020A00F_CMD_TRIGGER_PROX_EN:
 		if (data->cur_opmode == GP2AP020A00F_OPMODE_PROX_DETECT)
 			return -EBUSY;
@@ -556,13 +555,12 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 						GP2AP020A00F_OPMODE_PS,
 						GP2AP020A00F_ADD_MODE);
 		set_bit(GP2AP020A00F_FLAG_PROX_TRIGGER, &data->flags);
-		break;
+		return err;
 	case GP2AP020A00F_CMD_TRIGGER_PROX_DIS:
 		clear_bit(GP2AP020A00F_FLAG_PROX_TRIGGER, &data->flags);
-		err = gp2ap020a00f_alter_opmode(data,
+		return gp2ap020a00f_alter_opmode(data,
 						GP2AP020A00F_OPMODE_PS,
 						GP2AP020A00F_SUBTRACT_MODE);
-		break;
 	case GP2AP020A00F_CMD_ALS_HIGH_EV_EN:
 		if (test_bit(GP2AP020A00F_FLAG_ALS_RISING_EV, &data->flags))
 			return 0;
@@ -576,9 +574,8 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 				return err;
 		}
 		set_bit(GP2AP020A00F_FLAG_ALS_RISING_EV, &data->flags);
-		err =  gp2ap020a00f_write_event_threshold(data,
+		return gp2ap020a00f_write_event_threshold(data,
 					GP2AP020A00F_THRESH_TH, true);
-		break;
 	case GP2AP020A00F_CMD_ALS_HIGH_EV_DIS:
 		if (!test_bit(GP2AP020A00F_FLAG_ALS_RISING_EV, &data->flags))
 			return 0;
@@ -590,9 +587,8 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 			if (err < 0)
 				return err;
 		}
-		err =  gp2ap020a00f_write_event_threshold(data,
+		return gp2ap020a00f_write_event_threshold(data,
 					GP2AP020A00F_THRESH_TH, false);
-		break;
 	case GP2AP020A00F_CMD_ALS_LOW_EV_EN:
 		if (test_bit(GP2AP020A00F_FLAG_ALS_FALLING_EV, &data->flags))
 			return 0;
@@ -606,9 +602,8 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 				return err;
 		}
 		set_bit(GP2AP020A00F_FLAG_ALS_FALLING_EV, &data->flags);
-		err =  gp2ap020a00f_write_event_threshold(data,
+		return gp2ap020a00f_write_event_threshold(data,
 					GP2AP020A00F_THRESH_TL, true);
-		break;
 	case GP2AP020A00F_CMD_ALS_LOW_EV_DIS:
 		if (!test_bit(GP2AP020A00F_FLAG_ALS_FALLING_EV, &data->flags))
 			return 0;
@@ -620,9 +615,8 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 			if (err < 0)
 				return err;
 		}
-		err =  gp2ap020a00f_write_event_threshold(data,
+		return gp2ap020a00f_write_event_threshold(data,
 					GP2AP020A00F_THRESH_TL, false);
-		break;
 	case GP2AP020A00F_CMD_PROX_HIGH_EV_EN:
 		if (test_bit(GP2AP020A00F_FLAG_PROX_RISING_EV, &data->flags))
 			return 0;
@@ -636,9 +630,8 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 				return err;
 		}
 		set_bit(GP2AP020A00F_FLAG_PROX_RISING_EV, &data->flags);
-		err =  gp2ap020a00f_write_event_threshold(data,
+		return gp2ap020a00f_write_event_threshold(data,
 					GP2AP020A00F_THRESH_PH, true);
-		break;
 	case GP2AP020A00F_CMD_PROX_HIGH_EV_DIS:
 		if (!test_bit(GP2AP020A00F_FLAG_PROX_RISING_EV, &data->flags))
 			return 0;
@@ -647,9 +640,8 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 					GP2AP020A00F_OPMODE_SHUTDOWN);
 		if (err < 0)
 			return err;
-		err =  gp2ap020a00f_write_event_threshold(data,
+		return gp2ap020a00f_write_event_threshold(data,
 					GP2AP020A00F_THRESH_PH, false);
-		break;
 	case GP2AP020A00F_CMD_PROX_LOW_EV_EN:
 		if (test_bit(GP2AP020A00F_FLAG_PROX_FALLING_EV, &data->flags))
 			return 0;
@@ -663,9 +655,8 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 				return err;
 		}
 		set_bit(GP2AP020A00F_FLAG_PROX_FALLING_EV, &data->flags);
-		err =  gp2ap020a00f_write_event_threshold(data,
+		return gp2ap020a00f_write_event_threshold(data,
 					GP2AP020A00F_THRESH_PL, true);
-		break;
 	case GP2AP020A00F_CMD_PROX_LOW_EV_DIS:
 		if (!test_bit(GP2AP020A00F_FLAG_PROX_FALLING_EV, &data->flags))
 			return 0;
@@ -674,12 +665,11 @@ static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
 					GP2AP020A00F_OPMODE_SHUTDOWN);
 		if (err < 0)
 			return err;
-		err =  gp2ap020a00f_write_event_threshold(data,
+		return gp2ap020a00f_write_event_threshold(data,
 					GP2AP020A00F_THRESH_PL, false);
-		break;
 	}
 
-	return err;
+	return 0;
 }
 
 static int wait_conversion_complete_irq(struct gp2ap020a00f_data *data)
@@ -1007,10 +997,8 @@ static int gp2ap020a00f_get_thresh_reg(const struct iio_chan_spec *chan,
 		else
 			return GP2AP020A00F_TL_L_REG;
 	default:
-		break;
+		return -EINVAL;
 	}
-
-	return -EINVAL;
 }
 
 static int gp2ap020a00f_write_event_val(struct iio_dev *indio_dev,
@@ -1182,33 +1170,23 @@ static int gp2ap020a00f_read_event_config(struct iio_dev *indio_dev,
 					   enum iio_event_direction dir)
 {
 	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
-	int event_en = 0;
 
 	guard(mutex)(&data->lock);
 
 	switch (chan->type) {
 	case IIO_PROXIMITY:
 		if (dir == IIO_EV_DIR_RISING)
-			event_en = test_bit(GP2AP020A00F_FLAG_PROX_RISING_EV,
-								&data->flags);
+			return test_bit(GP2AP020A00F_FLAG_PROX_RISING_EV, &data->flags);
 		else
-			event_en = test_bit(GP2AP020A00F_FLAG_PROX_FALLING_EV,
-								&data->flags);
-		break;
+			return test_bit(GP2AP020A00F_FLAG_PROX_FALLING_EV, &data->flags);
 	case IIO_LIGHT:
 		if (dir == IIO_EV_DIR_RISING)
-			event_en = test_bit(GP2AP020A00F_FLAG_ALS_RISING_EV,
-								&data->flags);
+			return test_bit(GP2AP020A00F_FLAG_ALS_RISING_EV, &data->flags);
 		else
-			event_en = test_bit(GP2AP020A00F_FLAG_ALS_FALLING_EV,
-								&data->flags);
-		break;
+			return test_bit(GP2AP020A00F_FLAG_ALS_FALLING_EV, &data->flags);
 	default:
-		event_en = -EINVAL;
-		break;
+		return -EINVAL;
 	}
-
-	return event_en;
 }
 
 static int gp2ap020a00f_read_channel(struct gp2ap020a00f_data *data,
@@ -1366,7 +1344,7 @@ static const struct iio_info gp2ap020a00f_info = {
 static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
 {
 	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
-	int i, err = 0;
+	int i, err;
 
 	guard(mutex)(&data->lock);
 
@@ -1400,15 +1378,15 @@ static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
 
 	data->buffer = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
 	if (!data->buffer)
-		err = -ENOMEM;
+		return -ENOMEM;
 
-	return err;
+	return 0;
 }
 
 static int gp2ap020a00f_buffer_predisable(struct iio_dev *indio_dev)
 {
 	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
-	int i, err = 0;
+	int i, err;
 
 	guard(mutex)(&data->lock);
 
@@ -1427,12 +1405,12 @@ static int gp2ap020a00f_buffer_predisable(struct iio_dev *indio_dev)
 					GP2AP020A00F_CMD_TRIGGER_PROX_DIS);
 			break;
 		}
+		if (err)
+			return err;
 	}
 
-	if (err == 0)
-		kfree(data->buffer);
-
-	return err;
+	kfree(data->buffer);
+	return 0;
 }
 
 static const struct iio_buffer_setup_ops gp2ap020a00f_buffer_setup_ops = {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 6/9] iio: light: gp2ap020a00f: Use temporary variable for struct device
  2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
                   ` (4 preceding siblings ...)
  2026-02-18  4:37 ` [PATCH v4 5/9] iio: light: gp2ap020a00f: Return directly from the switch cases Ethan Tidmore
@ 2026-02-18  4:37 ` Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 7/9] iio: light: gp2ap020a00f: Explicitly use string literal for driver name Ethan Tidmore
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-18  4:37 UTC (permalink / raw)
  To: jic23, andy
  Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Andy Shevchenko,
	Ethan Tidmore

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Use temporary variable for struct device to make code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
v4:
- Integrate Andy Shevchenko's cleanups.

 drivers/iio/light/gp2ap020a00f.c | 34 +++++++++++++++-----------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index f9ff8bbbe5ec..54b5d1993035 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -1192,6 +1192,7 @@ static int gp2ap020a00f_read_event_config(struct iio_dev *indio_dev,
 static int gp2ap020a00f_read_channel(struct gp2ap020a00f_data *data,
 				struct iio_chan_spec const *chan, int *val)
 {
+	struct device *dev = &data->client->dev;
 	enum gp2ap020a00f_cmd cmd;
 	int err;
 
@@ -1211,27 +1212,23 @@ static int gp2ap020a00f_read_channel(struct gp2ap020a00f_data *data,
 
 	err = gp2ap020a00f_exec_cmd(data, cmd);
 	if (err < 0) {
-		dev_err(&data->client->dev,
-			"gp2ap020a00f_exec_cmd failed\n");
-		goto error_ret;
+		dev_err(dev, "gp2ap020a00f_exec_cmd failed\n");
+		return err;
 	}
 
 	err = gp2ap020a00f_read_output(data, chan->address, val);
 	if (err < 0)
-		dev_err(&data->client->dev,
-			"gp2ap020a00f_read_output failed\n");
+		dev_err(dev, "gp2ap020a00f_read_output failed\n");
 
 	err = gp2ap020a00f_set_operation_mode(data,
 					GP2AP020A00F_OPMODE_SHUTDOWN);
 	if (err < 0)
-		dev_err(&data->client->dev,
-			"Failed to shut down the device.\n");
+		dev_err(dev, "Failed to shut down the device.\n");
 
 	if (cmd == GP2AP020A00F_CMD_READ_RAW_CLEAR ||
 	    cmd == GP2AP020A00F_CMD_READ_RAW_IR)
 		gp2ap020a00f_output_to_lux(data, val);
 
-error_ret:
 	return err;
 }
 
@@ -1421,18 +1418,19 @@ static const struct iio_buffer_setup_ops gp2ap020a00f_buffer_setup_ops = {
 static int gp2ap020a00f_probe(struct i2c_client *client)
 {
 	const struct i2c_device_id *id = i2c_client_get_device_id(client);
+	struct device *dev = &client->dev;
 	struct gp2ap020a00f_data *data;
 	struct iio_dev *indio_dev;
 	struct regmap *regmap;
 	int err;
 
-	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
+	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
 	if (!indio_dev)
 		return -ENOMEM;
 
 	data = iio_priv(indio_dev);
 
-	data->vled_reg = devm_regulator_get(&client->dev, "vled");
+	data->vled_reg = devm_regulator_get(dev, "vled");
 	if (IS_ERR(data->vled_reg))
 		return PTR_ERR(data->vled_reg);
 
@@ -1442,7 +1440,7 @@ static int gp2ap020a00f_probe(struct i2c_client *client)
 
 	regmap = devm_regmap_init_i2c(client, &gp2ap020a00f_regmap_config);
 	if (IS_ERR(regmap)) {
-		dev_err(&client->dev, "Regmap initialization failed.\n");
+		dev_err(dev, "Regmap initialization failed.\n");
 		err = PTR_ERR(regmap);
 		goto error_regulator_disable;
 	}
@@ -1453,7 +1451,7 @@ static int gp2ap020a00f_probe(struct i2c_client *client)
 			ARRAY_SIZE(gp2ap020a00f_reg_init_tab));
 
 	if (err < 0) {
-		dev_err(&client->dev, "Device initialization failed.\n");
+		dev_err(dev, "Device initialization failed.\n");
 		goto error_regulator_disable;
 	}
 
@@ -1478,11 +1476,10 @@ static int gp2ap020a00f_probe(struct i2c_client *client)
 		goto error_regulator_disable;
 
 	/* Allocate trigger */
-	data->trig = devm_iio_trigger_alloc(&client->dev, "%s-trigger",
-							indio_dev->name);
+	data->trig = devm_iio_trigger_alloc(dev, "%s-trigger", indio_dev->name);
 	if (data->trig == NULL) {
 		err = -ENOMEM;
-		dev_err(&indio_dev->dev, "Failed to allocate iio trigger.\n");
+		dev_err(dev, "Failed to allocate iio trigger.\n");
 		goto error_uninit_buffer;
 	}
 
@@ -1494,7 +1491,7 @@ static int gp2ap020a00f_probe(struct i2c_client *client)
 				   "gp2ap020a00f_als_event",
 				   indio_dev);
 	if (err < 0) {
-		dev_err(&client->dev, "Irq request failed.\n");
+		dev_err(dev, "Irq request failed.\n");
 		goto error_uninit_buffer;
 	}
 
@@ -1502,7 +1499,7 @@ static int gp2ap020a00f_probe(struct i2c_client *client)
 
 	err = iio_trigger_register(data->trig);
 	if (err < 0) {
-		dev_err(&client->dev, "Failed to register iio trigger.\n");
+		dev_err(dev, "Failed to register iio trigger.\n");
 		goto error_free_irq;
 	}
 
@@ -1528,12 +1525,13 @@ static void gp2ap020a00f_remove(struct i2c_client *client)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
 	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
+	struct device *dev = &client->dev;
 	int err;
 
 	err = gp2ap020a00f_set_operation_mode(data,
 					GP2AP020A00F_OPMODE_SHUTDOWN);
 	if (err < 0)
-		dev_err(&indio_dev->dev, "Failed to power off the device.\n");
+		dev_err(dev, "Failed to power off the device.\n");
 
 	iio_device_unregister(indio_dev);
 	iio_trigger_unregister(data->trig);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 7/9] iio: light: gp2ap020a00f: Explicitly use string literal for driver name
  2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
                   ` (5 preceding siblings ...)
  2026-02-18  4:37 ` [PATCH v4 6/9] iio: light: gp2ap020a00f: Use temporary variable for struct device Ethan Tidmore
@ 2026-02-18  4:37 ` Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 8/9] iio: light: gp2ap020a00f: Remove trailing comma in termination entry Ethan Tidmore
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-18  4:37 UTC (permalink / raw)
  To: jic23, andy
  Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Andy Shevchenko,
	Ethan Tidmore

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

The driver name should be easily greppable and clearly spelled.
Replace a level of indirection and explicitly use string literal.

While at it, remove useless blank lines before module_*() and
MODULE_*() macros.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
v4:
- Integrate Andy Shevchenko's cleanups.

 drivers/iio/light/gp2ap020a00f.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index 54b5d1993035..d922cd4987ab 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -55,8 +55,6 @@
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
 
-#define GP2A_I2C_NAME "gp2ap020a00f"
-
 /* Registers */
 #define GP2AP020A00F_OP_REG	0x00 /* Basic operations */
 #define GP2AP020A00F_ALS_REG	0x01 /* ALS related settings */
@@ -1541,10 +1539,9 @@ static void gp2ap020a00f_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id gp2ap020a00f_id[] = {
-	{ GP2A_I2C_NAME },
+	{ "gp2ap020a00f" },
 	{ }
 };
-
 MODULE_DEVICE_TABLE(i2c, gp2ap020a00f_id);
 
 static const struct of_device_id gp2ap020a00f_of_match[] = {
@@ -1555,14 +1552,13 @@ MODULE_DEVICE_TABLE(of, gp2ap020a00f_of_match);
 
 static struct i2c_driver gp2ap020a00f_driver = {
 	.driver = {
-		.name	= GP2A_I2C_NAME,
+		.name	= "gp2ap020a00f",
 		.of_match_table = gp2ap020a00f_of_match,
 	},
 	.probe		= gp2ap020a00f_probe,
 	.remove		= gp2ap020a00f_remove,
 	.id_table	= gp2ap020a00f_id,
 };
-
 module_i2c_driver(gp2ap020a00f_driver);
 
 MODULE_AUTHOR("Jacek Anaszewski <j.anaszewski@samsung.com>");
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 8/9] iio: light: gp2ap020a00f: Remove trailing comma in termination entry
  2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
                   ` (6 preceding siblings ...)
  2026-02-18  4:37 ` [PATCH v4 7/9] iio: light: gp2ap020a00f: Explicitly use string literal for driver name Ethan Tidmore
@ 2026-02-18  4:37 ` Ethan Tidmore
  2026-02-18  4:37 ` [PATCH v4 9/9] iio: light: gp2ap020a00f: Join some lines of code to be a single line Ethan Tidmore
  2026-02-18  7:10 ` [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Andy Shevchenko
  9 siblings, 0 replies; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-18  4:37 UTC (permalink / raw)
  To: jic23, andy
  Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Andy Shevchenko,
	Ethan Tidmore

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Termination entry by definition should be the last one, hence remove
stray comma after it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
v4:
- Integrate Andy Shevchenko's cleanups.

 drivers/iio/light/gp2ap020a00f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index d922cd4987ab..1867dacc0af6 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -195,7 +195,7 @@ enum gp2ap020a00f_opmode {
 	GP2AP020A00F_OPMODE_ALS_AND_PS,
 	GP2AP020A00F_OPMODE_PROX_DETECT,
 	GP2AP020A00F_OPMODE_SHUTDOWN,
-	GP2AP020A00F_NUM_OPMODES,
+	GP2AP020A00F_NUM_OPMODES
 };
 
 enum gp2ap020a00f_cmd {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 9/9] iio: light: gp2ap020a00f: Join some lines of code to be a single line
  2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
                   ` (7 preceding siblings ...)
  2026-02-18  4:37 ` [PATCH v4 8/9] iio: light: gp2ap020a00f: Remove trailing comma in termination entry Ethan Tidmore
@ 2026-02-18  4:37 ` Ethan Tidmore
  2026-02-18  7:10 ` [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Andy Shevchenko
  9 siblings, 0 replies; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-18  4:37 UTC (permalink / raw)
  To: jic23, andy
  Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Andy Shevchenko,
	Ethan Tidmore

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

In some cases the wrapped lines are harder to follow. Join them despite
being longer than 80 characters in some cases.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
v4:
- Integrate Andy Shevchenko's cleanups.

 drivers/iio/light/gp2ap020a00f.c | 39 +++++++++++---------------------
 1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/drivers/iio/light/gp2ap020a00f.c b/drivers/iio/light/gp2ap020a00f.c
index 1867dacc0af6..e901a8c33609 100644
--- a/drivers/iio/light/gp2ap020a00f.c
+++ b/drivers/iio/light/gp2ap020a00f.c
@@ -175,10 +175,8 @@
 #define GP2AP020A00F_CHAN_TIMESTAMP		3
 
 #define GP2AP020A00F_DATA_READY_TIMEOUT		msecs_to_jiffies(1000)
-#define GP2AP020A00F_DATA_REG(chan)		(GP2AP020A00F_D0_L_REG + \
-							(chan) * 2)
-#define GP2AP020A00F_THRESH_REG(th_val_id)	(GP2AP020A00F_TL_L_REG + \
-							(th_val_id) * 2)
+#define GP2AP020A00F_DATA_REG(chan)		(GP2AP020A00F_D0_L_REG + (chan) * 2)
+#define GP2AP020A00F_THRESH_REG(th_val_id)	(GP2AP020A00F_TL_L_REG + (th_val_id) * 2)
 #define GP2AP020A00F_THRESH_VAL_ID(reg_addr)	((reg_addr - 4) / 2)
 
 #define GP2AP020A00F_SUBTRACT_MODE	0
@@ -390,20 +388,17 @@ static int gp2ap020a00f_set_operation_mode(struct gp2ap020a00f_data *data,
 		}
 
 		err = regmap_update_bits(data->regmap, GP2AP020A00F_ALS_REG,
-			GP2AP020A00F_PRST_MASK, opmode_regs_settings[op]
-								.als_reg);
+			GP2AP020A00F_PRST_MASK, opmode_regs_settings[op].als_reg);
 		if (err < 0)
 			return err;
 
 		err = regmap_update_bits(data->regmap, GP2AP020A00F_PS_REG,
-			GP2AP020A00F_INTTYPE_MASK, opmode_regs_settings[op]
-								.ps_reg);
+			GP2AP020A00F_INTTYPE_MASK, opmode_regs_settings[op].ps_reg);
 		if (err < 0)
 			return err;
 
 		err = regmap_update_bits(data->regmap, GP2AP020A00F_LED_REG,
-			GP2AP020A00F_PIN_MASK, opmode_regs_settings[op]
-								.led_reg);
+			GP2AP020A00F_PIN_MASK, opmode_regs_settings[op].led_reg);
 		if (err < 0)
 			return err;
 	}
@@ -861,8 +856,7 @@ static irqreturn_t gp2ap020a00f_thresh_event_handler(int irq, void *data)
 	int thresh_val_id, ret;
 
 	/* Read interrupt flags */
-	ret = regmap_read(priv->regmap, GP2AP020A00F_OP_REG,
-							&op_reg_val);
+	ret = regmap_read(priv->regmap, GP2AP020A00F_OP_REG, &op_reg_val);
 	if (ret < 0)
 		goto done;
 
@@ -874,8 +868,7 @@ static irqreturn_t gp2ap020a00f_thresh_event_handler(int irq, void *data)
 
 	/* Clear interrupt flags (if not in INTTYPE_PULSE mode) */
 	if (priv->cur_opmode != GP2AP020A00F_OPMODE_PROX_DETECT) {
-		ret = regmap_write(priv->regmap, GP2AP020A00F_OP_REG,
-								op_reg_val);
+		ret = regmap_write(priv->regmap, GP2AP020A00F_OP_REG, op_reg_val);
 		if (ret < 0)
 			goto done;
 	}
@@ -972,8 +965,7 @@ static irqreturn_t gp2ap020a00f_trigger_handler(int irq, void *data)
 		}
 	}
 
-	iio_push_to_buffers_with_timestamp(indio_dev, priv->buffer,
-		pf->timestamp);
+	iio_push_to_buffers_with_timestamp(indio_dev, priv->buffer, pf->timestamp);
 done:
 	iio_trigger_notify_done(indio_dev->trig);
 
@@ -1023,26 +1015,22 @@ static int gp2ap020a00f_write_event_val(struct iio_dev *indio_dev,
 
 	switch (thresh_reg_l) {
 	case GP2AP020A00F_TH_L_REG:
-		event_en = test_bit(GP2AP020A00F_FLAG_ALS_RISING_EV,
-							&data->flags);
+		event_en = test_bit(GP2AP020A00F_FLAG_ALS_RISING_EV, &data->flags);
 		break;
 	case GP2AP020A00F_TL_L_REG:
-		event_en = test_bit(GP2AP020A00F_FLAG_ALS_FALLING_EV,
-							&data->flags);
+		event_en = test_bit(GP2AP020A00F_FLAG_ALS_FALLING_EV, &data->flags);
 		break;
 	case GP2AP020A00F_PH_L_REG:
 		if (val == 0)
 			return -EINVAL;
 
-		event_en = test_bit(GP2AP020A00F_FLAG_PROX_RISING_EV,
-							&data->flags);
+		event_en = test_bit(GP2AP020A00F_FLAG_PROX_RISING_EV, &data->flags);
 		break;
 	case GP2AP020A00F_PL_L_REG:
 		if (val == 0)
 			return -EINVAL;
 
-		event_en = test_bit(GP2AP020A00F_FLAG_PROX_FALLING_EV,
-							&data->flags);
+		event_en = test_bit(GP2AP020A00F_FLAG_PROX_FALLING_EV, &data->flags);
 		break;
 	}
 
@@ -1526,8 +1514,7 @@ static void gp2ap020a00f_remove(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	int err;
 
-	err = gp2ap020a00f_set_operation_mode(data,
-					GP2AP020A00F_OPMODE_SHUTDOWN);
+	err = gp2ap020a00f_set_operation_mode(data, GP2AP020A00F_OPMODE_SHUTDOWN);
 	if (err < 0)
 		dev_err(dev, "Failed to power off the device.\n");
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/9] iio: light: gp2ap020a00f: simplify locking with guard()
  2026-02-18  4:37 ` [PATCH v4 1/9] iio: light: gp2ap020a00f: simplify locking with guard() Ethan Tidmore
@ 2026-02-18  7:08   ` Andy Shevchenko
  2026-02-20  2:38     ` Ethan Tidmore
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2026-02-18  7:08 UTC (permalink / raw)
  To: Ethan Tidmore; +Cc: jic23, andy, dlechner, nuno.sa, linux-iio, linux-kernel

On Tue, Feb 17, 2026 at 10:37:20PM -0600, Ethan Tidmore wrote:
> Use the guard() cleanup handler to manage the device lock.
> This simplifies the code by removing the need for manual unlocking
> and goto error handling paths.

> static int gp2ap020a00f_write_event_config(struct iio_dev *indio_dev,

>  	enum gp2ap020a00f_cmd cmd;
>  	int err;
>  
> -	mutex_lock(&data->lock);
> +	guard(mutex)(&data->lock);
>  
>  	switch (chan->type) {
>  	case IIO_PROXIMITY:

>  		err = -EINVAL;
>  	}
>  
> -	mutex_unlock(&data->lock);
> -
>  	return err;
>  }

What I meant in the my cover letter is that you need to take some pieces from
my patches and incorporate them here, so this becomes

	return 0;


...

> static int gp2ap020a00f_read_event_config(struct iio_dev *indio_dev,

>  	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
>  	int event_en = 0;
>  
> -	mutex_lock(&data->lock);
> +	guard(mutex)(&data->lock);
>  
>  	switch (chan->type) {
>  	case IIO_PROXIMITY:
> @@ -1223,8 +1204,6 @@ static int gp2ap020a00f_read_event_config(struct iio_dev *indio_dev,
>  		break;
>  	}
>  
> -	mutex_unlock(&data->lock);
> -
>  	return event_en;

Same here, now event_en is redundant.

>  }

...

> static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)

>  	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
>  	int i, err = 0;

(Do you need this '= 0'? Check it).

>  
> -	mutex_lock(&data->lock);
> +	guard(mutex)(&data->lock);


>  	}
>  
>  	if (err < 0)
> -		goto error_unlock;
> +		return err;
>  
>  	data->buffer = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
>  	if (!data->buffer)

>  		err = -ENOMEM;
>  
> -error_unlock:
> -	mutex_unlock(&data->lock);
> -
>  	return err;

And here, this should become

		return -ENOMEM;

	return 0;


>  }

...

> static int gp2ap020a00f_buffer_predisable(struct iio_dev *indio_dev)

>  	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
>  	int i, err = 0;
>  
> -	mutex_lock(&data->lock);
> +	guard(mutex)(&data->lock);
>  
>  	iio_for_each_active_channel(indio_dev, i) {
>  		switch (i) {
> @@ -1452,8 +1428,6 @@ static int gp2ap020a00f_buffer_predisable(struct iio_dev *indio_dev)
>  	if (err == 0)
>  		kfree(data->buffer);
>  
> -	mutex_unlock(&data->lock);
> -
>  	return err;
>  }

Same here.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and
  2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
                   ` (8 preceding siblings ...)
  2026-02-18  4:37 ` [PATCH v4 9/9] iio: light: gp2ap020a00f: Join some lines of code to be a single line Ethan Tidmore
@ 2026-02-18  7:10 ` Andy Shevchenko
  9 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2026-02-18  7:10 UTC (permalink / raw)
  To: Ethan Tidmore; +Cc: jic23, andy, dlechner, nuno.sa, linux-iio, linux-kernel

On Tue, Feb 17, 2026 at 10:37:19PM -0600, Ethan Tidmore wrote:
> This series performs a general cleanup of the gp2ap020a00f IIO driver.
> 
> It integrates my original work switching to the guard() cleanup handler,
> fixing a signedness warning from Smatch, and cleanups provided by
> Andy Shevchenko [1].

Thanks, my comments below and in patch 1/9.

> v4:
>  - Integrated Andy Shevchenko's 7-patch cleanup series.
>  - Patch 1: Removed redundant 'err' variable and whitespace issues as
>    suggested by Andy.
>  - Patch 2: Added Reviewed-by tag from Andy Shevchenko.

>  - Patch 5: Updated commit message to describe the pre-existing bug fix
>    in gp2ap020a00f_buffer_predisable() where errors could be swallowed.

As I mentioned this perhaps better to split to a separate change as
a prerequisite to the mentioned patch.

> v3:
>  - Addressed initial feedback and simplified locking logic.
> 
> [1] https://lore.kernel.org/all/20260217102318.1354103-1-andriy.shevchenko@linux.intel.com/
> 
> Andy Shevchenko (7):
>   iio: light: gp2ap020a00f: Use correct types for 16-bit LE data
>   iio: light: gp2ap020a00f: Replace custom implementation of min()
>   iio: light: gp2ap020a00f: Return directly from the switch cases
>   iio: light: gp2ap020a00f: Use temporary variable for struct device
>   iio: light: gp2ap020a00f: Explicitly use string literal for driver
>     name
>   iio: light: gp2ap020a00f: Remove trailing comma in termination entry
>   iio: light: gp2ap020a00f: Join some lines of code to be a single line

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 5/9] iio: light: gp2ap020a00f: Return directly from the switch cases
  2026-02-18  4:37 ` [PATCH v4 5/9] iio: light: gp2ap020a00f: Return directly from the switch cases Ethan Tidmore
@ 2026-02-19 19:32   ` Ethan Tidmore
  2026-02-19 20:00     ` Andy Shevchenko
  0 siblings, 1 reply; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-19 19:32 UTC (permalink / raw)
  To: Ethan Tidmore, jic23, andy
  Cc: dlechner, nuno.sa, linux-iio, linux-kernel, Andy Shevchenko

On Tue Feb 17, 2026 at 10:37 PM CST, Ethan Tidmore wrote:
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Return directly from the switch cases which makes code easier to follow.
> In some cases convert pieces to the standard pattern which also unifies
> it with the accepted kernel practices.
>
> By doing this, it appears to have fixed a preexisting bug, the variable
> err in  gp2ap020a00f_buffer_predisable() is only checked once for errors
> after the for loop is finished. This could allow errors to be swallowed.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
> ---
> v4:
> - Integrate Andy Shevchenko's cleanups.
>
>  drivers/iio/light/gp2ap020a00f.c | 96 ++++++++++++--------------------
>  1 file changed, 37 insertions(+), 59 deletions(-)

...

>
> @@ -1366,7 +1344,7 @@ static const struct iio_info gp2ap020a00f_info = {
>  static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
>  {
>  	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
> -	int i, err = 0;
> +	int i, err;
>  
>  	guard(mutex)(&data->lock);
>  
> @@ -1400,15 +1378,15 @@ static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
>  
>  	data->buffer = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
>  	if (!data->buffer)
> -		err = -ENOMEM;
> +		return -ENOMEM;
>  
> -	return err;
> +	return 0;
>  }
>  

Looking over the code again it looks like 
gp2ap020a00f_buffer_postenable() contains the same bug you mentioned
where the error check should have been inside of the loop?


	iio_for_each_active_channel(indio_dev, i) {
		switch (i) {
		case GP2AP020A00F_SCAN_MODE_LIGHT_CLEAR:
			err = gp2ap020a00f_exec_cmd(data,
					GP2AP020A00F_CMD_TRIGGER_CLEAR_EN);
			break;
		case GP2AP020A00F_SCAN_MODE_LIGHT_IR:
			err = gp2ap020a00f_exec_cmd(data,
					GP2AP020A00F_CMD_TRIGGER_IR_EN);
			break;
		case GP2AP020A00F_SCAN_MODE_PROXIMITY:
			err = gp2ap020a00f_exec_cmd(data,
					GP2AP020A00F_CMD_TRIGGER_PROX_EN);
			break;
		}
	}

	if (err < 0)
		goto error_unlock;

Just wanted to confirm before putting it in the v5.

Thanks,

ET

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 5/9] iio: light: gp2ap020a00f: Return directly from the switch cases
  2026-02-19 19:32   ` Ethan Tidmore
@ 2026-02-19 20:00     ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2026-02-19 20:00 UTC (permalink / raw)
  To: Ethan Tidmore; +Cc: jic23, andy, dlechner, nuno.sa, linux-iio, linux-kernel

On Thu, Feb 19, 2026 at 01:32:20PM -0600, Ethan Tidmore wrote:
> On Tue Feb 17, 2026 at 10:37 PM CST, Ethan Tidmore wrote:

...

> > By doing this, it appears to have fixed a preexisting bug, the variable
> > err in  gp2ap020a00f_buffer_predisable() is only checked once for errors
> > after the for loop is finished. This could allow errors to be swallowed.

...

> >  static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
> >  {
> >  	struct gp2ap020a00f_data *data = iio_priv(indio_dev);
> > -	int i, err = 0;
> > +	int i, err;
> >  
> >  	guard(mutex)(&data->lock);
> >  
> > @@ -1400,15 +1378,15 @@ static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
> >  
> >  	data->buffer = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
> >  	if (!data->buffer)
> > -		err = -ENOMEM;
> > +		return -ENOMEM;
> >  
> > -	return err;
> > +	return 0;
> >  }
> 
> Looking over the code again it looks like 
> gp2ap020a00f_buffer_postenable() contains the same bug you mentioned
> where the error check should have been inside of the loop?
> 
> 
> 	iio_for_each_active_channel(indio_dev, i) {
> 		switch (i) {
> 		case GP2AP020A00F_SCAN_MODE_LIGHT_CLEAR:
> 			err = gp2ap020a00f_exec_cmd(data,
> 					GP2AP020A00F_CMD_TRIGGER_CLEAR_EN);
> 			break;
> 		case GP2AP020A00F_SCAN_MODE_LIGHT_IR:
> 			err = gp2ap020a00f_exec_cmd(data,
> 					GP2AP020A00F_CMD_TRIGGER_IR_EN);
> 			break;
> 		case GP2AP020A00F_SCAN_MODE_PROXIMITY:
> 			err = gp2ap020a00f_exec_cmd(data,
> 					GP2AP020A00F_CMD_TRIGGER_PROX_EN);
> 			break;
> 		}
> 	}
> 
> 	if (err < 0)
> 		goto error_unlock;
> 
> Just wanted to confirm before putting it in the v5.

Good catch! So, these two should be split into a separate change explaining
the change in behaviour.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/9] iio: light: gp2ap020a00f: simplify locking with guard()
  2026-02-18  7:08   ` Andy Shevchenko
@ 2026-02-20  2:38     ` Ethan Tidmore
  2026-02-20  7:43       ` Andy Shevchenko
  0 siblings, 1 reply; 16+ messages in thread
From: Ethan Tidmore @ 2026-02-20  2:38 UTC (permalink / raw)
  To: Andy Shevchenko, Ethan Tidmore
  Cc: jic23, andy, dlechner, nuno.sa, linux-iio, linux-kernel

On Wed Feb 18, 2026 at 1:08 AM CST, Andy Shevchenko wrote:
> On Tue, Feb 17, 2026 at 10:37:20PM -0600, Ethan Tidmore wrote:
>> Use the guard() cleanup handler to manage the device lock.
>> This simplifies the code by removing the need for manual unlocking
>> and goto error handling paths.
>

...

>
> What I meant in the my cover letter is that you need to take some pieces from
> my patches and incorporate them here, so this becomes
>
> 	return 0;
>

Understood, so with the first patch how should I credit you? With the
patches I'm splitting up that you gave, I know to just put my SOB. Just
unsure about the first.

Thanks,

ET

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 1/9] iio: light: gp2ap020a00f: simplify locking with guard()
  2026-02-20  2:38     ` Ethan Tidmore
@ 2026-02-20  7:43       ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2026-02-20  7:43 UTC (permalink / raw)
  To: Ethan Tidmore; +Cc: jic23, andy, dlechner, nuno.sa, linux-iio, linux-kernel

On Thu, Feb 19, 2026 at 08:38:28PM -0600, Ethan Tidmore wrote:
> On Wed Feb 18, 2026 at 1:08 AM CST, Andy Shevchenko wrote:
> > On Tue, Feb 17, 2026 at 10:37:20PM -0600, Ethan Tidmore wrote:

...

> > What I meant in the my cover letter is that you need to take some pieces
> > from my patches and incorporate them here, so this becomes
> >
> > 	return 0;
> 
> Understood, so with the first patch how should I credit you? With the
> patches I'm splitting up that you gave, I know to just put my SOB. Just
> unsure about the first.

No need for a special credits. It's already enough what you put in the cover
letter, that the series incorporates the changes I provided.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-02-20  7:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18  4:37 [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Ethan Tidmore
2026-02-18  4:37 ` [PATCH v4 1/9] iio: light: gp2ap020a00f: simplify locking with guard() Ethan Tidmore
2026-02-18  7:08   ` Andy Shevchenko
2026-02-20  2:38     ` Ethan Tidmore
2026-02-20  7:43       ` Andy Shevchenko
2026-02-18  4:37 ` [PATCH v4 2/9] iio: light: gp2ap020a00f: correct return type to int Ethan Tidmore
2026-02-18  4:37 ` [PATCH v4 3/9] iio: light: gp2ap020a00f: Use correct types for 16-bit LE data Ethan Tidmore
2026-02-18  4:37 ` [PATCH v4 4/9] iio: light: gp2ap020a00f: Replace custom implementation of min() Ethan Tidmore
2026-02-18  4:37 ` [PATCH v4 5/9] iio: light: gp2ap020a00f: Return directly from the switch cases Ethan Tidmore
2026-02-19 19:32   ` Ethan Tidmore
2026-02-19 20:00     ` Andy Shevchenko
2026-02-18  4:37 ` [PATCH v4 6/9] iio: light: gp2ap020a00f: Use temporary variable for struct device Ethan Tidmore
2026-02-18  4:37 ` [PATCH v4 7/9] iio: light: gp2ap020a00f: Explicitly use string literal for driver name Ethan Tidmore
2026-02-18  4:37 ` [PATCH v4 8/9] iio: light: gp2ap020a00f: Remove trailing comma in termination entry Ethan Tidmore
2026-02-18  4:37 ` [PATCH v4 9/9] iio: light: gp2ap020a00f: Join some lines of code to be a single line Ethan Tidmore
2026-02-18  7:10 ` [PATCH v4 0/9] iio: light: gp2ap020a00f: General cleanup and Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox