Skip to contentSkip to conversation

iio: accel: kionix-kx022a: unify staging buffer and convert to iio_push_to_buffers_with_ts()

PATCH Superseded Gabriel Rondon 4 participants 13 messages Aug 18 – Aug 20

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover iio: accel: kionix-kx022a: unify staging buffer and convert to iio_push_to_buffers_with_ts()

v1 was a single patch converting the two push sites to iio_push_to_buffers_with_ts(). Reviewing it, Jonathan pointed out that the driver carries two separate staging areas holding the same thing (buffer[8] and the scan struct), and asked to fold the cleanup into this set.

So v2 is a two-patch series: patch 1 drops the redundant buffer and routes the one-shot read and the triggered handler through scan, and patch 2 does the deprecated-API conversion, now with a single buffer to push at both sites.

Changes in v2:
- New patch 1: drop buffer[8], use scan for the one-shot read and the triggered handler, move IIO_DMA_MINALIGN onto scan (Jonathan)
- Patch 2 now pushes data->scan at both sites instead of data->buffer

v1: https://lore.kernel.org/linux-iio/[email protected]/

Gabriel Rondon (2):
iio: accel: kionix-kx022a: use scan struct for one-shot and trigger
reads
iio: accel: kionix-kx022a: use iio_push_to_buffers_with_ts()

 drivers/iio/accel/kionix-kx022a.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)
#1 lore raw

PATCH v2 1/2 iio: accel: kionix-kx022a: use scan struct for one-shot and trigger reads

The driver kept two separate staging areas that hold the same thing:
buffer[8], a DMA-aligned area used by the one-shot read in kx022a_get_axis() and by the triggered handler, and the scan struct, used by the FIFO flush path. Both are three __le16 channels plus room for the timestamp.

Drop buffer and route the one-shot read and the triggered handler through scan.channels, so the driver has a single staging area. Move the IIO_DMA_MINALIGN alignment onto scan, since it now backs the regmap bulk reads that buffer used to.

No functional change. get_axis() only runs via read_raw() under iio_device_claim_direct(), so it cannot run while the triggered buffer is active, and the triggered handler only runs while it is; the two never touch scan concurrently, exactly as they previously shared buffer.

---
 drivers/iio/accel/kionix-kx022a.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/iio/accel/kionix-kx022a.c +7 -8
index 02dd1db7a646..cf2cb751b4e8 100644
@@ -301,11 +301,10 @@ struct kx022a_data {
 	__le16 *fifo_buffer;
 
 	/* 3 x 16bit accel data + timestamp */
-	__le16 buffer[8] __aligned(IIO_DMA_MINALIGN);
 	struct {
 		__le16 channels[3];
 		aligned_s64 ts;
-	} scan;
+	} scan __aligned(IIO_DMA_MINALIGN);
 };
 
 static const struct iio_mount_matrix *
@@ -613,12 +612,12 @@ static int kx022a_get_axis(struct kx022a_data *data,
 {
 	int ret;
 
-	ret = regmap_bulk_read(data->regmap, chan->address, &data->buffer[0],
-			       sizeof(__le16));
+	ret = regmap_bulk_read(data->regmap, chan->address,
+			       &data->scan.channels[0], sizeof(__le16));
 	if (ret)
 		return ret;
 
-	*val = (s16)le16_to_cpu(data->buffer[0]);
+	*val = (s16)le16_to_cpu(data->scan.channels[0]);
 
 	return IIO_VAL_INT;
 }
@@ -1029,12 +1028,12 @@ static irqreturn_t kx022a_trigger_handler(int irq, void *p)
 	struct kx022a_data *data = iio_priv(idev);
 	int ret;
 
-	ret = regmap_bulk_read(data->regmap, data->chip_info->xout_l, data->buffer,
-			       KX022A_FIFO_SAMPLES_SIZE_BYTES);
+	ret = regmap_bulk_read(data->regmap, data->chip_info->xout_l,
+			       data->scan.channels, KX022A_FIFO_SAMPLES_SIZE_BYTES);
 	if (ret < 0)
 		goto err_read;
 
-	iio_push_to_buffers_with_timestamp(idev, data->buffer, data->timestamp);
+	iio_push_to_buffers_with_timestamp(idev, &data->scan, data->timestamp);
 err_read:
 	iio_trigger_notify_done(idev->trig);
 
Signature · 1 line
2.50.1 (Apple Git-155)
maintainer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] iio: accel: kionix-kx022a: use scan struct for one-shot and trigger reads

Quoted 11 lines · Gabriel Rondon

The driver kept two separate staging areas that hold the same thing:
buffer[8], a DMA-aligned area used by the one-shot read in kx022a_get_axis() and by the triggered handler, and the scan struct, used by the FIFO flush path. Both are three __le16 channels plus room for the timestamp.

Drop buffer and route the one-shot read and the triggered handler through scan.channels, so the driver has a single staging area. Move the IIO_DMA_MINALIGN alignment onto scan, since it now backs the regmap bulk reads that buffer used to.

Quoted 6 lines

No functional change. get_axis() only runs via read_raw() under iio_device_claim_direct(), so it cannot run while the triggered buffer is active, and the triggered handler only runs while it is; the two never touch scan concurrently, exactly as they previously shared buffer.

Suggested-by?

Other than that - looks good to me.

Quoted 53 lines
---
  drivers/iio/accel/kionix-kx022a.c | 15 +++++++--------
  1 file changed, 7 insertions(+), 8 deletions(-)
drivers/iio/accel/kionix-kx022a.c +7 -8
index 02dd1db7a646..cf2cb751b4e8 100644
@@ -301,11 +301,10 @@ struct kx022a_data {
  	__le16 *fifo_buffer;
 
  	/* 3 x 16bit accel data + timestamp */
-	__le16 buffer[8] __aligned(IIO_DMA_MINALIGN);
  	struct {
  		__le16 channels[3];
  		aligned_s64 ts;
-	} scan;
+	} scan __aligned(IIO_DMA_MINALIGN);
  };
 
  static const struct iio_mount_matrix *
@@ -613,12 +612,12 @@ static int kx022a_get_axis(struct kx022a_data *data,
  {
  	int ret;
 
-	ret = regmap_bulk_read(data->regmap, chan->address, &data->buffer[0],
-			       sizeof(__le16));
+	ret = regmap_bulk_read(data->regmap, chan->address,
+			       &data->scan.channels[0], sizeof(__le16));
  	if (ret)
  		return ret;
 
-	*val = (s16)le16_to_cpu(data->buffer[0]);
+	*val = (s16)le16_to_cpu(data->scan.channels[0]);
 
  	return IIO_VAL_INT;
  }
@@ -1029,12 +1028,12 @@ static irqreturn_t kx022a_trigger_handler(int irq, void *p)
  	struct kx022a_data *data = iio_priv(idev);
  	int ret;
 
-	ret = regmap_bulk_read(data->regmap, data->chip_info->xout_l, data->buffer,
-			       KX022A_FIFO_SAMPLES_SIZE_BYTES);
+	ret = regmap_bulk_read(data->regmap, data->chip_info->xout_l,
+			       data->scan.channels, KX022A_FIFO_SAMPLES_SIZE_BYTES);
  	if (ret < 0)
  		goto err_read;
 
-	iio_push_to_buffers_with_timestamp(idev, data->buffer, data->timestamp);
+	iio_push_to_buffers_with_timestamp(idev, &data->scan, data->timestamp);
  err_read:
  	iio_trigger_notify_done(idev->trig);
 
Signature · 5 lines
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~
#3 lore raw

Re: [PATCH v2 1/2] iio: accel: kionix-kx022a: use scan struct for one-shot and trigger reads

In reply to Gabriel Rondon
Quoted 15 lines · Gabriel Rondon

The driver kept two separate staging areas that hold the same thing:
buffer[8], a DMA-aligned area used by the one-shot read in kx022a_get_axis() and by the triggered handler, and the scan struct, used by the FIFO flush path. Both are three __le16 channels plus room for the timestamp.

Drop buffer and route the one-shot read and the triggered handler through scan.channels, so the driver has a single staging area. Move the IIO_DMA_MINALIGN alignment onto scan, since it now backs the regmap bulk reads that buffer used to.

No functional change. get_axis() only runs via read_raw() under iio_device_claim_direct(), so it cannot run while the triggered buffer is active, and the triggered handler only runs while it is; the two never touch scan concurrently, exactly as they previously shared buffer.

...

Quoted 3 lines

static int kx022a_get_axis(struct kx022a_data *data,

{

I would rather do this

	__le16 *buf = &data->scan.channels[0];

drivers/iio/accel/kionix-kx022a.c static int kx022a_get_axis(struct kx022a_data *data, · line 616

Quoted 6 lines
drivers/iio/accel/kionix-kx022a.c +2 -2
 	int ret;
 
-	ret = regmap_bulk_read(data->regmap, chan->address, &data->buffer[0],
-			       sizeof(__le16));
+	ret = regmap_bulk_read(data->regmap, chan->address,
+			       &data->scan.channels[0], sizeof(__le16));
	ret = regmap_bulk_read(data->regmap, chan->address, buf, sizeof(*buf));

drivers/iio/accel/kionix-kx022a.c static int kx022a_get_axis(struct kx022a_data *data, · line 620

Quoted 5 lines
drivers/iio/accel/kionix-kx022a.c +1 -1
 	if (ret)
 		return ret;
 
-	*val = (s16)le16_to_cpu(data->buffer[0]);
+	*val = (s16)le16_to_cpu(data->scan.channels[0]);
	*val = (s16)le16_to_cpup(buf);
Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#4 lore raw

Re: [PATCH v2 1/2] iio: accel: kionix-kx022a: use scan struct for one-shot and trigger reads

Quoted 36 lines · On Wed, 19 Aug 2026 10:17:33 +0300 Andy Shevchenko…
Quoted 15 lines · Gabriel Rondon

The driver kept two separate staging areas that hold the same thing:
buffer[8], a DMA-aligned area used by the one-shot read in kx022a_get_axis() and by the triggered handler, and the scan struct, used by the FIFO flush path. Both are three __le16 channels plus room for the timestamp.

Drop buffer and route the one-shot read and the triggered handler through scan.channels, so the driver has a single staging area. Move the IIO_DMA_MINALIGN alignment onto scan, since it now backs the regmap bulk reads that buffer used to.

No functional change. get_axis() only runs via read_raw() under iio_device_claim_direct(), so it cannot run while the triggered buffer is active, and the triggered handler only runs while it is; the two never touch scan concurrently, exactly as they previously shared buffer.

...

Quoted 3 lines

static int kx022a_get_axis(struct kx022a_data *data,

{

I would rather do this

	__le16 *buf = &data->scan.channels[0];

Review

Quoted 6 lines
(quoted diff) +2 -2
 	int ret;
 
-	ret = regmap_bulk_read(data->regmap, chan->address, &data->buffer[0],
-			       sizeof(__le16));
+	ret = regmap_bulk_read(data->regmap, chan->address,
+			       &data->scan.channels[0], sizeof(__le16));  
	ret = regmap_bulk_read(data->regmap, chan->address, buf, sizeof(*buf));
Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +1 -1
 	if (ret)
 		return ret;
 
-	*val = (s16)le16_to_cpu(data->buffer[0]);
+	*val = (s16)le16_to_cpu(data->scan.channels[0]);  
	*val = (s16)le16_to_cpup(buf);

True - that is nicer. Tweaked. Diff just to check I didn't get it wrong:

drivers/iio/accel/kionix-kx022a.c +3 -2
index 86f17431aa23..8f2810c8ffeb 100644
@@ -610,14 +610,15 @@ static int kx022a_get_axis(struct kx022a_data *data,
                           struct iio_chan_spec const *chan,
                           int *val)
 {
+       __le16 *buf = &data->scan.channels[0];
        int ret;
 
        ret = regmap_bulk_read(data->regmap, chan->address,
-                              &data->scan.channels[0], sizeof(__le16));
+                              buf, sizeof(*buf));
        if (ret)
                return ret;
 
-       *val = (s16)le16_to_cpu(data->scan.channels[0]);
+       *val = (s16)le16_to_cpup(buf);
 
        return IIO_VAL_INT;
 }
Quoted 1 line
#5 lore raw

PATCH v2 2/2 iio: accel: kionix-kx022a: use iio_push_to_buffers_with_ts()

In reply to Gabriel Rondon

Replace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), which takes the destination buffer size and checks it against scan_bytes at runtime.

Both push sites now use data->scan ({ __le16 channels[3]; aligned_s64 ts; }, IIO_DMA_MINALIGN aligned), which is 16 bytes and matches scan_bytes for the 3-axis plus s64 timestamp layout used by all supported variants, so pass sizeof(data->scan).

---
 drivers/iio/accel/kionix-kx022a.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/accel/kionix-kx022a.c +4 -2
index cf2cb751b4e8..86f17431aa23 100644
@@ -863,7 +863,8 @@ static int __kx022a_fifo_flush(struct iio_dev *idev, unsigned int samples,
 		for_each_set_bit(bit, idev->active_scan_mask, AXIS_MAX)
 			chs[bit] = sam[bit];
 
-		iio_push_to_buffers_with_timestamp(idev, &data->scan, tstamp);
+		iio_push_to_buffers_with_ts(idev, &data->scan,
+					    sizeof(data->scan), tstamp);
 
 		tstamp += sample_period;
 	}
@@ -1033,7 +1034,8 @@ static irqreturn_t kx022a_trigger_handler(int irq, void *p)
 	if (ret < 0)
 		goto err_read;
 
-	iio_push_to_buffers_with_timestamp(idev, &data->scan, data->timestamp);
+	iio_push_to_buffers_with_ts(idev, &data->scan, sizeof(data->scan),
+				    data->timestamp);
 err_read:
 	iio_trigger_notify_done(idev->trig);
 
Signature · 1 line
2.50.1 (Apple Git-155)
maintainer Reviewed-by on v2 2/2
#6 lore raw

Re: [PATCH v2 2/2] iio: accel: kionix-kx022a: use iio_push_to_buffers_with_ts()

Quoted 8 lines · Gabriel Rondon

Replace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), which takes the destination buffer size and checks it against scan_bytes at runtime.

Both push sites now use data->scan ({ __le16 channels[3]; aligned_s64 ts; }, IIO_DMA_MINALIGN aligned), which is 16 bytes and matches scan_bytes for the 3-axis plus s64 timestamp layout used by all supported variants, so pass sizeof(data->scan).

Eh, what is this explanation above? As far as I understand, the iio_push_to_buffers_with_ts() has a safety mechanism of checking the passed buffer size. So, size of the buffer must be passed, no matter what the buffer is designed to contain.

By the way, to my eye the commit message looks AI generated, which is perfectly fine. But AFAICS, AI generated patches should be tagged as AI generated. Hence, if you use AI to do the changes, please ask the AI to check the docs and also add necessary tags :)

Quoted 1 line

Other than the commit message:

Quoted 28 lines
---
  drivers/iio/accel/kionix-kx022a.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/accel/kionix-kx022a.c +4 -2
index cf2cb751b4e8..86f17431aa23 100644
@@ -863,7 +863,8 @@ static int __kx022a_fifo_flush(struct iio_dev *idev, unsigned int samples,
  		for_each_set_bit(bit, idev->active_scan_mask, AXIS_MAX)
  			chs[bit] = sam[bit];
 
-		iio_push_to_buffers_with_timestamp(idev, &data->scan, tstamp);
+		iio_push_to_buffers_with_ts(idev, &data->scan,
+					    sizeof(data->scan), tstamp);
 
  		tstamp += sample_period;
  	}
@@ -1033,7 +1034,8 @@ static irqreturn_t kx022a_trigger_handler(int irq, void *p)
  	if (ret < 0)
  		goto err_read;
 
-	iio_push_to_buffers_with_timestamp(idev, &data->scan, data->timestamp);
+	iio_push_to_buffers_with_ts(idev, &data->scan, sizeof(data->scan),
+				    data->timestamp);
  err_read:
  	iio_trigger_notify_done(idev->trig);
 
Signature · 5 lines
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~
maintainer
#7 lore raw

Re: [PATCH v2 2/2] iio: accel: kionix-kx022a: use iio_push_to_buffers_with_ts()

Quoted 10 lines · On Wed, 19 Aug 2026 08:11:45 +0300 Matti Vaittinen <[email protected]>…
Quoted 8 lines · Gabriel Rondon

Replace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), which takes the destination buffer size and checks it against scan_bytes at runtime.

Both push sites now use data->scan ({ __le16 channels[3]; aligned_s64 ts; }, IIO_DMA_MINALIGN aligned), which is 16 bytes and matches scan_bytes for the 3-axis plus s64 timestamp layout used by all supported variants, so pass sizeof(data->scan).

Quoted 4 lines

Eh, what is this explanation above? As far as I understand, the iio_push_to_buffers_with_ts() has a safety mechanism of checking the passed buffer size. So, size of the buffer must be passed, no matter what the buffer is designed to contain.

Fair point - this evolved in an odd direction. Dropped that paragraph.

Quoted 41 lines

By the way, to my eye the commit message looks AI generated, which is perfectly fine. But AFAICS, AI generated patches should be tagged as AI generated. Hence, if you use AI to do the changes, please ask the AI to check the docs and also add necessary tags :)

Quoted 1 line

Other than the commit message:

Quoted 28 lines
---
  drivers/iio/accel/kionix-kx022a.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/accel/kionix-kx022a.c +4 -2
index cf2cb751b4e8..86f17431aa23 100644
@@ -863,7 +863,8 @@ static int __kx022a_fifo_flush(struct iio_dev *idev, unsigned int samples,
  		for_each_set_bit(bit, idev->active_scan_mask, AXIS_MAX)
  			chs[bit] = sam[bit];
 
-		iio_push_to_buffers_with_timestamp(idev, &data->scan, tstamp);
+		iio_push_to_buffers_with_ts(idev, &data->scan,
+					    sizeof(data->scan), tstamp);
 
  		tstamp += sample_period;
  	}
@@ -1033,7 +1034,8 @@ static irqreturn_t kx022a_trigger_handler(int irq, void *p)
  	if (ret < 0)
  		goto err_read;
 
-	iio_push_to_buffers_with_timestamp(idev, &data->scan, data->timestamp);
+	iio_push_to_buffers_with_ts(idev, &data->scan, sizeof(data->scan),
+				    data->timestamp);
  err_read:
  	iio_trigger_notify_done(idev->trig);
 
maintainer
#8 lore raw
In reply to Gabriel Rondon
Quoted 11 lines · On Tue, 18 Aug 2026 22:51:20 +0100 Gabriel Rondon <[email protected]> wrote:

v1 was a single patch converting the two push sites to iio_push_to_buffers_with_ts(). Reviewing it, Jonathan pointed out that the driver carries two separate staging areas holding the same thing (buffer[8] and the scan struct), and asked to fold the cleanup into this set.

So v2 is a two-patch series: patch 1 drops the redundant buffer and routes the one-shot read and the triggered handler through scan, and patch 2 does the deprecated-API conversion, now with a single buffer to push at both sites.

Quoted 5 lines

Changes in v2:
- New patch 1: drop buffer[8], use scan for the one-shot read and the triggered handler, move IIO_DMA_MINALIGN onto scan (Jonathan)
- Patch 2 now pushes data->scan at both sites instead of data->buffer

Nice. All looks good to me, so I'll queue it up.

Applied to the testing branch of iio.git which will be rebased on rc1 once available.

Note that there is plenty of time for additional feedback, tags or indeed me to drop it again if someone spots something I missed.

Thanks,

Jonathan

Quoted 10 lines

v1: https://lore.kernel.org/linux-iio/[email protected]/

Gabriel Rondon (2):
iio: accel: kionix-kx022a: use scan struct for one-shot and trigger
reads
iio: accel: kionix-kx022a: use iio_push_to_buffers_with_ts()

 drivers/iio/accel/kionix-kx022a.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
maintainer
#9 lore raw
Quoted 19 lines · Jonathan Cameron
Quoted 11 lines · On Tue, 18 Aug 2026 22:51:20 +0100 Gabriel Rondon <[email protected]> wrote:

v1 was a single patch converting the two push sites to iio_push_to_buffers_with_ts(). Reviewing it, Jonathan pointed out that the driver carries two separate staging areas holding the same thing (buffer[8] and the scan struct), and asked to fold the cleanup into this set.

So v2 is a two-patch series: patch 1 drops the redundant buffer and routes the one-shot read and the triggered handler through scan, and patch 2 does the deprecated-API conversion, now with a single buffer to push at both sites.

Quoted 5 lines

Changes in v2:
- New patch 1: drop buffer[8], use scan for the one-shot read and the triggered handler, move IIO_DMA_MINALIGN onto scan (Jonathan)
- Patch 2 now pushes data->scan at both sites instead of data->buffer

Quoted 7 lines

Nice. All looks good to me, so I'll queue it up.

Applied to the testing branch of iio.git which will be rebased on rc1 once available.

Note that there is plenty of time for additional feedback, tags or indeed me to drop it again if someone spots something I missed.

Ah, Jonathan was quick and efficient :)
I'll drop my comments to 'nits' in order to not generate more work for Jonathan. Hence, acting on my comments is not required.

-- Matti

Signature · 5 lines
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~
#10 lore raw
Quoted 22 lines · Matti Vaittinen
Quoted 21 lines · Jonathan Cameron
Quoted 11 lines · On Tue, 18 Aug 2026 22:51:20 +0100 Gabriel Rondon <[email protected]> wrote:

v1 was a single patch converting the two push sites to iio_push_to_buffers_with_ts(). Reviewing it, Jonathan pointed out that the driver carries two separate staging areas holding the same thing (buffer[8] and the scan struct), and asked to fold the cleanup into this set.

So v2 is a two-patch series: patch 1 drops the redundant buffer and routes the one-shot read and the triggered handler through scan, and patch 2 does the deprecated-API conversion, now with a single buffer to push at both sites.

Quoted 5 lines

Changes in v2:
- New patch 1: drop buffer[8], use scan for the one-shot read and the triggered handler, move IIO_DMA_MINALIGN onto scan (Jonathan)
- Patch 2 now pushes data->scan at both sites instead of data->buffer

Nice. All looks good to me, so I'll queue it up.

Quoted 8 lines
Quoted 5 lines

Applied to the testing branch of iio.git which will be rebased on rc1 once available.

Note that there is plenty of time for additional feedback, tags or indeed me to drop it again if someone spots something I missed.

Ah, Jonathan was quick and efficient :)
I'll drop my comments to 'nits' in order to not generate more work for

And I, in the opposite, insist on mine against patch 1 as I consider that that makes code easier to read and follow.

Quoted 1 line

Jonathan. Hence, acting on my comments is not required.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#11 lore raw
Quoted 23 lines · On Wed, 19 Aug 2026 10:18:44 +0300 Andy Shevchenko…
Quoted 22 lines · Matti Vaittinen
Quoted 21 lines · Jonathan Cameron
Quoted 11 lines · On Tue, 18 Aug 2026 22:51:20 +0100 Gabriel Rondon <[email protected]> wrote:

v1 was a single patch converting the two push sites to iio_push_to_buffers_with_ts(). Reviewing it, Jonathan pointed out that the driver carries two separate staging areas holding the same thing (buffer[8] and the scan struct), and asked to fold the cleanup into this set.

So v2 is a two-patch series: patch 1 drops the redundant buffer and routes the one-shot read and the triggered handler through scan, and patch 2 does the deprecated-API conversion, now with a single buffer to push at both sites.

Quoted 5 lines

Changes in v2:
- New patch 1: drop buffer[8], use scan for the one-shot read and the triggered handler, move IIO_DMA_MINALIGN onto scan (Jonathan)
- Patch 2 now pushes data->scan at both sites instead of data->buffer

Nice. All looks good to me, so I'll queue it up.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

Applied to the testing branch of iio.git which will be rebased on rc1 once available.

Note that there is plenty of time for additional feedback, tags or indeed me to drop it again if someone spots something I missed.

Ah, Jonathan was quick and efficient :)

Hmm. Worried about too many thing floating around is more accurate.

Quoted 4 lines
Quoted 1 line

I'll drop my comments to 'nits' in order to not generate more work for

And I, in the opposite, insist on mine against patch 1 as I consider that that makes code easier to read and follow.

True enough - so tweaked

Jonathan

Quoted 3 lines
Quoted 2 lines

Jonathan. Hence, acting on my comments is not required.

Reviewed-by on the v2 series
#12 lore raw
In reply to Gabriel Rondon
Quoted 10 lines · Gabriel Rondon

v1 was a single patch converting the two push sites to iio_push_to_buffers_with_ts(). Reviewing it, Jonathan pointed out that the driver carries two separate staging areas holding the same thing (buffer[8] and the scan struct), and asked to fold the cleanup into this set.

So v2 is a two-patch series: patch 1 drops the redundant buffer and routes the one-shot read and the triggered handler through scan, and patch 2 does the deprecated-API conversion, now with a single buffer to push at both sites.

Good job!
Assuming my comments are being addressed,

Signature · 2 lines
With Best Regards,
Andy Shevchenko