[PATCH 03/14] at91: factorize at91 interrupts init to soc

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Apr 28 07:43:41 EDT 2011


On Mon, Apr 25, 2011 at 08:31:13PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> they are the same except the default priority

No one uses anything but the default priority.  So let's have a version
of this patch which simplifies this further:

> diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
> index 5b2a7bb..1fac2fe 100644
> --- a/arch/arm/mach-at91/board-usb-a9263.c
> +++ b/arch/arm/mach-at91/board-usb-a9263.c
> @@ -61,7 +61,7 @@ static void __init ek_map_io(void)
>  
>  static void __init ek_init_irq(void)
>  {
> -	at91sam9263_init_interrupts(NULL);
> +	at91_init_interrupts(NULL);
>  }

by replacing every instance of the above with a call in their machine
record to at91_init_irq_default(), and:

> +void __init at91_init_interrupts(unsigned int *priority)
> +{
> +	if (!priority)
> +		priority = current_soc.default_irq_priority;
> +
> +	/* Initialize the AIC interrupt controller */
> +	at91_aic_init(priority);
> +
> +	/* Enable GPIO interrupts */
> +	at91_gpio_irq_setup();
> +}

void __init at91_init_interrupts(unsigned int *priority)
{
	/* Initialize the AIC interrupt controller */
	at91_aic_init(priority);

	/* Enable GPIO interrupts */
	at91_gpio_irq_setup();
}

void __init at91_init_irq_default(void)
{
	at91_init_interrupts(current_soc.default_irq_priority);
}

If people wish to change from the default priority, they can provide
their own init_irq function, and call at91_init_interrupts with their
desired priority array.

> diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
> index 6c30d74..9aac491 100644
> --- a/arch/arm/mach-at91/soc.h
> +++ b/arch/arm/mach-at91/soc.h
> @@ -8,6 +8,7 @@
>  
>  struct at91_soc {
>  	char *name;

btw, this should be const (which should of course be a separate patch).



More information about the linux-arm-kernel mailing list