[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230213201715.at64fowda2xgertt@pali>
Date: Mon, 13 Feb 2023 21:17:15 +0100
From: Pali Rohár <pali@...nel.org>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: 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>,
"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
On Monday 13 February 2023 20:06:27 Christophe Leroy wrote:
>
>
> 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
Ok, I can change code to:
+if (IS_ENABLED(CONFIG_PPC_I8259))
+ mpc85xx_8259_init();
I guess it should be equivalent.
> > }
> >
> > #ifdef CONFIG_PCI
Powered by blists - more mailing lists