From: majun258@huawei.com (MaJun)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition.
Date: Mon, 14 Mar 2016 14:45:07 +0800 [thread overview]
Message-ID: <1457937907-14008-3-git-send-email-majun258@huawei.com> (raw)
In-Reply-To: <1457937907-14008-1-git-send-email-majun258@huawei.com>
From: Ma Jun <majun258@huawei.com>
To fix the IO remap problem, change the mbigen driver based on the
new mbigen node definition.
Signed-off-by: Ma Jun <majun258@huawei.com>
---
drivers/irqchip/irq-mbigen.c | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index 4dd3eb8..4d413bc 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -242,6 +242,8 @@ static int mbigen_device_probe(struct platform_device *pdev)
struct resource *res;
struct irq_domain *domain;
u32 num_pins;
+ struct platform_device *child_pdev;
+ struct device_node *np;
mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL);
if (!mgn_chip)
@@ -251,25 +253,35 @@ static int mbigen_device_probe(struct platform_device *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);
- if (of_property_read_u32(pdev->dev.of_node, "num-pins", &num_pins) < 0) {
- dev_err(&pdev->dev, "No num-pins property\n");
- return -EINVAL;
- }
+ for_each_child_of_node(pdev->dev.of_node, np) {
+ if (!of_property_read_bool(np, "interrupt-controller"))
+ continue;
+
+ child_pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root);
+ if (IS_ERR(child_pdev))
+ return PTR_ERR(child_pdev);
+
+ if (of_property_read_u32(child_pdev->dev.of_node, "num-pins", &num_pins) < 0) {
+ dev_err(&pdev->dev, "No num-pins property\n");
+ return -EINVAL;
+ }
- domain = platform_msi_create_device_domain(&pdev->dev, num_pins,
+ domain = platform_msi_create_device_domain(&child_pdev->dev, num_pins,
mbigen_write_msg,
&mbigen_domain_ops,
mgn_chip);
- if (!domain)
- return -ENOMEM;
+ if (!domain)
+ return -ENOMEM;
- platform_set_drvdata(pdev, mgn_chip);
+ dev_info(&child_pdev->dev, "Allocated %d MSIs\n", num_pins);
+ }
- dev_info(&pdev->dev, "Allocated %d MSIs\n", num_pins);
+ platform_set_drvdata(pdev, mgn_chip);
return 0;
}
--
1.7.1
next prev parent reply other threads:[~2016-03-14 6:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-14 6:45 [PATCH v2 0/2] Irq/Mbigen: fix the IO remap problem in mbigen driver MaJun
2016-03-14 6:45 ` [PATCH v2 1/2] Irq/mbigen:Change the mbigen node definition in dt binding file MaJun
2016-03-14 7:49 ` Thomas Gleixner
2016-03-15 7:35 ` majun (F)
2016-03-14 6:45 ` MaJun [this message]
2016-03-14 7:44 ` [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457937907-14008-3-git-send-email-majun258@huawei.com \
--to=majun258@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox