struct dmar_domain *domain,
                                     unsigned long nrpages, uint64_t dma_mask)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
        struct iova *iova = NULL;
 
        /* Restrict dma_mask to the width that the iommu can handle */
        iova = alloc_iova(&domain->iovad, nrpages, IOVA_PFN(dma_mask), 1);
        if (unlikely(!iova)) {
                printk(KERN_ERR "Allocating %ld-page iova for %s failed",
-                      nrpages, pci_name(pdev));
+                      nrpages, dev_name(dev));
                return NULL;
        }
 
 static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr,
                                     size_t size, int dir, u64 dma_mask)
 {
-       struct pci_dev *pdev = to_pci_dev(hwdev);
        struct dmar_domain *domain;
        phys_addr_t start_paddr;
        struct iova *iova;
        if (iova)
                __free_iova(&domain->iovad, iova);
        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;
 }
 
                             size_t size, enum dma_data_direction dir,
                             struct dma_attrs *attrs)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
        struct dmar_domain *domain;
        unsigned long start_pfn, last_pfn;
        struct iova *iova;
        last_pfn = mm_to_dma_pfn(iova->pfn_hi + 1) - 1;
 
        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);
 
                        enum dma_data_direction dir, struct dma_attrs *attrs)
 {
        int i;
-       struct pci_dev *pdev = to_pci_dev(hwdev);
        struct dmar_domain *domain;
        size_t size = 0;
        int prot = 0;
                size += aligned_nrpages(sg->offset, sg->length);
 
        iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size),
-                               pdev->dma_mask);
+                               *hwdev->dma_mask);
        if (!iova) {
                sglist->dma_length = 0;
                return 0;