nouveau: make it compile under 2.6.27
authorMaarten Maathuis <madman2003@gmail.com>
Sat, 16 Aug 2008 22:41:50 +0000 (00:41 +0200)
committerMaarten Maathuis <madman2003@gmail.com>
Sat, 16 Aug 2008 22:41:50 +0000 (00:41 +0200)
linux-core/nouveau_sgdma.c
shared-core/nouveau_object.c

index cc4d5a9..739e025 100644 (file)
@@ -48,7 +48,11 @@ nouveau_sgdma_populate(struct drm_ttm_backend *be, unsigned long num_pages,
                                                         page, o,
                                                         NV_CTXDMA_PAGE_SIZE,
                                                         PCI_DMA_BIDIRECTIONAL);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+                       if (pci_dma_mapping_error(nvbe->dev->pdev, nvbe->pagelist[d])) {
+#else
                        if (pci_dma_mapping_error(nvbe->pagelist[d])) {
+#endif
                                be->func->clear(be);
                                DRM_ERROR("pci_map_page failed\n");
                                return -EINVAL;
@@ -223,7 +227,11 @@ nouveau_sgdma_init(struct drm_device *dev)
 
        dev_priv->gart_info.sg_dummy_page =
                alloc_page(GFP_KERNEL|__GFP_DMA32);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+       set_page_locked(dev_priv->gart_info.sg_dummy_page);
+#else
        SetPageLocked(dev_priv->gart_info.sg_dummy_page);
+#endif
        dev_priv->gart_info.sg_dummy_bus =
                pci_map_page(dev->pdev, dev_priv->gart_info.sg_dummy_page, 0,
                             PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
index 894e733..07b5a39 100644 (file)
@@ -739,7 +739,12 @@ nouveau_gpuobj_dma_new(struct nouveau_channel *chan, int class,
                                                             PAGE_SIZE,
                                                             DMA_BIDIRECTIONAL);
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+                                       /* Not a 100% sure this is the right kdev in all cases. */
+                                       if (dma_mapping_error(&dev->primary->kdev, dev->sg->busaddr[idx])) {
+#else
                                        if (dma_mapping_error(dev->sg->busaddr[idx])) {
+#endif
                                                return -ENOMEM;
                                        }
                                }