[PATCH 17/19] irqchip: atmel-aic: use unified IRQ chip initialization function

From: Milo Kim
Date: Sun Jan 03 2016 - 23:29:16 EST


Now, AIC and AIC5 have common IRQ chip initialization function.
All IRQ chips are declared in common part.
Return type is changed from irq_domain pointer to integer.
IRQ domain name is fixed as 'atmel-aic'.
Delete irq-atmel-aic-common.h because it is not used any more.

Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Jason Cooper <jason@xxxxxxxxxxxxxx>
Cc: Marc Zyngier <marc.zyngier@xxxxxxx>
Cc: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxxxxxxxxx>
Cc: Boris BREZILLON <boris.brezillon@xxxxxxxxxxxxxxxxxx>
Cc: Ludovic Desroches <ludovic.desroches@xxxxxxxxx>
Cc: Nicolas Ferre <nicolas.ferre@xxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Milo Kim <milo.kim@xxxxxx>
---
drivers/irqchip/irq-atmel-aic-common.c | 29 +++++++++++++++++------------
drivers/irqchip/irq-atmel-aic-common.h | 22 ----------------------
drivers/irqchip/irq-atmel-aic.c | 15 ---------------
drivers/irqchip/irq-atmel-aic5.c | 18 ------------------
4 files changed, 17 insertions(+), 67 deletions(-)
delete mode 100644 drivers/irqchip/irq-atmel-aic-common.h

diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c
index deec551..cd89d635 100644
--- a/drivers/irqchip/irq-atmel-aic-common.c
+++ b/drivers/irqchip/irq-atmel-aic-common.c
@@ -15,10 +15,14 @@
*/

#include <linux/errno.h>
+#include <linux/init.h>
#include <linux/io.h>
#include <linux/irq.h>
+#include <linux/irqchip.h>
#include <linux/irqdesc.h>
#include <linux/irqdomain.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/slab.h>
@@ -26,8 +30,6 @@
#include <asm/exception.h>
#include <asm/mach/irq.h>

-#include "irq-atmel-aic-common.h"
-
#define AIC_IRQS_PER_CHIP 32
#define NR_AT91RM9200_IRQS 32
#define NR_SAMA5D2_IRQS 77
@@ -519,8 +521,8 @@ static void __init aic_hw_init(struct irq_domain *domain)
}
}

-struct irq_domain *__init aic_common_of_init(struct device_node *node,
- const char *name)
+static int __init aic_of_init(struct device_node *node,
+ struct device_node *parent)
{
struct irq_chip_generic *gc;
struct irq_domain *domain;
@@ -531,15 +533,15 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node,
int i;

if (aic_domain)
- return ERR_PTR(-EEXIST);
+ return -EEXIST;

nchips = aic_get_num_chips(node);
if (nchips < 0)
- return ERR_PTR(-EINVAL);
+ return -EINVAL;

reg_base = of_iomap(node, 0);
if (!reg_base)
- return ERR_PTR(-ENOMEM);
+ return -ENOMEM;

aic = kcalloc(nchips, sizeof(*aic), GFP_KERNEL);
if (!aic) {
@@ -554,8 +556,8 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node,
goto err_free_aic;
}

- ret = irq_alloc_domain_generic_chips(domain, AIC_IRQS_PER_CHIP, 1, name,
- handle_fasteoi_irq,
+ ret = irq_alloc_domain_generic_chips(domain, AIC_IRQS_PER_CHIP, 1,
+ "atmel-aic", handle_fasteoi_irq,
IRQ_NOREQUEST | IRQ_NOPROBE |
IRQ_NOAUTOEN, 0, 0);
if (ret)
@@ -589,7 +591,7 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node,
aic_hw_init(domain);
set_handle_irq(aic_handle);

- return domain;
+ return 0;

err_domain_remove:
irq_domain_remove(domain);
@@ -599,6 +601,9 @@ err_free_aic:

err_iounmap:
iounmap(reg_base);
-
- return ERR_PTR(ret);
+ return ret;
}
+IRQCHIP_DECLARE(at91rm9200_aic, "atmel,at91rm9200-aic", aic_of_init);
+IRQCHIP_DECLARE(sama5d2_aic5, "atmel,sama5d2-aic", aic_of_init);
+IRQCHIP_DECLARE(sama5d3_aic5, "atmel,sama5d3-aic", aic_of_init);
+IRQCHIP_DECLARE(sama5d4_aic5, "atmel,sama5d4-aic", aic_of_init);
diff --git a/drivers/irqchip/irq-atmel-aic-common.h b/drivers/irqchip/irq-atmel-aic-common.h
deleted file mode 100644
index 4170133..0000000
--- a/drivers/irqchip/irq-atmel-aic-common.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Atmel AT91 common AIC (Advanced Interrupt Controller) header file
- *
- * Copyright (C) 2004 SAN People
- * Copyright (C) 2004 ATMEL
- * Copyright (C) Rick Bronson
- * Copyright (C) 2014 Free Electrons
- *
- * Author: Boris BREZILLON <boris.brezillon@xxxxxxxxxxxxxxxxxx>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#ifndef __IRQ_ATMEL_AIC_COMMON_H
-#define __IRQ_ATMEL_AIC_COMMON_H
-
-struct irq_domain *__init aic_common_of_init(struct device_node *node,
- const char *name);
-
-#endif /* __IRQ_ATMEL_AIC_COMMON_H */
diff --git a/drivers/irqchip/irq-atmel-aic.c b/drivers/irqchip/irq-atmel-aic.c
index 980197f..335a94e 100644
--- a/drivers/irqchip/irq-atmel-aic.c
+++ b/drivers/irqchip/irq-atmel-aic.c
@@ -31,8 +31,6 @@
#include <asm/exception.h>
#include <asm/mach/irq.h>

-#include "irq-atmel-aic-common.h"
-
/* Number of irq lines managed by AIC */
#define NR_AIC_IRQS 32

@@ -54,16 +52,3 @@
#define AT91_AIC_EOICR 0x130
#define AT91_AIC_SPU 0x134
#define AT91_AIC_DCR 0x138
-
-static int __init aic_of_init(struct device_node *node,
- struct device_node *parent)
-{
- struct irq_domain *domain;
-
- domain = aic_common_of_init(node, "atmel-aic");
- if (IS_ERR(domain))
- return PTR_ERR(domain);
-
- return 0;
-}
-IRQCHIP_DECLARE(at91rm9200_aic, "atmel,at91rm9200-aic", aic_of_init);
diff --git a/drivers/irqchip/irq-atmel-aic5.c b/drivers/irqchip/irq-atmel-aic5.c
index dcf4711..082fdde 100644
--- a/drivers/irqchip/irq-atmel-aic5.c
+++ b/drivers/irqchip/irq-atmel-aic5.c
@@ -31,8 +31,6 @@
#include <asm/exception.h>
#include <asm/mach/irq.h>

-#include "irq-atmel-aic-common.h"
-
/* Number of irq lines managed by AIC */
#define NR_AIC5_IRQS 128

@@ -64,19 +62,3 @@
#define AT91_AIC5_FFER 0x50
#define AT91_AIC5_FFDR 0x54
#define AT91_AIC5_FFSR 0x58
-
-static int __init aic5_of_init(struct device_node *node,
- struct device_node *parent)
-{
- struct irq_domain *domain;
-
- domain = aic_common_of_init(node, "atmel-aic5");
- if (IS_ERR(domain))
- return PTR_ERR(domain);
-
- return 0;
-}
-
-IRQCHIP_DECLARE(sama5d2_aic5, "atmel,sama5d2-aic", aic5_of_init);
-IRQCHIP_DECLARE(sama5d3_aic5, "atmel,sama5d3-aic", aic5_of_init);
-IRQCHIP_DECLARE(sama5d4_aic5, "atmel,sama5d4-aic", aic5_of_init);
--
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/