Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1356968 > unrolled thread

[PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition.

Started byMaJun <majun258@huawei.com>
First post2016-03-14 07:50 +0100
Last post2016-03-14 08:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition. MaJun <majun258@huawei.com> - 2016-03-14 07:50 +0100
    Re: [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the  new mbigen node definition. Thomas Gleixner <tglx@linutronix.de> - 2016-03-14 08:50 +0100

#1356968 — [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition.

FromMaJun <majun258@huawei.com>
Date2016-03-14 07:50 +0100
Subject[PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition.
Message-ID<rcuue-8R-13@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1357015 — Re: [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition.

FromThomas Gleixner <tglx@linutronix.de>
Date2016-03-14 08:50 +0100
SubjectRe: [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition.
Message-ID<rcvqi-KB-15@gated-at.bofh.it>
In reply to#1356968
On Mon, 14 Mar 2016, MaJun wrote:

> From: Ma Jun <majun258@huawei.com>
> 
> To fix the IO remap problem, change the mbigen driver based on the
> new mbigen node definition.

Please describe what the problem is. There is no way that anyone can figure
out why that patch is required, what it fixes and how the fix is done. The
'how' should be a high level description as we can see the actual changes in
the diff.

Thanks,

	tglx

 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web