[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191219120352.382-8-will@kernel.org>
Date: Thu, 19 Dec 2019 12:03:43 +0000
From: Will Deacon <will@...nel.org>
To: linux-kernel@...r.kernel.org, iommu@...ts.linuxfoundation.org
Cc: kernel-team@...roid.com, Will Deacon <will@...nel.org>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Jordan Crouse <jcrouse@...eaurora.org>,
John Garry <john.garry@...wei.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Saravana Kannan <saravanak@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Isaac J. Manjarres" <isaacm@...eaurora.org>,
Robin Murphy <robin.murphy@....com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Joerg Roedel <joro@...tes.org>,
Ard Biesheuvel <ardb@...nel.org>
Subject: [PATCH v4 07/16] drivers/iommu: Allow IOMMU bus ops to be unregistered
'bus_set_iommu()' allows IOMMU drivers to register their ops for a given
bus type. Unfortunately, it then doesn't allow them to be removed, which
is necessary for modular drivers to shutdown cleanly so that they can be
reloaded later on.
Allow 'bus_set_iommu()' to take a NULL 'ops' argument, which clear the
ops pointer for the selected bus_type.
Signed-off-by: Will Deacon <will@...nel.org>
---
drivers/iommu/iommu.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index bc8edf90e729..433101f0853c 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1558,6 +1558,11 @@ int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops)
{
int err;
+ if (ops == NULL) {
+ bus->iommu_ops = NULL;
+ return 0;
+ }
+
if (bus->iommu_ops != NULL)
return -EBUSY;
--
2.24.1.735.g03f4e72817-goog
Powered by blists - more mailing lists