All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] genirq: Change can_request_irq() return value type to bool
@ 2022-09-14 11:06 Zhang Jianhua
  2022-09-14 12:01 ` Marc Zyngier
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Jianhua @ 2022-09-14 11:06 UTC (permalink / raw)
  To: tglx, maz, samuel, brgl, mark.rutland, lvjianmin; +Cc: chris.zjh, linux-kernel

The function can_request_irq() is used to judge whether the irq can be
allocated, so bool type would be more suitable for it.

Signed-off-by: Zhang Jianhua <chris.zjh@huawei.com>
---
 include/linux/irq.h | 2 +-
 kernel/irq/manage.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index c3eb89606c2b..3a60c2313fb9 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -707,7 +707,7 @@ extern void note_interrupt(struct irq_desc *desc, irqreturn_t action_ret);
 extern int noirqdebug_setup(char *str);
 
 /* Checks whether the interrupt can be requested by request_irq(): */
-extern int can_request_irq(unsigned int irq, unsigned long irqflags);
+extern bool can_request_irq(unsigned int irq, unsigned long irqflags);
 
 /* Dummy irq-chip implementations: */
 extern struct irq_chip no_irq_chip;
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 40fe7806cc8c..d6940d15bf56 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -925,19 +925,19 @@ EXPORT_SYMBOL(irq_set_irq_wake);
  * particular irq has been exclusively allocated or is available
  * for driver use.
  */
-int can_request_irq(unsigned int irq, unsigned long irqflags)
+bool can_request_irq(unsigned int irq, unsigned long irqflags)
 {
 	unsigned long flags;
 	struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
-	int canrequest = 0;
+	bool canrequest = false;
 
 	if (!desc)
-		return 0;
+		return false;
 
 	if (irq_settings_can_request(desc)) {
 		if (!desc->action ||
 		    irqflags & desc->action->flags & IRQF_SHARED)
-			canrequest = 1;
+			canrequest = true;
 	}
 	irq_put_desc_unlock(desc, flags);
 	return canrequest;
-- 
2.31.0


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

* Re: [PATCH -next] genirq: Change can_request_irq() return value type to bool
  2022-09-14 11:06 [PATCH -next] genirq: Change can_request_irq() return value type to bool Zhang Jianhua
@ 2022-09-14 12:01 ` Marc Zyngier
  2022-09-16  1:00   ` zhangjianhua (E)
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2022-09-14 12:01 UTC (permalink / raw)
  To: Zhang Jianhua; +Cc: tglx, samuel, brgl, mark.rutland, lvjianmin, linux-kernel

On Wed, 14 Sep 2022 12:06:15 +0100,
Zhang Jianhua <chris.zjh@huawei.com> wrote:
> 
> The function can_request_irq() is used to judge whether the irq can be
> allocated, so bool type would be more suitable for it.
> 
> Signed-off-by: Zhang Jianhua <chris.zjh@huawei.com>
> ---
>  include/linux/irq.h | 2 +-
>  kernel/irq/manage.c | 8 ++++----
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/irq.h b/include/linux/irq.h
> index c3eb89606c2b..3a60c2313fb9 100644
> --- a/include/linux/irq.h
> +++ b/include/linux/irq.h
> @@ -707,7 +707,7 @@ extern void note_interrupt(struct irq_desc *desc, irqreturn_t action_ret);
>  extern int noirqdebug_setup(char *str);
>  
>  /* Checks whether the interrupt can be requested by request_irq(): */
> -extern int can_request_irq(unsigned int irq, unsigned long irqflags);
> +extern bool can_request_irq(unsigned int irq, unsigned long irqflags);
>  
>  /* Dummy irq-chip implementations: */
>  extern struct irq_chip no_irq_chip;
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 40fe7806cc8c..d6940d15bf56 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -925,19 +925,19 @@ EXPORT_SYMBOL(irq_set_irq_wake);
>   * particular irq has been exclusively allocated or is available
>   * for driver use.
>   */
> -int can_request_irq(unsigned int irq, unsigned long irqflags)
> +bool can_request_irq(unsigned int irq, unsigned long irqflags)
>  {
>  	unsigned long flags;
>  	struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
> -	int canrequest = 0;
> +	bool canrequest = false;
>  
>  	if (!desc)
> -		return 0;
> +		return false;
>  
>  	if (irq_settings_can_request(desc)) {
>  		if (!desc->action ||
>  		    irqflags & desc->action->flags & IRQF_SHARED)
> -			canrequest = 1;
> +			canrequest = true;
>  	}
>  	irq_put_desc_unlock(desc, flags);
>  	return canrequest;

I'm sorry, but this is a very pointless change. Not only this doesn't
change anything for this particular code other than being cosmetic,
but it also doesn't help any of the callers which are still using an
int.

In general, this sort of patch only adds noise, and I'd like to see
less of them.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

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

* Re: [PATCH -next] genirq: Change can_request_irq() return value type to bool
  2022-09-14 12:01 ` Marc Zyngier
@ 2022-09-16  1:00   ` zhangjianhua (E)
  0 siblings, 0 replies; 3+ messages in thread
From: zhangjianhua (E) @ 2022-09-16  1:00 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: tglx, samuel, brgl, mark.rutland, lvjianmin, linux-kernel

Fine, thanks.

在 2022/9/14 20:01, Marc Zyngier 写道:
> On Wed, 14 Sep 2022 12:06:15 +0100,
> Zhang Jianhua <chris.zjh@huawei.com> wrote:
>> The function can_request_irq() is used to judge whether the irq can be
>> allocated, so bool type would be more suitable for it.
>>
>> Signed-off-by: Zhang Jianhua <chris.zjh@huawei.com>
>> ---
>>   include/linux/irq.h | 2 +-
>>   kernel/irq/manage.c | 8 ++++----
>>   2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/linux/irq.h b/include/linux/irq.h
>> index c3eb89606c2b..3a60c2313fb9 100644
>> --- a/include/linux/irq.h
>> +++ b/include/linux/irq.h
>> @@ -707,7 +707,7 @@ extern void note_interrupt(struct irq_desc *desc, irqreturn_t action_ret);
>>   extern int noirqdebug_setup(char *str);
>>   
>>   /* Checks whether the interrupt can be requested by request_irq(): */
>> -extern int can_request_irq(unsigned int irq, unsigned long irqflags);
>> +extern bool can_request_irq(unsigned int irq, unsigned long irqflags);
>>   
>>   /* Dummy irq-chip implementations: */
>>   extern struct irq_chip no_irq_chip;
>> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
>> index 40fe7806cc8c..d6940d15bf56 100644
>> --- a/kernel/irq/manage.c
>> +++ b/kernel/irq/manage.c
>> @@ -925,19 +925,19 @@ EXPORT_SYMBOL(irq_set_irq_wake);
>>    * particular irq has been exclusively allocated or is available
>>    * for driver use.
>>    */
>> -int can_request_irq(unsigned int irq, unsigned long irqflags)
>> +bool can_request_irq(unsigned int irq, unsigned long irqflags)
>>   {
>>   	unsigned long flags;
>>   	struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
>> -	int canrequest = 0;
>> +	bool canrequest = false;
>>   
>>   	if (!desc)
>> -		return 0;
>> +		return false;
>>   
>>   	if (irq_settings_can_request(desc)) {
>>   		if (!desc->action ||
>>   		    irqflags & desc->action->flags & IRQF_SHARED)
>> -			canrequest = 1;
>> +			canrequest = true;
>>   	}
>>   	irq_put_desc_unlock(desc, flags);
>>   	return canrequest;
> I'm sorry, but this is a very pointless change. Not only this doesn't
> change anything for this particular code other than being cosmetic,
> but it also doesn't help any of the callers which are still using an
> int.
>
> In general, this sort of patch only adds noise, and I'd like to see
> less of them.
>
> Thanks,
>
> 	M.
>

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

end of thread, other threads:[~2022-09-16  1:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14 11:06 [PATCH -next] genirq: Change can_request_irq() return value type to bool Zhang Jianhua
2022-09-14 12:01 ` Marc Zyngier
2022-09-16  1:00   ` zhangjianhua (E)

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.