iommu/vt-d: Refactor device_to_iommu() helper
authorLu Baolu <baolu.lu@linux.intel.com>
Fri, 24 Jul 2020 01:49:21 +0000 (09:49 +0800)
committerJoerg Roedel <jroedel@suse.de>
Fri, 24 Jul 2020 08:51:21 +0000 (10:51 +0200)
commitdd6692f1b883bac46036000a1e3a0b3785f89e87
treec3942f412660c1581d5ae51995298b59854760ff
parentd315e9e684d1efd4cb2e8cd70b8d71dec02fcf1f
iommu/vt-d: Refactor device_to_iommu() helper

It is refactored in two ways:

- Make it global so that it could be used in other files.

- Make bus/devfn optional so that callers could ignore these two returned
values when they only want to get the coresponding iommu pointer.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20200724014925.15523-9-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel/iommu.c
drivers/iommu/intel/svm.c
include/linux/intel-iommu.h