Skip to contentSkip to conversation

irqchip: atmel-aic: Handle aic_common_irq_fixup in aic_common_of_init

PATCH In review Milo Kim 3 participants 13 messages Jan 13, 2016 – Feb 8, 2016

Subsystems (3)
lore
Share & tools
lore
author
#1 lore raw

PATCH 2/4 irqchip: atmel-aic: Fix wrong bit operation for IRQ priority

In reply to Milo Kim

Atmel AIC has common structure for SMR (Source Mode Register).

bit[6:5] Interrupt source type
bit[2:0] Priority level
Other bits are unused.

To update new priority value, bit[2:0] should be cleared first and then new priority level can be written. However, aic_common_set_priority() helper clears source type bits instead of priority bits. This patch fixes wrong mask bit operation.

Fixes b1479ebb7720 ("irqchip: atmel-aic: Add atmel AIC/AIC5 drivers")
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Ludovic Desroches <[email protected]>
Cc Nicholas Ferre <[email protected]>
Cc <[email protected]> #v3.17+
---
 drivers/irqchip/irq-atmel-aic-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-atmel-aic-common.c +1 -1
index 2f2d73e..661840b 100644
@@ -86,7 +86,7 @@ int aic_common_set_priority(int priority, unsigned *val)
 	    priority > AT91_AIC_IRQ_MAX_PRIORITY)
 		return -EINVAL;
 
-	*val &= AT91_AIC_PRIOR;
+	*val &= ~AT91_AIC_PRIOR;
 	*val |= priority;
 
 	return 0;
Signature · 1 line
2.7.0

Milo Kim

author
#0 lore raw

PATCH 1/4 irqchip: atmel-aic: Handle aic_common_irq_fixup in aic_common_of_init

AIC IRQ fixup is handled in each IRQ chip driver.
It can be moved into aic_common_of_init() before returning the result. Then, aic_common_irq_fixup() can be changed to static type.

Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Ludovic Desroches <[email protected]>
Cc Nicholas Ferre <[email protected]>
---
 drivers/irqchip/irq-atmel-aic-common.c | 6 ++++--
 drivers/irqchip/irq-atmel-aic-common.h | 5 ++---
 drivers/irqchip/irq-atmel-aic.c        | 4 +---
 drivers/irqchip/irq-atmel-aic5.c       | 4 +---
 4 files changed, 8 insertions(+), 11 deletions(-)
drivers/irqchip/irq-atmel-aic-common.c +4 -2
index b12a5d5..2f2d73e 100644
@@ -193,7 +193,7 @@ void __init aic_common_rtt_irq_fixup(struct device_node *root)
 	}
 }
 
-void __init aic_common_irq_fixup(const struct of_device_id *matches)
+static void __init aic_common_irq_fixup(const struct of_device_id *matches)
 {
 	struct device_node *root = of_find_node_by_path("/");
 	const struct of_device_id *match;
@@ -214,7 +214,8 @@ void __init aic_common_irq_fixup(const struct of_device_id *matches)
 
 struct irq_domain *__init aic_common_of_init(struct device_node *node,
 					     const struct irq_domain_ops *ops,
-					     const char *name, int nirqs)
+					     const char *name, int nirqs,
+					     const struct of_device_id *matches)
 {
 	struct irq_chip_generic *gc;
 	struct irq_domain *domain;
@@ -264,6 +265,7 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node,
 	}
 
 	aic_common_ext_irq_of_init(domain);
+	aic_common_irq_fixup(matches);
 
 	return domain;
 
drivers/irqchip/irq-atmel-aic-common.h +2 -3
index 603f0a9..046bcc8 100644
@@ -30,12 +30,11 @@ int aic_common_irq_domain_xlate(struct irq_domain *d,
 
 struct irq_domain *__init aic_common_of_init(struct device_node *node,
 					     const struct irq_domain_ops *ops,
-					     const char *name, int nirqs);
+					     const char *name, int nirqs,
+					     const struct of_device_id *matches);
 
 void __init aic_common_rtc_irq_fixup(struct device_node *root);
 
 void __init aic_common_rtt_irq_fixup(struct device_node *root);
 
-void __init aic_common_irq_fixup(const struct of_device_id *matches);
-
 #endif /* __IRQ_ATMEL_AIC_COMMON_H */
drivers/irqchip/irq-atmel-aic.c +1 -3
index 8a0c7f2..799834d 100644
@@ -248,12 +248,10 @@ static int __init aic_of_init(struct device_node *node,
 		return -EEXIST;
 
 	domain = aic_common_of_init(node, &aic_irq_ops, "atmel-aic",
-				    NR_AIC_IRQS);
+				    NR_AIC_IRQS, aic_irq_fixups);
 	if (IS_ERR(domain))
 		return PTR_ERR(domain);
 
-	aic_common_irq_fixup(aic_irq_fixups);
-
 	aic_domain = domain;
 	gc = irq_get_domain_generic_chip(domain, 0);
 
drivers/irqchip/irq-atmel-aic5.c +1 -3
index 62bb840..a7e8fc8 100644
@@ -312,12 +312,10 @@ static int __init aic5_of_init(struct device_node *node,
 		return -EEXIST;
 
 	domain = aic_common_of_init(node, &aic5_irq_ops, "atmel-aic5",
-				    nirqs);
+				    nirqs, aic5_irq_fixups);
 	if (IS_ERR(domain))
 		return PTR_ERR(domain);
 
-	aic_common_irq_fixup(aic5_irq_fixups);
-
 	aic5_domain = domain;
 	nchips = aic5_domain->revmap_size / 32;
 	for (i = 0; i < nchips; i++) {
Signature · 1 line
2.7.0
author
#3 lore raw

PATCH 3/4 irqchip: atmel-aic: Change return type of aic_common_set_priority()

Priority validation is not necessary because aic_common_irq_domain_xlate() already handles it. With this removal, return type can be changed to void.

Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Boris Brezillon <[email protected]>
Cc Ludovic Desroches <[email protected]>
Cc Nicholas Ferre <[email protected]>
---
 drivers/irqchip/irq-atmel-aic-common.c | 8 +-------
 drivers/irqchip/irq-atmel-aic-common.h | 2 +-
 drivers/irqchip/irq-atmel-aic.c        | 5 ++---
 drivers/irqchip/irq-atmel-aic5.c       | 5 ++---
 4 files changed, 6 insertions(+), 14 deletions(-)
drivers/irqchip/irq-atmel-aic-common.c +1 -7
index 661840b..28b26c8 100644
@@ -80,16 +80,10 @@ int aic_common_set_type(struct irq_data *d, unsigned type, unsigned *val)
 	return 0;
 }
 
-int aic_common_set_priority(int priority, unsigned *val)
+void aic_common_set_priority(int priority, unsigned *val)
 {
-	if (priority < AT91_AIC_IRQ_MIN_PRIORITY ||
-	    priority > AT91_AIC_IRQ_MAX_PRIORITY)
-		return -EINVAL;
-
 	*val &= ~AT91_AIC_PRIOR;
 	*val |= priority;
-
-	return 0;
 }
 
 int aic_common_irq_domain_xlate(struct irq_domain *d,
drivers/irqchip/irq-atmel-aic-common.h +1 -1
index 046bcc8..af60376 100644
@@ -19,7 +19,7 @@
 
 int aic_common_set_type(struct irq_data *d, unsigned type, unsigned *val);
 
-int aic_common_set_priority(int priority, unsigned *val);
+void aic_common_set_priority(int priority, unsigned *val);
 
 int aic_common_irq_domain_xlate(struct irq_domain *d,
 				struct device_node *ctrlr,
drivers/irqchip/irq-atmel-aic.c +2 -3
index 799834d..112e17c 100644
@@ -196,9 +196,8 @@ static int aic_irq_domain_xlate(struct irq_domain *d,
 
 	irq_gc_lock(gc);
 	smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq));
-	ret = aic_common_set_priority(intspec[2], &smr);
-	if (!ret)
-		irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
+	aic_common_set_priority(intspec[2], &smr);
+	irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
 	irq_gc_unlock(gc);
 
 	return ret;
drivers/irqchip/irq-atmel-aic5.c +2 -3
index a7e8fc8..f36f426 100644
@@ -272,9 +272,8 @@ static int aic5_irq_domain_xlate(struct irq_domain *d,
 	irq_gc_lock(bgc);
 	irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
-	ret = aic_common_set_priority(intspec[2], &smr);
-	if (!ret)
-		irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
+	aic_common_set_priority(intspec[2], &smr);
+	irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
 	irq_gc_unlock(bgc);
 
 	return ret;
Signature · 1 line
2.7.0
author
#7 lore raw

PATCH 4/4 irqchip: atmel-aic: Remove duplicate bit operation

In reply to Milo Kim

AIC5 priority value is updated twice -
in aic_common_set_priority() and when updating AT91_AIC5_SMR. Variable, 'smr' has updated priority value (intspec[2]) in the first step, so no need to update it again in the second step.

Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Boris Brezillon <[email protected]>
Cc Ludovic Desroches <[email protected]>
Cc Nicholas Ferre <[email protected]>
---
 drivers/irqchip/irq-atmel-aic5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-atmel-aic5.c +1 -1
index f36f426..4f0d068 100644
@@ -273,7 +273,7 @@ static int aic5_irq_domain_xlate(struct irq_domain *d,
 	irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
 	aic_common_set_priority(intspec[2], &smr);
-	irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
+	irq_reg_writel(bgc, smr, AT91_AIC5_SMR);
 	irq_gc_unlock(bgc);
 
 	return ret;
Signature · 1 line
2.7.0
Acked-by on v1 3/4
#4 lore raw

Re: [PATCH 3/4] irqchip: atmel-aic: Change return type of aic_common_set_priority()

In reply to Milo Kim
Quoted 11 lines · On Wed, 13 Jan 2016 16:19:51 +0900 Milo Kim <[email protected]> wrote:

Priority validation is not necessary because aic_common_irq_domain_xlate() already handles it. With this removal, return type can be changed to void.

Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Boris Brezillon <[email protected]>
Cc Ludovic Desroches <[email protected]>
Cc Nicholas Ferre <[email protected]>

Thanks,

Boris

Quoted 74 lines
---
 drivers/irqchip/irq-atmel-aic-common.c | 8 +-------
 drivers/irqchip/irq-atmel-aic-common.h | 2 +-
 drivers/irqchip/irq-atmel-aic.c        | 5 ++---
 drivers/irqchip/irq-atmel-aic5.c       | 5 ++---
 4 files changed, 6 insertions(+), 14 deletions(-)
drivers/irqchip/irq-atmel-aic-common.c +1 -7
index 661840b..28b26c8 100644
@@ -80,16 +80,10 @@ int aic_common_set_type(struct irq_data *d, unsigned type, unsigned *val)
 	return 0;
 }
 
-int aic_common_set_priority(int priority, unsigned *val)
+void aic_common_set_priority(int priority, unsigned *val)
 {
-	if (priority < AT91_AIC_IRQ_MIN_PRIORITY ||
-	    priority > AT91_AIC_IRQ_MAX_PRIORITY)
-		return -EINVAL;
-
 	*val &= ~AT91_AIC_PRIOR;
 	*val |= priority;
-
-	return 0;
 }
 
 int aic_common_irq_domain_xlate(struct irq_domain *d,
drivers/irqchip/irq-atmel-aic-common.h +1 -1
index 046bcc8..af60376 100644
@@ -19,7 +19,7 @@
 
 int aic_common_set_type(struct irq_data *d, unsigned type, unsigned *val);
 
-int aic_common_set_priority(int priority, unsigned *val);
+void aic_common_set_priority(int priority, unsigned *val);
 
 int aic_common_irq_domain_xlate(struct irq_domain *d,
 				struct device_node *ctrlr,
drivers/irqchip/irq-atmel-aic.c +2 -3
index 799834d..112e17c 100644
@@ -196,9 +196,8 @@ static int aic_irq_domain_xlate(struct irq_domain *d,
 
 	irq_gc_lock(gc);
 	smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq));
-	ret = aic_common_set_priority(intspec[2], &smr);
-	if (!ret)
-		irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
+	aic_common_set_priority(intspec[2], &smr);
+	irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
 	irq_gc_unlock(gc);
 
 	return ret;
drivers/irqchip/irq-atmel-aic5.c +2 -3
index a7e8fc8..f36f426 100644
@@ -272,9 +272,8 @@ static int aic5_irq_domain_xlate(struct irq_domain *d,
 	irq_gc_lock(bgc);
 	irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
-	ret = aic_common_set_priority(intspec[2], &smr);
-	if (!ret)
-		irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
+	aic_common_set_priority(intspec[2], &smr);
+	irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
 	irq_gc_unlock(bgc);
 
 	return ret;
Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Acked-by on v1 4/4
#8 lore raw

Re: [PATCH 4/4] irqchip: atmel-aic: Remove duplicate bit operation

In reply to Milo Kim
Quoted 5 lines · On Wed, 13 Jan 2016 16:19:52 +0900 Milo Kim <[email protected]> wrote:

AIC5 priority value is updated twice -
in aic_common_set_priority() and when updating AT91_AIC5_SMR. Variable, 'smr' has updated priority value (intspec[2]) in the first step, so no need to update it again in the second step.

Quoted 8 lines
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Boris Brezillon <[email protected]>
Cc Ludovic Desroches <[email protected]>
Cc Nicholas Ferre <[email protected]>

Thanks,

Boris

Quoted 17 lines
---
 drivers/irqchip/irq-atmel-aic5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-atmel-aic5.c +1 -1
index f36f426..4f0d068 100644
@@ -273,7 +273,7 @@ static int aic5_irq_domain_xlate(struct irq_domain *d,
 	irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
 	aic_common_set_priority(intspec[2], &smr);
-	irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
+	irq_reg_writel(bgc, smr, AT91_AIC5_SMR);
 	irq_gc_unlock(bgc);
 
 	return ret;
Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

[tip:irq/urgent] irqchip/atmel-aic: Fix wrong bit operation for IRQ priority

In reply to Milo Kim
irqchip/atmel-aic: Fix wrong bit operation for IRQ priority
Commit-ID:  49f34134aea74f19ca016f055d25ee55ec359dee
Gitweb:     http://git.kernel.org/tip/49f34134aea74f19ca016f055d25ee55ec359dee
Author:     Milo Kim <[email protected]>
AuthorDate: Wed, 13 Jan 2016 16:19:50 +0900
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 27 Jan 2016 12:54:33 +0100

irqchip/atmel-aic: Fix wrong bit operation for IRQ priority

Atmel AIC has common structure for SMR (Source Mode Register).

bit[6:5] Interrupt source type
bit[2:0] Priority level
Other bits are unused.

To update new priority value, bit[2:0] should be cleared first and then new priority level can be written. However, aic_common_set_priority() helper clears source type bits instead of priority bits. This patch fixes wrong mask bit operation.

Fixes b1479ebb7720 "irqchip: atmel-aic: Add atmel AIC/AIC5 drivers"
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Ludovic Desroches <[email protected]>
Cc Nicholas Ferre <[email protected]>
---
 drivers/irqchip/irq-atmel-aic-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-atmel-aic-common.c +1 -1
index b12a5d5..37199b9 100644
@@ -86,7 +86,7 @@ int aic_common_set_priority(int priority, unsigned *val)
 	    priority > AT91_AIC_IRQ_MAX_PRIORITY)
 		return -EINVAL;
 
-	*val &= AT91_AIC_PRIOR;
+	*val &= ~AT91_AIC_PRIOR;
 	*val |= priority;
 
 	return 0;
#11 lore raw

[tip:irq/core] irqchip/atmel-aic: Handle aic_common_irq_fixup in aic_common_of_init

In reply to Milo Kim
irqchip/atmel-aic: Handle aic_common_irq_fixup in aic_common_of_init
Commit-ID:  665075d0c77d5eec1badc55cb4b97b8497ef954b
Gitweb:     http://git.kernel.org/tip/665075d0c77d5eec1badc55cb4b97b8497ef954b
Author:     Milo Kim <[email protected]>
AuthorDate: Wed, 13 Jan 2016 16:19:49 +0900
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 8 Feb 2016 11:45:21 +0100

irqchip/atmel-aic: Handle aic_common_irq_fixup in aic_common_of_init

AIC IRQ fixup is handled in each IRQ chip driver.
It can be moved into aic_common_of_init() before returning the result. Then, aic_common_irq_fixup() can be changed to static type.

---
 drivers/irqchip/irq-atmel-aic-common.c | 6 ++++--
 drivers/irqchip/irq-atmel-aic-common.h | 5 ++---
 drivers/irqchip/irq-atmel-aic.c        | 4 +---
 drivers/irqchip/irq-atmel-aic5.c       | 4 +---
 4 files changed, 8 insertions(+), 11 deletions(-)
drivers/irqchip/irq-atmel-aic-common.c +4 -2
index 37199b9..661840b 100644
@@ -193,7 +193,7 @@ void __init aic_common_rtt_irq_fixup(struct device_node *root)
 	}
 }
 
-void __init aic_common_irq_fixup(const struct of_device_id *matches)
+static void __init aic_common_irq_fixup(const struct of_device_id *matches)
 {
 	struct device_node *root = of_find_node_by_path("/");
 	const struct of_device_id *match;
@@ -214,7 +214,8 @@ void __init aic_common_irq_fixup(const struct of_device_id *matches)
 
 struct irq_domain *__init aic_common_of_init(struct device_node *node,
 					     const struct irq_domain_ops *ops,
-					     const char *name, int nirqs)
+					     const char *name, int nirqs,
+					     const struct of_device_id *matches)
 {
 	struct irq_chip_generic *gc;
 	struct irq_domain *domain;
@@ -264,6 +265,7 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node,
 	}
 
 	aic_common_ext_irq_of_init(domain);
+	aic_common_irq_fixup(matches);
 
 	return domain;
 
drivers/irqchip/irq-atmel-aic-common.h +2 -3
index 603f0a9..046bcc8 100644
@@ -30,12 +30,11 @@ int aic_common_irq_domain_xlate(struct irq_domain *d,
 
 struct irq_domain *__init aic_common_of_init(struct device_node *node,
 					     const struct irq_domain_ops *ops,
-					     const char *name, int nirqs);
+					     const char *name, int nirqs,
+					     const struct of_device_id *matches);
 
 void __init aic_common_rtc_irq_fixup(struct device_node *root);
 
 void __init aic_common_rtt_irq_fixup(struct device_node *root);
 
-void __init aic_common_irq_fixup(const struct of_device_id *matches);
-
 #endif /* __IRQ_ATMEL_AIC_COMMON_H */
drivers/irqchip/irq-atmel-aic.c +1 -3
index 8a0c7f2..799834d 100644
@@ -248,12 +248,10 @@ static int __init aic_of_init(struct device_node *node,
 		return -EEXIST;
 
 	domain = aic_common_of_init(node, &aic_irq_ops, "atmel-aic",
-				    NR_AIC_IRQS);
+				    NR_AIC_IRQS, aic_irq_fixups);
 	if (IS_ERR(domain))
 		return PTR_ERR(domain);
 
-	aic_common_irq_fixup(aic_irq_fixups);
-
 	aic_domain = domain;
 	gc = irq_get_domain_generic_chip(domain, 0);
 
drivers/irqchip/irq-atmel-aic5.c +1 -3
index 62bb840..a7e8fc8 100644
@@ -312,12 +312,10 @@ static int __init aic5_of_init(struct device_node *node,
 		return -EEXIST;
 
 	domain = aic_common_of_init(node, &aic5_irq_ops, "atmel-aic5",
-				    nirqs);
+				    nirqs, aic5_irq_fixups);
 	if (IS_ERR(domain))
 		return PTR_ERR(domain);
 
-	aic_common_irq_fixup(aic5_irq_fixups);
-
 	aic5_domain = domain;
 	nchips = aic5_domain->revmap_size / 32;
 	for (i = 0; i < nchips; i++) {
#5 lore raw

[tip:irq/core] irqchip/atmel-aic: Change return type of aic_common_set_priority()

In reply to Milo Kim
irqchip/atmel-aic: Change return type of aic_common_set_priority()
Commit-ID:  e0c42e6fd595c4475687381e29bde8e632e880db
Gitweb:     http://git.kernel.org/tip/e0c42e6fd595c4475687381e29bde8e632e880db
Author:     Milo Kim <[email protected]>
AuthorDate: Wed, 13 Jan 2016 16:19:51 +0900
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 8 Feb 2016 11:45:21 +0100

irqchip/atmel-aic: Change return type of aic_common_set_priority()

Priority validation is not necessary because aic_common_irq_domain_xlate() already handles it. With this removal, return type can be changed to void.

---
 drivers/irqchip/irq-atmel-aic-common.c | 8 +-------
 drivers/irqchip/irq-atmel-aic-common.h | 2 +-
 drivers/irqchip/irq-atmel-aic.c        | 5 ++---
 drivers/irqchip/irq-atmel-aic5.c       | 5 ++---
 4 files changed, 6 insertions(+), 14 deletions(-)
drivers/irqchip/irq-atmel-aic-common.c +1 -7
index 661840b..28b26c8 100644
@@ -80,16 +80,10 @@ int aic_common_set_type(struct irq_data *d, unsigned type, unsigned *val)
 	return 0;
 }
 
-int aic_common_set_priority(int priority, unsigned *val)
+void aic_common_set_priority(int priority, unsigned *val)
 {
-	if (priority < AT91_AIC_IRQ_MIN_PRIORITY ||
-	    priority > AT91_AIC_IRQ_MAX_PRIORITY)
-		return -EINVAL;
-
 	*val &= ~AT91_AIC_PRIOR;
 	*val |= priority;
-
-	return 0;
 }
 
 int aic_common_irq_domain_xlate(struct irq_domain *d,
drivers/irqchip/irq-atmel-aic-common.h +1 -1
index 046bcc8..af60376 100644
@@ -19,7 +19,7 @@
 
 int aic_common_set_type(struct irq_data *d, unsigned type, unsigned *val);
 
-int aic_common_set_priority(int priority, unsigned *val);
+void aic_common_set_priority(int priority, unsigned *val);
 
 int aic_common_irq_domain_xlate(struct irq_domain *d,
 				struct device_node *ctrlr,
drivers/irqchip/irq-atmel-aic.c +2 -3
index 799834d..112e17c 100644
@@ -196,9 +196,8 @@ static int aic_irq_domain_xlate(struct irq_domain *d,
 
 	irq_gc_lock(gc);
 	smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq));
-	ret = aic_common_set_priority(intspec[2], &smr);
-	if (!ret)
-		irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
+	aic_common_set_priority(intspec[2], &smr);
+	irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
 	irq_gc_unlock(gc);
 
 	return ret;
drivers/irqchip/irq-atmel-aic5.c +2 -3
index a7e8fc8..f36f426 100644
@@ -272,9 +272,8 @@ static int aic5_irq_domain_xlate(struct irq_domain *d,
 	irq_gc_lock(bgc);
 	irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
-	ret = aic_common_set_priority(intspec[2], &smr);
-	if (!ret)
-		irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
+	aic_common_set_priority(intspec[2], &smr);
+	irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
 	irq_gc_unlock(bgc);
 
 	return ret;
#9 lore raw

[tip:irq/core] irqchip/atmel-aic: Remove duplicate bit operation

In reply to Milo Kim
irqchip/atmel-aic: Remove duplicate bit operation
Commit-ID:  8c7baa8c3d57004ed3e850fb7a106acf38810e3c
Gitweb:     http://git.kernel.org/tip/8c7baa8c3d57004ed3e850fb7a106acf38810e3c
Author:     Milo Kim <[email protected]>
AuthorDate: Wed, 13 Jan 2016 16:19:52 +0900
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 8 Feb 2016 11:45:21 +0100

irqchip/atmel-aic: Remove duplicate bit operation

AIC5 priority value is updated twice -
in aic_common_set_priority() and when updating AT91_AIC5_SMR. Variable, 'smr' has updated priority value (intspec[2]) in the first step, so no need to update it again in the second step.

---
 drivers/irqchip/irq-atmel-aic5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-atmel-aic5.c +1 -1
index f36f426..4f0d068 100644
@@ -273,7 +273,7 @@ static int aic5_irq_domain_xlate(struct irq_domain *d,
 	irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
 	aic_common_set_priority(intspec[2], &smr);
-	irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
+	irq_reg_writel(bgc, smr, AT91_AIC5_SMR);
 	irq_gc_unlock(bgc);
 
 	return ret;
#12 lore raw

[tip:irq/core] irqchip/atmel-aic: Handle aic_common_irq_fixup in aic_common_of_init

In reply to Milo Kim
irqchip/atmel-aic: Handle aic_common_irq_fixup in aic_common_of_init
Commit-ID:  dd85c79150079339b3ded62dda5f6985d192900a
Gitweb:     http://git.kernel.org/tip/dd85c79150079339b3ded62dda5f6985d192900a
Author:     Milo Kim <[email protected]>
AuthorDate: Wed, 13 Jan 2016 16:19:49 +0900
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 8 Feb 2016 15:03:42 +0100

irqchip/atmel-aic: Handle aic_common_irq_fixup in aic_common_of_init

AIC IRQ fixup is handled in each IRQ chip driver.
It can be moved into aic_common_of_init() before returning the result. Then, aic_common_irq_fixup() can be changed to static type.

---
 drivers/irqchip/irq-atmel-aic-common.c | 6 ++++--
 drivers/irqchip/irq-atmel-aic-common.h | 5 ++---
 drivers/irqchip/irq-atmel-aic.c        | 4 +---
 drivers/irqchip/irq-atmel-aic5.c       | 4 +---
 4 files changed, 8 insertions(+), 11 deletions(-)
drivers/irqchip/irq-atmel-aic-common.c +4 -2
index 37199b9..661840b 100644
@@ -193,7 +193,7 @@ void __init aic_common_rtt_irq_fixup(struct device_node *root)
 	}
 }
 
-void __init aic_common_irq_fixup(const struct of_device_id *matches)
+static void __init aic_common_irq_fixup(const struct of_device_id *matches)
 {
 	struct device_node *root = of_find_node_by_path("/");
 	const struct of_device_id *match;
@@ -214,7 +214,8 @@ void __init aic_common_irq_fixup(const struct of_device_id *matches)
 
 struct irq_domain *__init aic_common_of_init(struct device_node *node,
 					     const struct irq_domain_ops *ops,
-					     const char *name, int nirqs)
+					     const char *name, int nirqs,
+					     const struct of_device_id *matches)
 {
 	struct irq_chip_generic *gc;
 	struct irq_domain *domain;
@@ -264,6 +265,7 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node,
 	}
 
 	aic_common_ext_irq_of_init(domain);
+	aic_common_irq_fixup(matches);
 
 	return domain;
 
drivers/irqchip/irq-atmel-aic-common.h +2 -3
index 603f0a9..046bcc8 100644
@@ -30,12 +30,11 @@ int aic_common_irq_domain_xlate(struct irq_domain *d,
 
 struct irq_domain *__init aic_common_of_init(struct device_node *node,
 					     const struct irq_domain_ops *ops,
-					     const char *name, int nirqs);
+					     const char *name, int nirqs,
+					     const struct of_device_id *matches);
 
 void __init aic_common_rtc_irq_fixup(struct device_node *root);
 
 void __init aic_common_rtt_irq_fixup(struct device_node *root);
 
-void __init aic_common_irq_fixup(const struct of_device_id *matches);
-
 #endif /* __IRQ_ATMEL_AIC_COMMON_H */
drivers/irqchip/irq-atmel-aic.c +1 -3
index 8a0c7f2..799834d 100644
@@ -248,12 +248,10 @@ static int __init aic_of_init(struct device_node *node,
 		return -EEXIST;
 
 	domain = aic_common_of_init(node, &aic_irq_ops, "atmel-aic",
-				    NR_AIC_IRQS);
+				    NR_AIC_IRQS, aic_irq_fixups);
 	if (IS_ERR(domain))
 		return PTR_ERR(domain);
 
-	aic_common_irq_fixup(aic_irq_fixups);
-
 	aic_domain = domain;
 	gc = irq_get_domain_generic_chip(domain, 0);
 
drivers/irqchip/irq-atmel-aic5.c +1 -3
index 62bb840..a7e8fc8 100644
@@ -312,12 +312,10 @@ static int __init aic5_of_init(struct device_node *node,
 		return -EEXIST;
 
 	domain = aic_common_of_init(node, &aic5_irq_ops, "atmel-aic5",
-				    nirqs);
+				    nirqs, aic5_irq_fixups);
 	if (IS_ERR(domain))
 		return PTR_ERR(domain);
 
-	aic_common_irq_fixup(aic5_irq_fixups);
-
 	aic5_domain = domain;
 	nchips = aic5_domain->revmap_size / 32;
 	for (i = 0; i < nchips; i++) {
#6 lore raw

[tip:irq/core] irqchip/atmel-aic: Change return type of aic_common_set_priority()

In reply to Milo Kim
irqchip/atmel-aic: Change return type of aic_common_set_priority()
Commit-ID:  5fd26a0bb1e479014adf024df779172d33defdd5
Gitweb:     http://git.kernel.org/tip/5fd26a0bb1e479014adf024df779172d33defdd5
Author:     Milo Kim <[email protected]>
AuthorDate: Wed, 13 Jan 2016 16:19:51 +0900
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 8 Feb 2016 15:03:42 +0100

irqchip/atmel-aic: Change return type of aic_common_set_priority()

Priority validation is not necessary because aic_common_irq_domain_xlate() already handles it. With this removal, return type can be changed to void.

---
 drivers/irqchip/irq-atmel-aic-common.c | 8 +-------
 drivers/irqchip/irq-atmel-aic-common.h | 2 +-
 drivers/irqchip/irq-atmel-aic.c        | 5 ++---
 drivers/irqchip/irq-atmel-aic5.c       | 5 ++---
 4 files changed, 6 insertions(+), 14 deletions(-)
drivers/irqchip/irq-atmel-aic-common.c +1 -7
index 661840b..28b26c8 100644
@@ -80,16 +80,10 @@ int aic_common_set_type(struct irq_data *d, unsigned type, unsigned *val)
 	return 0;
 }
 
-int aic_common_set_priority(int priority, unsigned *val)
+void aic_common_set_priority(int priority, unsigned *val)
 {
-	if (priority < AT91_AIC_IRQ_MIN_PRIORITY ||
-	    priority > AT91_AIC_IRQ_MAX_PRIORITY)
-		return -EINVAL;
-
 	*val &= ~AT91_AIC_PRIOR;
 	*val |= priority;
-
-	return 0;
 }
 
 int aic_common_irq_domain_xlate(struct irq_domain *d,
drivers/irqchip/irq-atmel-aic-common.h +1 -1
index 046bcc8..af60376 100644
@@ -19,7 +19,7 @@
 
 int aic_common_set_type(struct irq_data *d, unsigned type, unsigned *val);
 
-int aic_common_set_priority(int priority, unsigned *val);
+void aic_common_set_priority(int priority, unsigned *val);
 
 int aic_common_irq_domain_xlate(struct irq_domain *d,
 				struct device_node *ctrlr,
drivers/irqchip/irq-atmel-aic.c +2 -3
index 799834d..112e17c 100644
@@ -196,9 +196,8 @@ static int aic_irq_domain_xlate(struct irq_domain *d,
 
 	irq_gc_lock(gc);
 	smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq));
-	ret = aic_common_set_priority(intspec[2], &smr);
-	if (!ret)
-		irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
+	aic_common_set_priority(intspec[2], &smr);
+	irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
 	irq_gc_unlock(gc);
 
 	return ret;
drivers/irqchip/irq-atmel-aic5.c +2 -3
index a7e8fc8..f36f426 100644
@@ -272,9 +272,8 @@ static int aic5_irq_domain_xlate(struct irq_domain *d,
 	irq_gc_lock(bgc);
 	irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
-	ret = aic_common_set_priority(intspec[2], &smr);
-	if (!ret)
-		irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
+	aic_common_set_priority(intspec[2], &smr);
+	irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
 	irq_gc_unlock(bgc);
 
 	return ret;
#10 lore raw

[tip:irq/core] irqchip/atmel-aic: Remove duplicate bit operation

In reply to Milo Kim
irqchip/atmel-aic: Remove duplicate bit operation
Commit-ID:  4b5ce20b5429eb08ae0776962a4aff7f00017800
Gitweb:     http://git.kernel.org/tip/4b5ce20b5429eb08ae0776962a4aff7f00017800
Author:     Milo Kim <[email protected]>
AuthorDate: Wed, 13 Jan 2016 16:19:52 +0900
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 8 Feb 2016 15:03:42 +0100

irqchip/atmel-aic: Remove duplicate bit operation

AIC5 priority value is updated twice -
in aic_common_set_priority() and when updating AT91_AIC5_SMR. Variable, 'smr' has updated priority value (intspec[2]) in the first step, so no need to update it again in the second step.

---
 drivers/irqchip/irq-atmel-aic5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-atmel-aic5.c +1 -1
index f36f426..4f0d068 100644
@@ -273,7 +273,7 @@ static int aic5_irq_domain_xlate(struct irq_domain *d,
 	irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
 	aic_common_set_priority(intspec[2], &smr);
-	irq_reg_writel(bgc, intspec[2] | smr, AT91_AIC5_SMR);
+	irq_reg_writel(bgc, smr, AT91_AIC5_SMR);
 	irq_gc_unlock(bgc);
 
 	return ret;