Skip to content

Commit

Permalink
iio: pressure: mprls0025pa: use aligned_s64 for timestamp
Browse files Browse the repository at this point in the history
Follow the pattern of other drivers and use aligned_s64 for the
timestamp. This will ensure the struct itself it also 8-byte aligned.

While touching this, convert struct mpr_chan to an anonymous struct
to consolidate the code a bit to make it easier for future readers.

Fixes: 713337d ("iio: pressure: Honeywell mprls0025pa pressure sensor")
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250418-iio-more-timestamp-alignment-v2-2-d6a5d2b1c9fe@baylibre.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
David Lechner authored and Jonathan Cameron committed Apr 21, 2025
1 parent e4570f4 commit ffcd19e
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions drivers/iio/pressure/mprls0025pa.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ struct iio_dev;
struct mpr_data;
struct mpr_ops;

/**
* struct mpr_chan
* @pres: pressure value
* @ts: timestamp
*/
struct mpr_chan {
s32 pres;
s64 ts;
};

enum mpr_func_id {
MPR_FUNCTION_A,
MPR_FUNCTION_B,
Expand All @@ -69,6 +59,8 @@ enum mpr_func_id {
* reading in a loop until data is ready
* @completion: handshake from irq to read
* @chan: channel values for buffered mode
* @chan.pres: pressure value
* @chan.ts: timestamp
* @buffer: raw conversion data
*/
struct mpr_data {
Expand All @@ -87,7 +79,10 @@ struct mpr_data {
struct gpio_desc *gpiod_reset;
int irq;
struct completion completion;
struct mpr_chan chan;
struct {
s32 pres;
aligned_s64 ts;
} chan;
u8 buffer[MPR_MEASUREMENT_RD_SIZE] __aligned(IIO_DMA_MINALIGN);
};

Expand Down

0 comments on commit ffcd19e

Please sign in to comment.