From: Joerg Roedel <joro@8bytes.org>
To: iommu@lists.linux-foundation.org
Cc: Varun.Sethi@freescale.com, linux-kernel@vger.kernel.org,
Joerg Roedel <jroedel@suse.de>
Subject: [PATCH 3/4] iommu/pamu: WARN when fsl_pamu_probe() is called more than once
Date: Wed, 9 Aug 2017 16:46:53 +0200 [thread overview]
Message-ID: <1502290014-2890-4-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1502290014-2890-1-git-send-email-joro@8bytes.org>
From: Joerg Roedel <jroedel@suse.de>
The function probes the PAMU hardware from device-tree
specifications. It initializes global variables and can thus
be only safely called once.
Add a check that that prints a warning when its called more
than once.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
drivers/iommu/fsl_pamu.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
index a34355f..9ee8e9e 100644
--- a/drivers/iommu/fsl_pamu.c
+++ b/drivers/iommu/fsl_pamu.c
@@ -42,6 +42,8 @@ struct pamu_isr_data {
static struct paace *ppaact;
static struct paace *spaact;
+static bool probed; /* Has PAMU been probed? */
+
/*
* Table for matching compatible strings, for device tree
* guts node, for QorIQ SOCs.
@@ -1033,6 +1035,9 @@ static int fsl_pamu_probe(struct platform_device *pdev)
* NOTE : All PAMUs share the same LIODN tables.
*/
+ if (WARN_ON(probed))
+ return -EBUSY;
+
pamu_regs = of_iomap(dev->of_node, 0);
if (!pamu_regs) {
dev_err(dev, "ioremap of PAMU node failed\n");
@@ -1172,6 +1177,8 @@ static int fsl_pamu_probe(struct platform_device *pdev)
setup_liodns();
+ probed = true;
+
return 0;
error_genpool:
--
2.7.4
next prev parent reply other threads:[~2017-08-09 14:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-09 14:46 [PATCH 0/4] iommu/pamu: Support generic iommu-device handles Joerg Roedel
2017-08-09 14:46 ` [PATCH 1/4] iommu/pamu: Let PAMU depend on PCI Joerg Roedel
2017-08-09 14:46 ` [PATCH 2/4] iommu/pamu: Make driver depend on CONFIG_PHYS_64BIT Joerg Roedel
2017-08-09 14:46 ` Joerg Roedel [this message]
2017-08-09 14:46 ` [PATCH 4/4] iommu/pamu: Add support for generic iommu-device Joerg Roedel
2017-08-23 12:17 ` Michael Ellerman
2017-08-23 14:21 ` Joerg Roedel
2017-08-24 2:04 ` Michael Ellerman
2017-08-24 13:04 ` Joerg Roedel
2017-08-25 11:35 ` Michael Ellerman
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=1502290014-2890-4-git-send-email-joro@8bytes.org \
--to=joro@8bytes.org \
--cc=Varun.Sethi@freescale.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jroedel@suse.de \
--cc=linux-kernel@vger.kernel.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