1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-12 01:20:14 +00:00

iio: accel: bma180: use stack allocated buffer for scan

Move the scan struct to the stack instead of being in the driver state
struct. The buffer is only used in a single function and does not need
to be DMA-safe so it does not need to exist outside of that function's
scope.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250721-iio-use-more-iio_declare_buffer_with_ts-v2-1-f8fb11b8add8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
David Lechner 2025-07-21 18:16:34 -05:00 committed by Jonathan Cameron
parent c9100ef6db
commit 97b262d24a

View File

@ -139,11 +139,6 @@ struct bma180_data {
int scale;
int bw;
bool pmode;
/* Ensure timestamp is naturally aligned */
struct {
s16 chan[4];
aligned_s64 timestamp;
} scan;
};
enum bma180_chan {
@ -870,6 +865,10 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)
struct bma180_data *data = iio_priv(indio_dev);
s64 time_ns = iio_get_time_ns(indio_dev);
int bit, ret, i = 0;
struct {
s16 chan[4];
aligned_s64 timestamp;
} scan = { };
mutex_lock(&data->mutex);
@ -879,12 +878,12 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)
mutex_unlock(&data->mutex);
goto err;
}
data->scan.chan[i++] = ret;
scan.chan[i++] = ret;
}
mutex_unlock(&data->mutex);
iio_push_to_buffers_with_ts(indio_dev, &data->scan, sizeof(data->scan), time_ns);
iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), time_ns);
err:
iio_trigger_notify_done(indio_dev->trig);