[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0953ffd2-dddc-2706-66ab-d6913eff19df@csgroup.eu>
Date: Mon, 13 Feb 2023 20:06:27 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Pali Rohár <pali@...nel.org>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Scott Wood <oss@...error.net>, Sinan Akman <sinan@...teme.com>,
Martin Kennedy <hurricos@...il.com>
CC: "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 4/8] powerpc/85xx: p2020: Move i8259 code into own
function
Le 24/12/2022 à 22:14, Pali Rohár a écrit :
> Splits mpic and i8259 initialization codes into separate functions.
>
> Signed-off-by: Pali Rohár <pali@...nel.org>
> ---
> arch/powerpc/platforms/85xx/p2020.c | 37 ++++++++++++++++-------------
> 1 file changed, 21 insertions(+), 16 deletions(-)
>
> diff --git a/arch/powerpc/platforms/85xx/p2020.c b/arch/powerpc/platforms/85xx/p2020.c
> index d65d4c88ac47..b8584bf307b0 100644
> --- a/arch/powerpc/platforms/85xx/p2020.c
> +++ b/arch/powerpc/platforms/85xx/p2020.c
> @@ -45,6 +45,7 @@
> #ifdef CONFIG_MPC85xx_DS
>
> #ifdef CONFIG_PPC_I8259
> +
> static void mpc85xx_8259_cascade(struct irq_desc *desc)
> {
> struct irq_chip *chip = irq_desc_get_chip(desc);
> @@ -55,27 +56,13 @@ static void mpc85xx_8259_cascade(struct irq_desc *desc)
> }
> chip->irq_eoi(&desc->irq_data);
> }
> -#endif /* CONFIG_PPC_I8259 */
>
> -static void __init mpc85xx_ds_pic_init(void)
> +static void __init mpc85xx_8259_init(void)
> {
> - struct mpic *mpic;
> -#ifdef CONFIG_PPC_I8259
> struct device_node *np;
> struct device_node *cascade_node = NULL;
> int cascade_irq;
> -#endif
> -
> - mpic = mpic_alloc(NULL, 0,
> - MPIC_BIG_ENDIAN |
> - MPIC_SINGLE_DEST_CPU,
> - 0, 256, " OpenPIC ");
> -
> - BUG_ON(mpic == NULL);
> - mpic_init(mpic);
>
> -#ifdef CONFIG_PPC_I8259
> - /* Initialize the i8259 controller */
> for_each_node_by_type(np, "interrupt-controller")
> if (of_device_is_compatible(np, "chrp,iic")) {
> cascade_node = np;
> @@ -93,13 +80,31 @@ static void __init mpc85xx_ds_pic_init(void)
> return;
> }
>
> - DBG("mpc85xxds: cascade mapped to irq %d\n", cascade_irq);
> + DBG("i8259: cascade mapped to irq %d\n", cascade_irq);
>
> i8259_init(cascade_node, 0);
> of_node_put(cascade_node);
>
> irq_set_chained_handler(cascade_irq, mpc85xx_8259_cascade);
> +}
> +
> #endif /* CONFIG_PPC_I8259 */
> +
> +static void __init mpc85xx_ds_pic_init(void)
> +{
> + struct mpic *mpic;
> +
> + mpic = mpic_alloc(NULL, 0,
> + MPIC_BIG_ENDIAN |
> + MPIC_SINGLE_DEST_CPU,
> + 0, 256, " OpenPIC ");
> +
> + BUG_ON(mpic == NULL);
> + mpic_init(mpic);
> +
> +#ifdef CONFIG_PPC_I8259
Ca we minimise number of #ifdef CONFIG_PPC_I8259 by using
IS_ENABLED(CONFIG_PPC_I8259) inside if/else ?
> + mpc85xx_8259_init();
> +#endif
> }
>
> #ifdef CONFIG_PCI
Powered by blists - more mailing lists