[tip: irq/core] irqchip/sifive-plic: Make use of __assign_bit()

tip-bot2 for Hongbo Li
2024-10-02T15:43:40Z

The following commit has been merged into the irq/core branch of tip:

Commit-ID: 40d7af5375a4e27d8576d9d11954ac213d06f09e
Gitweb: https://git.kernel.org/tip/40d7af5375a4e27d8576d9d11954ac213d06f09e
Author: Hongbo Li <lihongbo22@huawei.com>
AuthorDate: Mon, 02 Sep 2024 21:08:24 +08:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 02 Oct 2024 15:39:39 +02:00

irqchip/sifive-plic: Make use of __assign_bit()

Replace the open coded

if (foo)
__set_bit(n, bar);
else
__clear_bit(n, bar);

with __assign_bit(). No functional change intended.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Link: https://lore.kernel.org/all/20240902130824.2878644-1-lihongbo22@huawei.com

---
drivers/irqchip/irq-sifive-plic.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index 2f6ef5c..a3b199d 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -251,11 +251,10 @@ static int plic_irq_suspend(void)

priv = per_cpu_ptr(&plic_handlers, smp_processor_id())->priv;

- for (i = 0; i < priv->nr_irqs; i++)
- if (readl(priv->regs + PRIORITY_BASE + i * PRIORITY_PER_ID))
- __set_bit(i, priv->prio_save);
- else
- __clear_bit(i, priv->prio_save);
+ for (i = 0; i < priv->nr_irqs; i++) {
+ __assign_bit(i, priv->prio_save,
+ readl(priv->regs + PRIORITY_BASE + i * PRIORITY_PER_ID));
+ }

for_each_cpu(cpu, cpu_present_mask) {
struct plic_handler *handler = per_cpu_ptr(&plic_handlers, cpu);