public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH -next] irqchip/sifive-plic: Make use of __assign_bit() API
@ 2024-09-02 13:08 Hongbo Li
  2024-09-17 13:24 ` Palmer Dabbelt
  2024-12-11 22:32 ` patchwork-bot+linux-riscv
  0 siblings, 2 replies; 3+ messages in thread
From: Hongbo Li @ 2024-09-02 13:08 UTC (permalink / raw)
  To: tglx, paul.walmsley, samuel.holland; +Cc: linux-kernel, linux-riscv, lihongbo22

We have for some time the __assign_bit() API to replace
open coded
    if (foo)
        __set_bit(n, bar);
    else
        __clear_bit(n, bar);

Use this API to simplify the code. No functional change
intended.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 drivers/irqchip/irq-sifive-plic.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index 2f6ef5c495bd..c576b9bbeb13 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -252,10 +252,8 @@ 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);
+		__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);
-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] irqchip/sifive-plic: Make use of __assign_bit() API
  2024-09-02 13:08 [PATCH -next] irqchip/sifive-plic: Make use of __assign_bit() API Hongbo Li
@ 2024-09-17 13:24 ` Palmer Dabbelt
  2024-12-11 22:32 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 3+ messages in thread
From: Palmer Dabbelt @ 2024-09-17 13:24 UTC (permalink / raw)
  To: lihongbo22
  Cc: tglx, Paul Walmsley, samuel.holland, linux-kernel, linux-riscv,
	lihongbo22

On Mon, 02 Sep 2024 06:08:24 PDT (-0700), lihongbo22@huawei.com wrote:
> We have for some time the __assign_bit() API to replace
> open coded
>     if (foo)
>         __set_bit(n, bar);
>     else
>         __clear_bit(n, bar);
>
> Use this API to simplify the code. No functional change
> intended.
>
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
> ---
>  drivers/irqchip/irq-sifive-plic.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
> index 2f6ef5c495bd..c576b9bbeb13 100644
> --- a/drivers/irqchip/irq-sifive-plic.c
> +++ b/drivers/irqchip/irq-sifive-plic.c
> @@ -252,10 +252,8 @@ 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);
> +		__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);

Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] irqchip/sifive-plic: Make use of __assign_bit() API
  2024-09-02 13:08 [PATCH -next] irqchip/sifive-plic: Make use of __assign_bit() API Hongbo Li
  2024-09-17 13:24 ` Palmer Dabbelt
@ 2024-12-11 22:32 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-12-11 22:32 UTC (permalink / raw)
  To: Hongbo Li; +Cc: linux-riscv, tglx, paul.walmsley, samuel.holland, linux-kernel

Hello:

This patch was applied to riscv/linux.git (fixes)
by Thomas Gleixner <tglx@linutronix.de>:

On Mon, 2 Sep 2024 21:08:24 +0800 you wrote:
> We have for some time the __assign_bit() API to replace
> open coded
>     if (foo)
>         __set_bit(n, bar);
>     else
>         __clear_bit(n, bar);
> 
> [...]

Here is the summary with links:
  - [-next] irqchip/sifive-plic: Make use of __assign_bit() API
    https://git.kernel.org/riscv/c/40d7af5375a4

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-11 22:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 13:08 [PATCH -next] irqchip/sifive-plic: Make use of __assign_bit() API Hongbo Li
2024-09-17 13:24 ` Palmer Dabbelt
2024-12-11 22:32 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox