On Tue, Aug 14, 2018 at 12:16 AM, Stefan Lengfeld <contact@xxxxxxxxxxxxxxx> wrote: > Like the PM subsystem routine pm_runtime_irq_safe() and flag 'irq_safe' No, it seems unlike as in PM. PM has one crucial detail which is done together with enabling IRQ safety. > add a similar function i2c_adapter_irq_safe() to the I2C core. A driver > should be able to announce whether his transfer implementations are safe > to be called in IRQ disabled or atomic contexts, also called polling > mode or sleep free operation. > > Making I2C transfers in atomic context is sometimes needed, e.g. for > reboot handlers. > > Every driver should be able to declare explicitly whether IRQ disabled > operation is supported or not. When you try make a I2C transfer in > atomic contexts, it's already hard enough to ensure that every code path > through the kernel is sleep-free. So give the curious developer a strong > hint whether a driver supports atomic operation or not. Fail early > instead of hoping that the LOCKDEP framework noticed the programming > error. -- With Best Regards, Andy Shevchenko