Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1594216
| From | Hanjun Guo <guohanjun@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v9 14/15] irqchip: mbigen: introduce mbigen_of_create_domain() |
| Date | 2017-03-07 14:00 +0100 |
| Message-ID | <timSD-7EZ-35@gated-at.bofh.it> (permalink) |
| References | <timIV-7Bl-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Kefeng Wang <wangkefeng.wang@huawei.com>
Introduce mbigen_of_create_domain() to consolidate OF related
code and prepare for ACPI later, no funtional change.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Ma Jun <majun258@huawei.com>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
drivers/irqchip/irq-mbigen.c | 43 ++++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index c01ab41..3756408 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -236,27 +236,15 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain,
.free = irq_domain_free_irqs_common,
};
-static int mbigen_device_probe(struct platform_device *pdev)
+static int mbigen_of_create_domain(struct platform_device *pdev,
+ struct mbigen_device *mgn_chip)
{
- struct mbigen_device *mgn_chip;
+ struct device *parent;
struct platform_device *child;
struct irq_domain *domain;
struct device_node *np;
- struct device *parent;
- struct resource *res;
u32 num_pins;
- mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL);
- if (!mgn_chip)
- return -ENOMEM;
-
- mgn_chip->pdev = pdev;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- mgn_chip->base = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(mgn_chip->base))
- return PTR_ERR(mgn_chip->base);
-
for_each_child_of_node(pdev->dev.of_node, np) {
if (!of_property_read_bool(np, "interrupt-controller"))
continue;
@@ -280,6 +268,31 @@ static int mbigen_device_probe(struct platform_device *pdev)
return -ENOMEM;
}
+ return 0;
+}
+
+static int mbigen_device_probe(struct platform_device *pdev)
+{
+ struct mbigen_device *mgn_chip;
+ struct resource *res;
+ int err;
+
+ mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL);
+ if (!mgn_chip)
+ return -ENOMEM;
+
+ mgn_chip->pdev = pdev;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ mgn_chip->base = devm_ioremap(&pdev->dev, res->start,
+ resource_size(res));
+ if (IS_ERR(mgn_chip->base))
+ return PTR_ERR(mgn_chip->base);
+
+ err = mbigen_of_create_domain(pdev, mgn_chip);
+ if (err)
+ return err;
+
platform_set_drvdata(pdev, mgn_chip);
return 0;
}
--
1.7.12.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v9 00/15] ACPI platform MSI support and its example mbigen Hanjun Guo <guohanjun@huawei.com> - 2017-03-07 14:00 +0100
[PATCH v9 12/15] msi: platform: make platform_msi_create_device_domain() ACPI aware Hanjun Guo <guohanjun@huawei.com> - 2017-03-07 14:00 +0100
[PATCH v9 15/15] irqchip: mbigen: Add ACPI support Hanjun Guo <guohanjun@huawei.com> - 2017-03-07 14:00 +0100
[PATCH v9 08/15] ACPI/IORT: Rename iort_node_map_rid() to make it generic Hanjun Guo <guohanjun@huawei.com> - 2017-03-07 14:00 +0100
[PATCH v9 11/15] ACPI: platform: setup MSI domain for ACPI based platform device Hanjun Guo <guohanjun@huawei.com> - 2017-03-07 14:00 +0100
[PATCH v9 14/15] irqchip: mbigen: introduce mbigen_of_create_domain() Hanjun Guo <guohanjun@huawei.com> - 2017-03-07 14:00 +0100
[PATCH v9 09/15] ACPI/IORT: Introduce iort_node_map_platform_id() to retrieve dev id Hanjun Guo <guohanjun@huawei.com> - 2017-03-07 14:10 +0100
Re: [PATCH v9 00/15] ACPI platform MSI support and its example mbigen Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2017-03-07 15:50 +0100
Re: [PATCH v9 00/15] ACPI platform MSI support and its example mbigen Hanjun Guo <hanjun.guo@linaro.org> - 2017-03-09 14:30 +0100
csiph-web