Re: [PATCH v2 1/3] iio: proximity: sx9310: keep the IRQ balanced across suspend and resume

From: Andy Shevchenko

Date: Mon Oct 26 2026 - 11:05:28 EST


On Mon, Oct 26, 2026 at 04:53:04PM +0530, Arnav Kapoor wrote:
> sx9310_suspend() disables the interrupt first and returns with it still
> disabled if a register access fails. Resume isn't called after a failed
> suspend, so the interrupt is never enabled again. sx9310_resume() also
> returns without enabling it on error. Without an interrupt line,
> client->irq is 0 and both callbacks act on IRQ 0, which the driver
> doesn't own.
>
> Disable the interrupt only once the device is asleep, always enable it
> in resume, and skip both when there is no interrupt.

...

> +static int sx9310_wake_up(struct sx_common_data *data)
> +{
> + int ret;
> +
> + guard(mutex)(&data->mutex);

Add a blank line here.

*Yes, I saw other guard()() calls without blank lines in this file,
but that can be addressed afterwards)

> + ret = regmap_write(data->regmap, SX9310_REG_PAUSE, 1);
> + if (ret)
> + return ret;
> +
> + return regmap_write(data->regmap, SX9310_REG_PROX_CTRL0,
> + data->suspend_ctrl);

With

struct regmap *map = data->regmap;

at the top of the function these become

ret = regmap_write(map, SX9310_REG_PAUSE, 1);
if (ret)
return ret;

return regmap_write(map, SX9310_REG_PROX_CTRL0, data->suspend_ctrl);

> }

--
With Best Regards,
Andy Shevchenko