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

dmaengine: hsu: using for_each_set_bit to simplify the code

It's more cleanly to use for_each_set_bit() instead of opencoding it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220713172235.22611-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Andy Shevchenko and committed by
Vinod Koul
d6b76a45 d5988dcc

+8 -11
+8 -11
drivers/dma/hsu/pci.c
··· 26 26 static irqreturn_t hsu_pci_irq(int irq, void *dev) 27 27 { 28 28 struct hsu_dma_chip *chip = dev; 29 - u32 dmaisr; 30 - u32 status; 29 + unsigned long dmaisr; 31 30 unsigned short i; 31 + u32 status; 32 32 int ret = 0; 33 33 int err; 34 34 35 35 dmaisr = readl(chip->regs + HSU_PCI_DMAISR); 36 - for (i = 0; i < chip->hsu->nr_channels; i++) { 37 - if (dmaisr & 0x1) { 38 - err = hsu_dma_get_status(chip, i, &status); 39 - if (err > 0) 40 - ret |= 1; 41 - else if (err == 0) 42 - ret |= hsu_dma_do_irq(chip, i, status); 43 - } 44 - dmaisr >>= 1; 36 + for_each_set_bit(i, &dmaisr, chip->hsu->nr_channels) { 37 + err = hsu_dma_get_status(chip, i, &status); 38 + if (err > 0) 39 + ret |= 1; 40 + else if (err == 0) 41 + ret |= hsu_dma_do_irq(chip, i, status); 45 42 } 46 43 47 44 return IRQ_RETVAL(ret);