int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info)
 {
        struct drm_sg_mem *entry = dev->sg;
+       struct pci_dev *pdev = to_pci_dev(dev->dev);
        unsigned long pages;
        int i;
        int max_pages;
                for (i = 0; i < pages; i++) {
                        if (!entry->busaddr[i])
                                break;
-                       pci_unmap_page(dev->pdev, entry->busaddr[i],
-                                        PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+                       pci_unmap_page(pdev, entry->busaddr[i], PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
                }
 
                if (gart_info->gart_table_location == DRM_ATI_GART_MAIN)
 {
        struct drm_local_map *map = &gart_info->mapping;
        struct drm_sg_mem *entry = dev->sg;
+       struct pci_dev *pdev = to_pci_dev(dev->dev);
        void *address = NULL;
        unsigned long pages;
        u32 *pci_gart = NULL, page_base, gart_idx;
        if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
                DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
 
-               if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) {
+               if (pci_set_dma_mask(pdev, gart_info->table_mask)) {
                        DRM_ERROR("fail to set dma mask to 0x%Lx\n",
                                  (unsigned long long)gart_info->table_mask);
                        ret = -EFAULT;
        gart_idx = 0;
        for (i = 0; i < pages; i++) {
                /* we need to support large memory configurations */
-               entry->busaddr[i] = pci_map_page(dev->pdev, entry->pagelist[i],
+               entry->busaddr[i] = pci_map_page(pdev, entry->pagelist[i],
                                                 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
-               if (pci_dma_mapping_error(dev->pdev, entry->busaddr[i])) {
+               if (pci_dma_mapping_error(pdev, entry->busaddr[i])) {
                        DRM_ERROR("unable to map PCIGART pages!\n");
                        drm_ati_pcigart_cleanup(dev, gart_info);
                        address = NULL;