Commit 207e3592 authored by David Woodhouse's avatar David Woodhouse

iommu/vt-d: Remove some pointless to_pci_dev() calls

Mostly made redundant by using dev_name() instead of pci_name(), and one
instance of using *dev->dma_mask instead of pdev->dma_mask.
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent d4b709f4
...@@ -2835,7 +2835,6 @@ static struct iova *intel_alloc_iova(struct device *dev, ...@@ -2835,7 +2835,6 @@ static struct iova *intel_alloc_iova(struct device *dev,
struct dmar_domain *domain, struct dmar_domain *domain,
unsigned long nrpages, uint64_t dma_mask) unsigned long nrpages, uint64_t dma_mask)
{ {
struct pci_dev *pdev = to_pci_dev(dev);
struct iova *iova = NULL; struct iova *iova = NULL;
/* Restrict dma_mask to the width that the iommu can handle */ /* Restrict dma_mask to the width that the iommu can handle */
...@@ -2855,7 +2854,7 @@ static struct iova *intel_alloc_iova(struct device *dev, ...@@ -2855,7 +2854,7 @@ static struct iova *intel_alloc_iova(struct device *dev,
iova = alloc_iova(&domain->iovad, nrpages, IOVA_PFN(dma_mask), 1); iova = alloc_iova(&domain->iovad, nrpages, IOVA_PFN(dma_mask), 1);
if (unlikely(!iova)) { if (unlikely(!iova)) {
printk(KERN_ERR "Allocating %ld-page iova for %s failed", printk(KERN_ERR "Allocating %ld-page iova for %s failed",
nrpages, pci_name(pdev)); nrpages, dev_name(dev));
return NULL; return NULL;
} }
...@@ -2959,7 +2958,6 @@ static int iommu_no_mapping(struct device *dev) ...@@ -2959,7 +2958,6 @@ static int iommu_no_mapping(struct device *dev)
static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr,
size_t size, int dir, u64 dma_mask) size_t size, int dir, u64 dma_mask)
{ {
struct pci_dev *pdev = to_pci_dev(hwdev);
struct dmar_domain *domain; struct dmar_domain *domain;
phys_addr_t start_paddr; phys_addr_t start_paddr;
struct iova *iova; struct iova *iova;
...@@ -3018,7 +3016,7 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, ...@@ -3018,7 +3016,7 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr,
if (iova) if (iova)
__free_iova(&domain->iovad, iova); __free_iova(&domain->iovad, iova);
printk(KERN_ERR"Device %s request: %zx@%llx dir %d --- failed\n", printk(KERN_ERR"Device %s request: %zx@%llx dir %d --- failed\n",
pci_name(pdev), size, (unsigned long long)paddr, dir); dev_name(hwdev), size, (unsigned long long)paddr, dir);
return 0; return 0;
} }
...@@ -3115,7 +3113,6 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr, ...@@ -3115,7 +3113,6 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr,
size_t size, enum dma_data_direction dir, size_t size, enum dma_data_direction dir,
struct dma_attrs *attrs) struct dma_attrs *attrs)
{ {
struct pci_dev *pdev = to_pci_dev(dev);
struct dmar_domain *domain; struct dmar_domain *domain;
unsigned long start_pfn, last_pfn; unsigned long start_pfn, last_pfn;
struct iova *iova; struct iova *iova;
...@@ -3139,7 +3136,7 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr, ...@@ -3139,7 +3136,7 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr,
last_pfn = mm_to_dma_pfn(iova->pfn_hi + 1) - 1; last_pfn = mm_to_dma_pfn(iova->pfn_hi + 1) - 1;
pr_debug("Device %s unmapping: pfn %lx-%lx\n", pr_debug("Device %s unmapping: pfn %lx-%lx\n",
pci_name(pdev), start_pfn, last_pfn); dev_name(dev), start_pfn, last_pfn);
freelist = domain_unmap(domain, start_pfn, last_pfn); freelist = domain_unmap(domain, start_pfn, last_pfn);
...@@ -3264,7 +3261,6 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne ...@@ -3264,7 +3261,6 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne
enum dma_data_direction dir, struct dma_attrs *attrs) enum dma_data_direction dir, struct dma_attrs *attrs)
{ {
int i; int i;
struct pci_dev *pdev = to_pci_dev(hwdev);
struct dmar_domain *domain; struct dmar_domain *domain;
size_t size = 0; size_t size = 0;
int prot = 0; int prot = 0;
...@@ -3288,7 +3284,7 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne ...@@ -3288,7 +3284,7 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne
size += aligned_nrpages(sg->offset, sg->length); size += aligned_nrpages(sg->offset, sg->length);
iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size), iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size),
pdev->dma_mask); *hwdev->dma_mask);
if (!iova) { if (!iova) {
sglist->dma_length = 0; sglist->dma_length = 0;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment