Re: [PATCH v4 2/6] iio: accel: mma8452: Optimize struct mm8452_data member orders
From: Jonathan Cameron
Date: Sat Aug 15 2026 - 00:14:38 EST
On Wed, 12 Aug 2026 16:30:33 +0200
Esben Haabendal <esben@xxxxxxxxxx> wrote:
> Reorder struct mma8452_data members to avoid holes.
Trivial but sashiko pointed out mm[a]_8452 in the title.
I'll tidy that up if nothing significant comes up.
Interestingly Sashiko also thinks it found a deadlock.
Given you are working with this driver if you have time could
you take a look at that.
https://sashiko.dev/#/patchset/20260812-mma8452-open-drain-v4-0-bfca15d02b59%40geanix.com
I'm rather surprised to see the lock taken in the runtime
pm suspend callback. It is probably there to close a race
where the device is being suspended and the sampling
frequency is being written. I'm not immediately sure what
the best way to fix it is. One thing that would work is to
do pm_runtime_get* to raise the reference counter and stop
there being any chance of an autosuspend.
Jonathan
>
> Reviewed-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
> Signed-off-by: Esben Haabendal <esben@xxxxxxxxxx>
> ---
> drivers/iio/accel/mma8452.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 7d683686dd9d..f645a5c6fd1c 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -106,10 +106,7 @@ struct mma8452_data {
> struct i2c_client *client;
> struct mutex lock;
> struct iio_mount_matrix orientation;
> - u8 ctrl_reg1;
> - u8 data_cfg;
> const struct mma_chip_info *chip_info;
> - int sleep_val;
> struct regulator *vdd_reg;
> struct regulator *vddio_reg;
>
> @@ -118,6 +115,10 @@ struct mma8452_data {
> __be16 channels[3];
> aligned_s64 ts;
> } buffer;
> +
> + int sleep_val;
> + u8 ctrl_reg1;
> + u8 data_cfg;
> };
>
> /**
>