On Mon, 15 Jun 2020 at 15:35, Mark Brown <broonie@xxxxxxxxxx> wrote: > > > Indeed. The upshot of all this is that the interrupt needs to be freed > not disabled before the clocks are disabled, or some other mechanism > needs to be used to ensure that the interrupt handler won't attempt to > access the hardware when it shouldn't. As Vladimir says there are > serious issues using devm for interrupt handlers (or anything else that > might cause code to be run) due to problems like this. And the down-shot is that whatever is done in dspi_remove (free_irq) also needs to be done in dspi_suspend, but with extra care in dspi_resume not only to request the irq again, but also to flush the module's FIFOs and clear interrupts, because there might have been nasty stuff uncaught during sleep: regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); So it's pretty messy. -Vladimir