All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] ARM: VIC: use the domain mapping function to assign handlers
@ 2012-04-18 15:30 Linus Walleij
  2012-04-19 15:46 ` Jamie Iles
  2012-04-27 19:00 ` Grant Likely
  0 siblings, 2 replies; 5+ messages in thread
From: Linus Walleij @ 2012-04-18 15:30 UTC (permalink / raw)
  To: linux-arm-kernel

From: Linus Walleij <linus.walleij@linaro.org>

This removes the internal functions for assigning IRQ
handlers to each interrupt in favor of using the internal
map iterator in the irq domain code.

Cc: Jamie Iles <jamie@jamieiles.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/common/vic.c |   44 ++++++++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index c558a3e..e0d5388 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -39,6 +39,7 @@
  * struct vic_device - VIC PM device
  * @irq: The IRQ number for the base of the VIC.
  * @base: The register base for the VIC.
+ * @valid_sources: A bitmask of valid interrupts
  * @resume_sources: A bitmask of interrupts for resume.
  * @resume_irqs: The IRQs enabled for resume.
  * @int_select: Save for VIC_INT_SELECT.
@@ -50,6 +51,7 @@
 struct vic_device {
 	void __iomem	*base;
 	int		irq;
+	u32		valid_sources;
 	u32		resume_sources;
 	u32		resume_irqs;
 	u32		int_select;
@@ -164,6 +166,27 @@ static int __init vic_pm_init(void)
 late_initcall(vic_pm_init);
 #endif /* CONFIG_PM */
 
+static struct irq_chip vic_chip;
+
+static int vic_irqdomain_map(struct irq_domain *d, unsigned int irq,
+			     irq_hw_number_t hwirq)
+{
+	struct vic_device *v = d->host_data;
+
+	/* Skip invalid IRQs, only register handlers for the real ones */
+	if (!(v->valid_sources & (1 << hwirq)))
+		return -ENOTSUPP;
+	irq_set_chip_and_handler(irq, &vic_chip, handle_level_irq);
+	irq_set_chip_data(irq, v->base);
+	set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+	return 0;
+}
+
+static struct irq_domain_ops vic_irqdomain_ops = {
+	.map = vic_irqdomain_map,
+	.xlate = irq_domain_xlate_onetwocell,
+};
+
 /**
  * vic_register() - Register a VIC.
  * @base: The base address of the VIC.
@@ -191,6 +214,7 @@ static void __init vic_register(void __iomem *base, unsigned int irq,
 
 	v = &vic_devices[vic_id];
 	v->base = base;
+	v->valid_sources = valid_sources;
 	v->resume_sources = resume_sources;
 	v->irq = irq;
 	vic_id++;
@@ -289,23 +313,6 @@ static void __init vic_clear_interrupts(void __iomem *base)
 	}
 }
 
-static void __init vic_set_irq_sources(void __iomem *base,
-				unsigned int irq_start, u32 vic_sources)
-{
-	unsigned int i;
-
-	for (i = 0; i < 32; i++) {
-		if (vic_sources & (1 << i)) {
-			unsigned int irq = irq_start + i;
-
-			irq_set_chip_and_handler(irq, &vic_chip,
-						 handle_level_irq);
-			irq_set_chip_data(irq, base);
-			set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
-		}
-	}
-}
-
 /*
  * The PL190 cell from ARM has been modified by ST to handle 64 interrupts.
  * The original cell has 32 interrupts, while the modified one has 64,
@@ -340,7 +347,6 @@ static void __init vic_init_st(void __iomem *base, unsigned int irq_start,
 		writel(32, base + VIC_PL190_DEF_VECT_ADDR);
 	}
 
-	vic_set_irq_sources(base, irq_start, vic_sources);
 	vic_register(base, irq_start, vic_sources, 0, node);
 }
 
@@ -381,8 +387,6 @@ void __init __vic_init(void __iomem *base, unsigned int irq_start,
 
 	vic_init2(base);
 
-	vic_set_irq_sources(base, irq_start, vic_sources);
-
 	vic_register(base, irq_start, vic_sources, resume_sources, node);
 }
 
-- 
1.7.9.2

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

* [PATCH 2/2] ARM: VIC: use the domain mapping function to assign handlers
  2012-04-18 15:30 [PATCH 2/2] ARM: VIC: use the domain mapping function to assign handlers Linus Walleij
@ 2012-04-19 15:46 ` Jamie Iles
  2012-04-27 19:00 ` Grant Likely
  1 sibling, 0 replies; 5+ messages in thread
From: Jamie Iles @ 2012-04-19 15:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 18, 2012 at 05:30:54PM +0200, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> This removes the internal functions for assigning IRQ
> handlers to each interrupt in favor of using the internal
> map iterator in the irq domain code.
> 
> Cc: Jamie Iles <jamie@jamieiles.com>

I don't have a test platform up and running right now that I can give 
this a go on, but it looks good so,

Reviewed-by: Jamie Iles <jamie@jamieiles.com>

Jamie

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

* [PATCH 2/2] ARM: VIC: use the domain mapping function to assign handlers
  2012-04-18 15:30 [PATCH 2/2] ARM: VIC: use the domain mapping function to assign handlers Linus Walleij
  2012-04-19 15:46 ` Jamie Iles
@ 2012-04-27 19:00 ` Grant Likely
  2012-04-27 20:29   ` Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: Grant Likely @ 2012-04-27 19:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 18 Apr 2012 17:30:54 +0200, Linus Walleij <linus.walleij@stericsson.com> wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> This removes the internal functions for assigning IRQ
> handlers to each interrupt in favor of using the internal
> map iterator in the irq domain code.
> 
> Cc: Jamie Iles <jamie@jamieiles.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Russell King <rmk+kernel@arm.linux.org.uk>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  arch/arm/common/vic.c |   44 ++++++++++++++++++++++++--------------------
>  1 file changed, 24 insertions(+), 20 deletions(-)
> 
> diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
> index c558a3e..e0d5388 100644
> --- a/arch/arm/common/vic.c
> +++ b/arch/arm/common/vic.c
> @@ -39,6 +39,7 @@
>   * struct vic_device - VIC PM device
>   * @irq: The IRQ number for the base of the VIC.
>   * @base: The register base for the VIC.
> + * @valid_sources: A bitmask of valid interrupts
>   * @resume_sources: A bitmask of interrupts for resume.
>   * @resume_irqs: The IRQs enabled for resume.
>   * @int_select: Save for VIC_INT_SELECT.
> @@ -50,6 +51,7 @@
>  struct vic_device {
>  	void __iomem	*base;
>  	int		irq;
> +	u32		valid_sources;
>  	u32		resume_sources;
>  	u32		resume_irqs;
>  	u32		int_select;
> @@ -164,6 +166,27 @@ static int __init vic_pm_init(void)
>  late_initcall(vic_pm_init);
>  #endif /* CONFIG_PM */
>  
> +static struct irq_chip vic_chip;
> +
> +static int vic_irqdomain_map(struct irq_domain *d, unsigned int irq,
> +			     irq_hw_number_t hwirq)
> +{
> +	struct vic_device *v = d->host_data;
> +
> +	/* Skip invalid IRQs, only register handlers for the real ones */
> +	if (!(v->valid_sources & (1 << hwirq)))
> +		return -ENOTSUPP;
> +	irq_set_chip_and_handler(irq, &vic_chip, handle_level_irq);
> +	irq_set_chip_data(irq, v->base);
> +	set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> +	return 0;
> +}
> +
> +static struct irq_domain_ops vic_irqdomain_ops = {
> +	.map = vic_irqdomain_map,
> +	.xlate = irq_domain_xlate_onetwocell,
> +};

It looks like this patch also needs to update the
irq_domain_add_legacy() call to use this ops structure instead of
irq_domain_simple_ops.

g.

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

* [PATCH 2/2] ARM: VIC: use the domain mapping function to assign handlers
  2012-04-27 19:00 ` Grant Likely
@ 2012-04-27 20:29   ` Linus Walleij
  2012-04-27 20:46     ` Grant Likely
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2012-04-27 20:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 27, 2012 at 9:00 PM, Grant Likely <grant.likely@secretlab.ca> wrote:

>> +static struct irq_domain_ops vic_irqdomain_ops = {
>> + ? ? .map = vic_irqdomain_map,
>> + ? ? .xlate = irq_domain_xlate_onetwocell,
>> +};
>
> It looks like this patch also needs to update the
> irq_domain_add_legacy() call to use this ops structure instead of
> irq_domain_simple_ops.

I goofed up when I split the patch, that change is in 1/2, which is thus
not bisectable :-/

But the end result is working and looking as it should.

Do you want me to re-split, or can we live with this?

Yours,
Linus Walleij

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

* [PATCH 2/2] ARM: VIC: use the domain mapping function to assign handlers
  2012-04-27 20:29   ` Linus Walleij
@ 2012-04-27 20:46     ` Grant Likely
  0 siblings, 0 replies; 5+ messages in thread
From: Grant Likely @ 2012-04-27 20:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 27, 2012 at 2:29 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Fri, Apr 27, 2012 at 9:00 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
>
>>> +static struct irq_domain_ops vic_irqdomain_ops = {
>>> + ? ? .map = vic_irqdomain_map,
>>> + ? ? .xlate = irq_domain_xlate_onetwocell,
>>> +};
>>
>> It looks like this patch also needs to update the
>> irq_domain_add_legacy() call to use this ops structure instead of
>> irq_domain_simple_ops.
>
> I goofed up when I split the patch, that change is in 1/2, which is thus
> not bisectable :-/
>
> But the end result is working and looking as it should.
>
> Do you want me to re-split, or can we live with this?

No need to be sloppy.  Re-split please.

g.

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

end of thread, other threads:[~2012-04-27 20:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-18 15:30 [PATCH 2/2] ARM: VIC: use the domain mapping function to assign handlers Linus Walleij
2012-04-19 15:46 ` Jamie Iles
2012-04-27 19:00 ` Grant Likely
2012-04-27 20:29   ` Linus Walleij
2012-04-27 20:46     ` Grant Likely

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.