summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-07-13 20:22:33 +0300
committerVinod Koul <vkoul@kernel.org>2022-09-04 20:19:35 +0300
commitd6b76a45d5ae241af61cabd03496a376bd63207d (patch)
treeb5fab15b74be65df436ae815845b437669b5669f
parentd5988dcc760ca5cf683867163c7c78454fb2ec31 (diff)
downloadlinux-d6b76a45d5ae241af61cabd03496a376bd63207d.tar.xz
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>
-rw-r--r--drivers/dma/hsu/pci.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/dma/hsu/pci.c b/drivers/dma/hsu/pci.c
index 4ed6a4ef1512..8cdf715a7e9e 100644
--- a/drivers/dma/hsu/pci.c
+++ b/drivers/dma/hsu/pci.c
@@ -26,22 +26,19 @@
static irqreturn_t hsu_pci_irq(int irq, void *dev)
{
struct hsu_dma_chip *chip = dev;
- u32 dmaisr;
- u32 status;
+ unsigned long dmaisr;
unsigned short i;
+ u32 status;
int ret = 0;
int err;
dmaisr = readl(chip->regs + HSU_PCI_DMAISR);
- for (i = 0; i < chip->hsu->nr_channels; i++) {
- if (dmaisr & 0x1) {
- err = hsu_dma_get_status(chip, i, &status);
- if (err > 0)
- ret |= 1;
- else if (err == 0)
- ret |= hsu_dma_do_irq(chip, i, status);
- }
- dmaisr >>= 1;
+ for_each_set_bit(i, &dmaisr, chip->hsu->nr_channels) {
+ err = hsu_dma_get_status(chip, i, &status);
+ if (err > 0)
+ ret |= 1;
+ else if (err == 0)
+ ret |= hsu_dma_do_irq(chip, i, status);
}
return IRQ_RETVAL(ret);