}
 
        if (host->cmd_flags & DMA_DATA) {
-               if (1 != pci_map_sg(host->chip->pdev, &host->req->sg, 1,
+               if (1 != dma_map_sg(&host->chip->pdev->dev, &host->req->sg, 1,
                                    host->req->data_dir == READ
-                                   ? PCI_DMA_FROMDEVICE
-                                   : PCI_DMA_TODEVICE)) {
+                                   ? DMA_FROM_DEVICE
+                                   : DMA_TO_DEVICE)) {
                        host->req->error = -ENOMEM;
                        return host->req->error;
                }
        writel(0, host->addr + DMA_CONTROL);
 
        if (host->cmd_flags & DMA_DATA) {
-               pci_unmap_sg(host->chip->pdev, &host->req->sg, 1,
+               dma_unmap_sg(&host->chip->pdev->dev, &host->req->sg, 1,
                             host->req->data_dir == READ
-                            ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE);
+                            ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
        } else {
                t_val = readl(host->addr + INT_STATUS_ENABLE);
                if (host->req->data_dir == READ)
        int pci_dev_busy = 0;
        int rc, cnt;
 
-       rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+       rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
        if (rc)
                return rc;
 
 
                goto error2;
 
        pci_set_master(pdev);
-       error = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
+       error = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
        if (error)
                goto error3;
 
        }
 
        /* This is just a precation, so don't fail */
-       dev->dummy_dma_page = pci_alloc_consistent(pdev, PAGE_SIZE,
-               &dev->dummy_dma_page_physical_address);
+       dev->dummy_dma_page = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
+               &dev->dummy_dma_page_physical_address, GFP_KERNEL);
        r592_stop_dma(dev , 0);
 
        if (request_irq(dev->irq, &r592_irq, IRQF_SHARED,
        free_irq(dev->irq, dev);
 error6:
        if (dev->dummy_dma_page)
-               pci_free_consistent(pdev, PAGE_SIZE, dev->dummy_dma_page,
+               dma_free_coherent(&pdev->dev, PAGE_SIZE, dev->dummy_dma_page,
                        dev->dummy_dma_page_physical_address);
 
        kthread_stop(dev->io_thread);
        memstick_free_host(dev->host);
 
        if (dev->dummy_dma_page)
-               pci_free_consistent(pdev, PAGE_SIZE, dev->dummy_dma_page,
+               dma_free_coherent(&pdev->dev, PAGE_SIZE, dev->dummy_dma_page,
                        dev->dummy_dma_page_physical_address);
 }