[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230218111405.27688-5-pali@kernel.org>
Date: Sat, 18 Feb 2023 12:14:01 +0100
From: Pali Rohár <pali@...nel.org>
To: Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Scott Wood <oss@...error.net>, Sinan Akman <sinan@...teme.com>,
Martin Kennedy <hurricos@...il.com>
Cc: linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: [PATCH v3 4/8] powerpc/85xx: p2020: Move i8259 code into own function
Splits mpic and i8259 initialization codes into separate functions.
Use 'if (IS_ENABLED(CONFIG_PPC_I8259))' instead of '#ifdef CONFIG_PPC_I8259'.
Signed-off-by: Pali Rohár <pali@...nel.org>
---
arch/powerpc/platforms/85xx/p2020.c | 36 ++++++++++++++---------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/platforms/85xx/p2020.c b/arch/powerpc/platforms/85xx/p2020.c
index d65d4c88ac47..1cc468dc4caf 100644
--- a/arch/powerpc/platforms/85xx/p2020.c
+++ b/arch/powerpc/platforms/85xx/p2020.c
@@ -44,7 +44,6 @@
#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 +54,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 +78,28 @@ 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);
+
+ if (IS_ENABLED(CONFIG_PPC_I8259))
+ mpc85xx_8259_init();
}
#ifdef CONFIG_PCI
--
2.20.1
Powered by blists - more mailing lists