From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: geert@linux-m68k.org, tglx@kernel.org
Cc: radu@rendec.net, marscheng@google.com, eleanor15x@gmail.com,
jserv@ccns.ncku.edu.tw, linux-kernel@vger.kernel.org,
linux-m68k@lists.linux-m68k.org,
Kuan-Wei Chiu <visitorckw@gmail.com>
Subject: [PATCH v2 2/7] irqchip/goldfish-pic: Use for_each_set_bit() to iterate pending IRQ
Date: Thu, 26 Nov 2026 18:51:15 +0000 [thread overview]
Message-ID: <20261126185120.3815699-3-visitorckw@gmail.com> (raw)
In-Reply-To: <20261126185120.3815699-1-visitorckw@gmail.com>
Use for_each_set_bit() instead of open-coding the loop with __fls()
in goldfish_pic_cascade() to simplify the code.
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
drivers/irqchip/irq-goldfish-pic.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/irqchip/irq-goldfish-pic.c b/drivers/irqchip/irq-goldfish-pic.c
index c3c33f066140..12113ca90872 100644
--- a/drivers/irqchip/irq-goldfish-pic.c
+++ b/drivers/irqchip/irq-goldfish-pic.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/bitops.h>
#include <linux/goldfish.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
@@ -35,16 +36,14 @@ static void goldfish_pic_cascade(struct irq_desc *desc)
{
struct goldfish_pic_data *gfpic = irq_desc_get_handler_data(desc);
struct irq_chip *host_chip = irq_desc_get_chip(desc);
- u32 pending, hwirq;
+ unsigned long pending;
+ u32 hwirq;
chained_irq_enter(host_chip, desc);
pending = gf_ioread32(gfpic->base + GFPIC_REG_IRQ_PENDING);
- while (pending) {
- hwirq = __fls(pending);
+ for_each_set_bit(hwirq, &pending, GFPIC_NR_IRQS)
generic_handle_domain_irq(gfpic->irq_domain, hwirq);
- pending &= ~(1 << hwirq);
- }
chained_irq_exit(host_chip, desc);
}
--
2.56.1.839.g22a8290db9-goog
next prev parent reply other threads:[~2026-11-26 18:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 18:51 [PATCH v2 0/7] m68k: virt: Switch to generic goldfish PIC driver Kuan-Wei Chiu
2026-11-26 18:51 ` [PATCH v2 1/7] irqchip/goldfish-pic: Use gf_ioread32/gf_iowrite32 for MMIO access Kuan-Wei Chiu
2026-11-26 18:51 ` Kuan-Wei Chiu [this message]
2026-11-26 18:51 ` [PATCH v2 3/7] irqchip/goldfish-pic: Allow selecting CONFIG_GOLDFISH_PIC on other architectures Kuan-Wei Chiu
2026-11-26 18:51 ` [PATCH v2 4/7] irqchip/goldfish-pic: Add goldfish_pic_init() for non DT platforms Kuan-Wei Chiu
2026-11-26 18:51 ` [PATCH v2 5/7] m68k/irq: Add empty irq_eoi callback to auto/user IRQ chips Kuan-Wei Chiu
2026-11-26 18:51 ` [PATCH v2 6/7] m68k: virt: Switch to generic goldfish-pic driver Kuan-Wei Chiu
2026-11-26 18:51 ` [PATCH v2 7/7] MAINTAINERS: Update maintainer for goldfish PIC driver Kuan-Wei Chiu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126185120.3815699-3-visitorckw@gmail.com \
--to=visitorckw@gmail.com \
--cc=eleanor15x@gmail.com \
--cc=geert@linux-m68k.org \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=marscheng@google.com \
--cc=radu@rendec.net \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®