Re: [PATCH v8 9/9] iio: accel: mma8452: Support interrupt sharing

From: Esben Haabendal

Date: Thu Sep 17 2026 - 02:25:54 EST


"Jonathan Cameron" <jic23@xxxxxxxxxx> writes:

>> >> + if (pm_status == 0)
>> >> + return IRQ_NONE; /* device is powered down */
>> >
>> >> @@ -1784,29 +1796,62 @@ static void mma8452_remove(struct i2c_client *client)
>> >> #ifdef CONFIG_PM
>> >> static int mma8452_runtime_suspend(struct device *dev)
>> >> {
>> >> - struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
>> >> + struct i2c_client *client = to_i2c_client(dev);
>> >> + struct iio_dev *indio_dev = i2c_get_clientdata(client);
>> >> struct mma8452_data *data = iio_priv(indio_dev);
>> >> int ret;
>> >>
>> >> - scoped_guard(mutex, &data->lock)
>> >> - ret = mma8452_standby(data);
>> >> + guard(mutex)(&data->lock);
>> > Mixing guards...
>>
>> Yes, I know. Resolving that turned out to be a bit more painful than I
>> thought. I do have that resolved in the next series I keep on talking
>> about. But distilling that as a separate patch for adding to this series
>> turned out to be impossible, as it relies on some of the other work,
>> like refactoring of the ACTIVE/STANDBY state handling (synchronization),
>> and most importantly, the switch to using regmap caching to properly
>> handle restoring of register values on resume.
>>
>> I am therefore hoping that we can find some way to agree on things here,
>> and then properly resolve it in the next series...
>
> Ok. It is fine for now. Perhaps add a comment along the lines of
> /* Must be first action in scope that needs to be undone on error */
>
> And hopefully it won't be around long enough for anyone to copy it
> into more code!

Ok. I got a bit trigger happy, so v9 is now sent with a proposed
(temporary) fix for it it instead. If that meets resistance, I will
consider falling back to adding the comment you proposed above.

/Esben