Skip to content

Commit

Permalink
drivers/iommu: Allow IOMMU bus ops to be unregistered
Browse files Browse the repository at this point in the history
'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>
  • Loading branch information
Will Deacon authored and Joerg Roedel committed Dec 23, 2019
1 parent 386dce2 commit 4312cf7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/iommu/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 4312cf7

Please sign in to comment.