···2121config IIO_SYSFS_TRIGGER2222 tristate "SYSFS trigger"2323 depends on SYSFS2424- depends on HAVE_IRQ_WORK2524 select IRQ_WORK2625 help2726 Provides support for using SYSFS entry as IIO triggers.
-4
init/Kconfig
···2020 bool2121 depends on !UML22222323-config HAVE_IRQ_WORK2424- bool2525-2623config IRQ_WORK2724 bool2828- depends on HAVE_IRQ_WORK29253026config BUILDTIME_EXTABLE_SORT3127 bool
+15-6
kernel/irq_work.c
···3434 */3535static bool irq_work_claim(struct irq_work *work)3636{3737- unsigned long flags, nflags;3737+ unsigned long flags, oflags, nflags;38383939+ /*4040+ * Start with our best wish as a premise but only trust any4141+ * flag value after cmpxchg() result.4242+ */4343+ flags = work->flags & ~IRQ_WORK_PENDING;3944 for (;;) {4040- flags = work->flags;4141- if (flags & IRQ_WORK_PENDING)4242- return false;4345 nflags = flags | IRQ_WORK_FLAGS;4444- if (cmpxchg(&work->flags, flags, nflags) == flags)4646+ oflags = cmpxchg(&work->flags, flags, nflags);4747+ if (oflags == flags)4548 break;4949+ if (oflags & IRQ_WORK_PENDING)5050+ return false;5151+ flags = oflags;4652 cpu_relax();4753 }4854···125119 /*126120 * Clear the PENDING bit, after this point the @work127121 * can be re-used.122122+ * Make it immediately visible so that other CPUs trying123123+ * to claim that work don't rely on us to handle their data124124+ * while we are in the middle of the func.128125 */129129- work->flags = IRQ_WORK_BUSY;126126+ xchg(&work->flags, IRQ_WORK_BUSY);130127 work->func(work);131128 /*132129 * Clear the BUSY bit and return to the free state if