Re: [PATCH RESEND v5 4/6] iio: accel: mma8452: Support interrupt sharing
Andy Shevchenko <[email protected]>
| Newsgroups | org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Organization | Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo |
| Message-ID | <[email protected]> |
On Wed, Aug 19, 2026 at 10:15:31AM +0200, Esben Haabendal wrote: > Adding handling of rutnime PM suspension in the interrupt handler allows > sharing interrupt with other devices. > > Keep in mind that the device by default is using push-pull for the irq pin, > which might require additional hardware design to allow interrupt sharing. > > The suspended flag is added together with synchronize_irq() in order to > protect against race conditions when doing runtime suspend and device > removal. This way we ensure that interrupt handler does not try to access > the device while regulators are disabled. ... > + pm_status = pm_runtime_get_if_active(&data->client->dev); > + if (pm_status == 0 || READ_ONCE(data->suspended)) > + return IRQ_NONE; /* device is powered down or being removed */ This way it won't work (if pm_status != 0, you need to act accordingly). You need to split this: if (READ_ONCE(data->suspended)) return IRQ_NONE; /* device is being removed */ pm_status = pm_runtime_get_if_active(&data->client->dev); if (pm_status == 0) return IRQ_NONE; /* device is powered down */ But I'm not sure this will work as expected. ... > +out: out_runtime_put: Hint: Always name labels as an answer to the Q: 'What will happen if I goto $LABEL?'. > + if (pm_status > 0) > + pm_runtime_put_autosuspend(&data->client->dev); -- With Best Regards, Andy Shevchenko