Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

uio: uio_dmem_genirq: Use non-atomic bit operations in irq config and handling

This finishes the port of the irq configuration and handling from
"uio_pdrv_genirq" to "uio_dmem_genirq". It changes the atomic
bit-manipulation routines to their non-atomic counterparts as we are
already guarding the code by spinlock.

Split out from commit 34cb27528398 ("UIO: Fix concurrency issue").

Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
Link: https://lore.kernel.org/r/20220930224100.816175-4-rafaelmendsr@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rafael Mendonca and committed by
Greg Kroah-Hartman
a3fc57bc 118b9180

+8 -3
+8 -3
drivers/uio/uio_dmem_genirq.c
··· 41 41 unsigned int refcnt; 42 42 }; 43 43 44 + /* Bits in uio_dmem_genirq_platdata.flags */ 45 + enum { 46 + UIO_IRQ_DISABLED = 0, 47 + }; 48 + 44 49 static int uio_dmem_genirq_open(struct uio_info *info, struct inode *inode) 45 50 { 46 51 struct uio_dmem_genirq_platdata *priv = info->priv; ··· 116 111 */ 117 112 118 113 spin_lock(&priv->lock); 119 - if (!test_and_set_bit(0, &priv->flags)) 114 + if (!__test_and_set_bit(UIO_IRQ_DISABLED, &priv->flags)) 120 115 disable_irq_nosync(irq); 121 116 spin_unlock(&priv->lock); 122 117 ··· 138 133 139 134 spin_lock_irqsave(&priv->lock, flags); 140 135 if (irq_on) { 141 - if (test_and_clear_bit(0, &priv->flags)) 136 + if (__test_and_clear_bit(UIO_IRQ_DISABLED, &priv->flags)) 142 137 enable_irq(dev_info->irq); 143 138 } else { 144 - if (!test_and_set_bit(0, &priv->flags)) 139 + if (!__test_and_set_bit(UIO_IRQ_DISABLED, &priv->flags)) 145 140 disable_irq_nosync(dev_info->irq); 146 141 } 147 142 spin_unlock_irqrestore(&priv->lock, flags);