All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for MaJun <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, majun258@huawei.com, tglx@linutronix.de,
	linux-kernel@vger.kernel.org, hpa@zytor.com
Subject: [tip:irq/urgent] irqchip/mbigen: Handle multiple device nodes in a mbigen module
Date: Mon, 21 Mar 2016 03:30:58 -0700	[thread overview]
Message-ID: <tip-ed2a1002d25ccdb6606c8ccb608524118bd30614@git.kernel.org> (raw)
In-Reply-To: <1458203641-17172-3-git-send-email-majun258@huawei.com>

Commit-ID:  ed2a1002d25ccdb6606c8ccb608524118bd30614
Gitweb:     http://git.kernel.org/tip/ed2a1002d25ccdb6606c8ccb608524118bd30614
Author:     MaJun <majun258@huawei.com>
AuthorDate: Thu, 17 Mar 2016 16:34:01 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 21 Mar 2016 11:24:11 +0100

irqchip/mbigen: Handle multiple device nodes in a mbigen module

Each mbigen device is represented as a independent platform device. If the
devices belong to the same mbigen hardware module, then the register space for
these devices is the same. That leads to a resource conflict.

The solution for this is to represent the mbigen module as a platform device
and make the mbigen devices subdevices of that. The register space is
associated to the mbigen module and therefor the resource conflict is avoided.

[ tglx: Massaged changelog, cleaned up the code and removed the silly printk ]

Signed-off-by: Ma Jun <majun258@huawei.com>
Cc: mark.rutland@arm.com
Cc: jason@lakedaemon.net
Cc: marc.zyngier@arm.com
Cc: Catalin.Marinas@arm.com
Cc: guohanjun@huawei.com
Cc: Will.Deacon@arm.com
Cc: huxinwei@huawei.com
Cc: lizefan@huawei.com
Cc: dingtianhong@huawei.com
Cc: zhaojunhua@hisilicon.com
Cc: liguozhu@hisilicon.com
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1458203641-17172-3-git-send-email-majun258@huawei.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/irqchip/irq-mbigen.c | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index 4dd3eb8..d67baa2 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -239,8 +239,11 @@ static struct irq_domain_ops mbigen_domain_ops = {
 static int mbigen_device_probe(struct platform_device *pdev)
 {
 	struct mbigen_device *mgn_chip;
-	struct resource *res;
+	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);
@@ -254,23 +257,30 @@ static int mbigen_device_probe(struct platform_device *pdev)
 	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;
 
-	domain = platform_msi_create_device_domain(&pdev->dev, num_pins,
-							mbigen_write_msg,
-							&mbigen_domain_ops,
-							mgn_chip);
+		parent = platform_bus_type.dev_root;
+		child = of_platform_device_create(np, NULL, parent);
+		if (IS_ERR(child))
+			return PTR_ERR(child);
 
-	if (!domain)
-		return -ENOMEM;
+		if (of_property_read_u32(child->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(&child->dev, num_pins,
+							   mbigen_write_msg,
+							   &mbigen_domain_ops,
+							   mgn_chip);
+		if (!domain)
+			return -ENOMEM;
+	}
 
 	platform_set_drvdata(pdev, mgn_chip);
-
-	dev_info(&pdev->dev, "Allocated %d MSIs\n", num_pins);
-
 	return 0;
 }
 

  reply	other threads:[~2016-03-21 10:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17  8:33 [PATCH v3 0/2] irqchip/mbigen: fix the IO remap problem in mbigen driver MaJun
2016-03-17  8:33 ` MaJun
2016-03-17  8:34 ` [PATCH v3 1/2] irqchip/mbigen:Change the mbigen node definition in dt binding file MaJun
2016-03-17  8:34   ` MaJun
2016-03-21 10:30   ` [tip:irq/urgent] irqchip/mbigen: Adjust DT bindings to handle multiple devices in a module tip-bot for MaJun
2016-03-17  8:34 ` [PATCH v3 2/2] irqchip/mbigen:Change the mbigen driver based on the new mbigen node definition MaJun
2016-03-17  8:34   ` MaJun
2016-03-21 10:30   ` tip-bot for MaJun [this message]
2016-03-21 10:29 ` [PATCH v3 0/2] irqchip/mbigen: fix the IO remap problem in mbigen driver Thomas Gleixner
2016-03-21 10:29   ` Thomas Gleixner
2016-03-22  3:10   ` majun (F)
2016-03-22  3:10     ` majun (F)
2016-05-05 14:49     ` Marc Zyngier
2016-05-05 14:49       ` Marc Zyngier
2016-05-06  1:12       ` majun (F)
2016-05-06  1:12         ` majun (F)
2016-05-06  7:32         ` Marc Zyngier
2016-05-06  7:32           ` Marc Zyngier
2016-05-06  9:07           ` majun (F)
2016-05-06  9:07             ` majun (F)
  -- strict thread matches above, loose matches on Subject: below --
2016-02-01 11:44 [RFC PATCH] irq/mbigen:Fix the problem of IO remap for duplicated physical address " MaJun
2016-02-01 11:57 ` Mark Rutland
2016-02-01 13:06   ` majun (F)
2016-02-01 13:25     ` Mark Rutland
2016-02-02 10:25       ` majun (F)
2016-02-02 11:43         ` Mark Rutland
2016-02-03  2:31           ` majun (F)
2016-02-03 11:16             ` Mark Rutland
2016-02-16  7:54               ` majun (F)

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=tip-ed2a1002d25ccdb6606c8ccb608524118bd30614@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=majun258@huawei.com \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.