linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] irqchip/gicv3: remove duplicated parameter testing
@ 2015-04-01  6:54 Zhen Lei
  2015-04-01  7:23 ` Marc Zyngier
  0 siblings, 1 reply; 2+ messages in thread
From: Zhen Lei @ 2015-04-01  6:54 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, linux-kernel
  Cc: Zefan Li, Xinwei Hu, Tianhong Ding, Kefeng Wang, Zhen Lei

Test hardware irq number from small to large, and add a blank above
each comment. To make it more clear.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/irqchip/irq-gic-v3.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index fd8850d..f43cfa1 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -611,12 +611,6 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
 	/* SGIs are private to the core kernel */
 	if (hw < 16)
 		return -EPERM;
-	/* Nothing here */
-	if (hw >= gic_data.irq_nr && hw < 8192)
-		return -EPERM;
-	/* Off limits */
-	if (hw >= GIC_ID_NR)
-		return -EPERM;

 	/* PPIs */
 	if (hw < 32) {
@@ -624,13 +618,17 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
 		irq_domain_set_info(d, irq, hw, &gic_chip, d->host_data,
 				    handle_percpu_devid_irq, NULL, NULL);
 		set_irq_flags(irq, IRQF_VALID | IRQF_NOAUTOEN);
+		return 0;
 	}
+
 	/* SPIs */
-	if (hw >= 32 && hw < gic_data.irq_nr) {
+	if (hw < gic_data.irq_nr) {
 		irq_domain_set_info(d, irq, hw, &gic_chip, d->host_data,
 				    handle_fasteoi_irq, NULL, NULL);
 		set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+		return 0;
 	}
+
 	/* LPIs */
 	if (hw >= 8192 && hw < GIC_ID_NR) {
 		if (!gic_dist_supports_lpis())
@@ -638,9 +636,10 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
 		irq_domain_set_info(d, irq, hw, &gic_chip, d->host_data,
 				    handle_fasteoi_irq, NULL, NULL);
 		set_irq_flags(irq, IRQF_VALID);
+		return 0;
 	}

-	return 0;
+	return -EPERM;
 }

 static int gic_irq_domain_xlate(struct irq_domain *d,
--
1.8.0



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

* Re: [PATCH 1/1] irqchip/gicv3: remove duplicated parameter testing
  2015-04-01  6:54 [PATCH 1/1] irqchip/gicv3: remove duplicated parameter testing Zhen Lei
@ 2015-04-01  7:23 ` Marc Zyngier
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2015-04-01  7:23 UTC (permalink / raw)
  To: Zhen Lei
  Cc: Thomas Gleixner, Jason Cooper, linux-kernel, Zefan Li, huxinwei,
	Tianhong Ding, Kefeng Wang

On Wed, 1 Apr 2015 07:54:58 +0100
Zhen Lei <thunder.leizhen@huawei.com> wrote:

> Test hardware irq number from small to large, and add a blank above
> each comment. To make it more clear.
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  drivers/irqchip/irq-gic-v3.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> index fd8850d..f43cfa1 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -611,12 +611,6 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
>  	/* SGIs are private to the core kernel */
>  	if (hw < 16)
>  		return -EPERM;
> -	/* Nothing here */
> -	if (hw >= gic_data.irq_nr && hw < 8192)
> -		return -EPERM;
> -	/* Off limits */
> -	if (hw >= GIC_ID_NR)
> -		return -EPERM;
> 
>  	/* PPIs */
>  	if (hw < 32) {
> @@ -624,13 +618,17 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
>  		irq_domain_set_info(d, irq, hw, &gic_chip, d->host_data,
>  				    handle_percpu_devid_irq, NULL, NULL);
>  		set_irq_flags(irq, IRQF_VALID | IRQF_NOAUTOEN);
> +		return 0;
>  	}
> +
>  	/* SPIs */
> -	if (hw >= 32 && hw < gic_data.irq_nr) {
> +	if (hw < gic_data.irq_nr) {
>  		irq_domain_set_info(d, irq, hw, &gic_chip, d->host_data,
>  				    handle_fasteoi_irq, NULL, NULL);
>  		set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> +		return 0;
>  	}
> +
>  	/* LPIs */
>  	if (hw >= 8192 && hw < GIC_ID_NR) {
>  		if (!gic_dist_supports_lpis())
> @@ -638,9 +636,10 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
>  		irq_domain_set_info(d, irq, hw, &gic_chip, d->host_data,
>  				    handle_fasteoi_irq, NULL, NULL);
>  		set_irq_flags(irq, IRQF_VALID);
> +		return 0;
>  	}
> 
> -	return 0;
> +	return -EPERM;
>  }
> 
>  static int gic_irq_domain_xlate(struct irq_domain *d,

Can you please explain the problem you're seeing and indicate how the
proposed fix is relevant to the problem? So far, I'm only seeing code
being moved around for no particular reason ("To make it more clear" is
really not enough a reason).

Thanks,

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

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

end of thread, other threads:[~2015-04-01  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-01  6:54 [PATCH 1/1] irqchip/gicv3: remove duplicated parameter testing Zhen Lei
2015-04-01  7:23 ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).