All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: SGI-IP30: Use bitmap API when iterating over bitmap
@ 2024-04-17  7:18 Philippe Mathieu-Daudé
  2024-04-17 11:13 ` Thomas Bogendoerfer
  2024-04-17 17:27 ` Yury Norov
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-17  7:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Bogendoerfer, linux-mips, Philippe Mathieu-Daudé, Yury Norov

Do not open-code bitmap_set(). Besides, <linux/bitmap.h> API
allows architecture specific optimizations, so prefer it.

Use the HEART_NUM_IRQS definition to express the end of the
HEART bitmap.

Inspired-by: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 arch/mips/sgi-ip30/ip30-irq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/mips/sgi-ip30/ip30-irq.c b/arch/mips/sgi-ip30/ip30-irq.c
index 423c32cb66ed..bdafff076191 100644
--- a/arch/mips/sgi-ip30/ip30-irq.c
+++ b/arch/mips/sgi-ip30/ip30-irq.c
@@ -264,7 +264,6 @@ void __init arch_init_irq(void)
 	struct irq_domain *domain;
 	struct fwnode_handle *fn;
 	unsigned long *mask;
-	int i;
 
 	mips_cpu_irq_init();
 
@@ -300,8 +299,7 @@ void __init arch_init_irq(void)
 	set_bit(HEART_L3_INT_TIMER, heart_irq_map);
 
 	/* Reserve the error interrupts (#51 to #63). */
-	for (i = HEART_L4_INT_XWID_ERR_9; i <= HEART_L4_INT_HEART_EXCP; i++)
-		set_bit(i, heart_irq_map);
+	bitmap_set(heart_irq_map, HEART_L4_INT_XWID_ERR_9, HEART_NUM_IRQS);
 
 	fn = irq_domain_alloc_named_fwnode("HEART");
 	WARN_ON(fn == NULL);
-- 
2.41.0


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

* Re: [PATCH] MIPS: SGI-IP30: Use bitmap API when iterating over bitmap
  2024-04-17  7:18 [PATCH] MIPS: SGI-IP30: Use bitmap API when iterating over bitmap Philippe Mathieu-Daudé
@ 2024-04-17 11:13 ` Thomas Bogendoerfer
  2024-04-17 17:27 ` Yury Norov
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2024-04-17 11:13 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: linux-kernel, linux-mips, Yury Norov

On Wed, Apr 17, 2024 at 09:18:29AM +0200, Philippe Mathieu-Daudé wrote:
> Do not open-code bitmap_set(). Besides, <linux/bitmap.h> API
> allows architecture specific optimizations, so prefer it.
> 
> Use the HEART_NUM_IRQS definition to express the end of the
> HEART bitmap.

please use HEART_L4_INT_HEART_EXCP + 1, like what the code did before.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

* Re: [PATCH] MIPS: SGI-IP30: Use bitmap API when iterating over bitmap
  2024-04-17  7:18 [PATCH] MIPS: SGI-IP30: Use bitmap API when iterating over bitmap Philippe Mathieu-Daudé
  2024-04-17 11:13 ` Thomas Bogendoerfer
@ 2024-04-17 17:27 ` Yury Norov
  2024-04-18 13:37   ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 4+ messages in thread
From: Yury Norov @ 2024-04-17 17:27 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: linux-kernel, Thomas Bogendoerfer, linux-mips

On Wed, Apr 17, 2024 at 09:18:29AM +0200, Philippe Mathieu-Daudé wrote:
> Do not open-code bitmap_set(). Besides, <linux/bitmap.h> API
> allows architecture specific optimizations, so prefer it.
> 
> Use the HEART_NUM_IRQS definition to express the end of the
> HEART bitmap.
> 
> Inspired-by: Yury Norov <yury.norov@gmail.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  arch/mips/sgi-ip30/ip30-irq.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/arch/mips/sgi-ip30/ip30-irq.c b/arch/mips/sgi-ip30/ip30-irq.c
> index 423c32cb66ed..bdafff076191 100644
> --- a/arch/mips/sgi-ip30/ip30-irq.c
> +++ b/arch/mips/sgi-ip30/ip30-irq.c
> @@ -264,7 +264,6 @@ void __init arch_init_irq(void)
>  	struct irq_domain *domain;
>  	struct fwnode_handle *fn;
>  	unsigned long *mask;
> -	int i;
>  
>  	mips_cpu_irq_init();
>  
> @@ -300,8 +299,7 @@ void __init arch_init_irq(void)
>  	set_bit(HEART_L3_INT_TIMER, heart_irq_map);
>  
>  	/* Reserve the error interrupts (#51 to #63). */
> -	for (i = HEART_L4_INT_XWID_ERR_9; i <= HEART_L4_INT_HEART_EXCP; i++)
> -		set_bit(i, heart_irq_map);
> +	bitmap_set(heart_irq_map, HEART_L4_INT_XWID_ERR_9, HEART_NUM_IRQS);

This function has a signature
        bitmap_set(map, start, length)

So this should be a:
        bitmap_set(heart_irq_map, HEART_L4_INT_XWID_ERR_9,
                   HEART_NUM_IRQS - HEART_L4_INT_XWID_ERR_9 + 1)

Also on the above group of set_bit(). It should be 2 bitmap_set()
calls to me. HEART_L0_INT [0, 2] is the first one, and HEART_L2_INT
to HEART_L4_INT [46, 63] is the other. Isn't?

Thanks,
Yury

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

* Re: [PATCH] MIPS: SGI-IP30: Use bitmap API when iterating over bitmap
  2024-04-17 17:27 ` Yury Norov
@ 2024-04-18 13:37   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-04-18 13:37 UTC (permalink / raw)
  To: Yury Norov; +Cc: linux-kernel, Thomas Bogendoerfer, linux-mips

On 17/4/24 19:27, Yury Norov wrote:
> On Wed, Apr 17, 2024 at 09:18:29AM +0200, Philippe Mathieu-Daudé wrote:
>> Do not open-code bitmap_set(). Besides, <linux/bitmap.h> API
>> allows architecture specific optimizations, so prefer it.
>>
>> Use the HEART_NUM_IRQS definition to express the end of the
>> HEART bitmap.
>>
>> Inspired-by: Yury Norov <yury.norov@gmail.com>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   arch/mips/sgi-ip30/ip30-irq.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/arch/mips/sgi-ip30/ip30-irq.c b/arch/mips/sgi-ip30/ip30-irq.c
>> index 423c32cb66ed..bdafff076191 100644
>> --- a/arch/mips/sgi-ip30/ip30-irq.c
>> +++ b/arch/mips/sgi-ip30/ip30-irq.c
>> @@ -264,7 +264,6 @@ void __init arch_init_irq(void)
>>   	struct irq_domain *domain;
>>   	struct fwnode_handle *fn;
>>   	unsigned long *mask;
>> -	int i;
>>   
>>   	mips_cpu_irq_init();
>>   
>> @@ -300,8 +299,7 @@ void __init arch_init_irq(void)
>>   	set_bit(HEART_L3_INT_TIMER, heart_irq_map);
>>   
>>   	/* Reserve the error interrupts (#51 to #63). */
>> -	for (i = HEART_L4_INT_XWID_ERR_9; i <= HEART_L4_INT_HEART_EXCP; i++)
>> -		set_bit(i, heart_irq_map);
>> +	bitmap_set(heart_irq_map, HEART_L4_INT_XWID_ERR_9, HEART_NUM_IRQS);
> 
> This function has a signature
>          bitmap_set(map, start, length)

Doh, I thought it was (map, from_inc, to_exc), my bad.

> So this should be a:
>          bitmap_set(heart_irq_map, HEART_L4_INT_XWID_ERR_9,
>                     HEART_NUM_IRQS - HEART_L4_INT_XWID_ERR_9 + 1)
> 
> Also on the above group of set_bit(). It should be 2 bitmap_set()
> calls to me. HEART_L0_INT [0, 2] is the first one, and HEART_L2_INT
> to HEART_L4_INT [46, 63] is the other. Isn't?

Please disregard this patch, sorry for the noise.

Regards,

Phil.

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

end of thread, other threads:[~2024-04-18 13:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17  7:18 [PATCH] MIPS: SGI-IP30: Use bitmap API when iterating over bitmap Philippe Mathieu-Daudé
2024-04-17 11:13 ` Thomas Bogendoerfer
2024-04-17 17:27 ` Yury Norov
2024-04-18 13:37   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.