[PATCH -next] irqchip/sifive-plic: Make use of __assign_bit() API

Palmer Dabbelt palmer at dabbelt.com
Tue Sep 17 06:24:43 PDT 2024


On Mon, 02 Sep 2024 06:08:24 PDT (-0700), lihongbo22 at 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 at 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 at rivosinc.com>
Acked-by: Palmer Dabbelt <palmer at rivosinc.com>



More information about the linux-riscv mailing list