summaryrefslogtreecommitdiff
path: root/drivers/iommu/iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-10-21 23:51:37 +0200
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:15:29 -0700
commitc77e52265097c9b699da51ebc138489dc43c76f2 (patch)
treee2201ee13d06bccc94591ae54eedf9de5fb95835 /drivers/iommu/iommu.c
parent4e226b0bdfacbf81f296132866b195e8c118019e (diff)
iommu: Export and rename iommu_group_get_for_pci_dev()
Rename that function to pci_device_group() and export it, so that IOMMU drivers can use it as their device_group call-back. Change-Id: Ic54268d9854dd2eeba53ca9f9635d0287bfc7f0f Signed-off-by: Joerg Roedel <jroedel@suse.de> [pdaly@codeaurora.org Resolve minor conflicts]
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r--drivers/iommu/iommu.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 29c600a99d07..0f913f6b99cf 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -734,13 +734,17 @@ static int get_pci_alias_or_group(struct pci_dev *pdev, u16 alias, void *opaque)
* Use standard PCI bus topology, isolation features, and DMA alias quirks
* to find or create an IOMMU group for a device.
*/
-static struct iommu_group *iommu_group_get_for_pci_dev(struct pci_dev *pdev)
+struct iommu_group *pci_device_group(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct group_for_pci_data data;
struct pci_bus *bus;
struct iommu_group *group = NULL;
u64 devfns[4] = { 0 };
+ if (WARN_ON(!dev_is_pci(dev)))
+ return ERR_PTR(-EINVAL);
+
/*
* Find the upstream DMA alias for the device. A device must not
* be aliased due to topology in order to have its own IOMMU group.
@@ -830,7 +834,7 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev)
if (ops && ops->device_group)
group = ops->device_group(dev);
else if (dev_is_pci(dev))
- group = iommu_group_get_for_pci_dev(to_pci_dev(dev));
+ group = pci_device_group(dev);
if (IS_ERR(group))
return group;