Skip to content

Commit 4312cf7

Browse files
willdeaconjoergroedel
authored andcommitted
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@kernel.org> Tested-by: John Garry <john.garry@huawei.com> # smmu v3 Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 386dce2 commit 4312cf7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/iommu/iommu.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,11 @@ int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops)
15581558
{
15591559
int err;
15601560

1561+
if (ops == NULL) {
1562+
bus->iommu_ops = NULL;
1563+
return 0;
1564+
}
1565+
15611566
if (bus->iommu_ops != NULL)
15621567
return -EBUSY;
15631568

0 commit comments

Comments
 (0)