nouveau: compat fix for set_page_locked().
authorPekka Paalanen <pq@iki.fi>
Sun, 2 Nov 2008 11:48:32 +0000 (13:48 +0200)
committerPekka Paalanen <pq@iki.fi>
Sun, 2 Nov 2008 11:55:23 +0000 (13:55 +0200)
The set_page_locked() function has changed its name again.
2.6.28 offers __set_page_locked() instead, which uses non-atomic
__set_bit() to do the work. In this case, offer our own
set_page_locked() using the atomic set_bit(), because I do not know
if atomic access is really necessary. Atomic behaviour is the one
previously expected.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
linux-core/drm_compat.h
linux-core/nouveau_sgdma.c

index e09be47..bc4d2e5 100644 (file)
@@ -392,4 +392,17 @@ extern struct page *drm_vm_sg_nopage(struct vm_area_struct *vma,
 #endif
 #endif
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
+#define set_page_locked SetPageLocked
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
+/*
+ * The kernel provides __set_page_locked, which uses the non-atomic
+ * __set_bit function. Let's use the atomic set_bit just in case.
+ */
+static inline void set_page_locked(struct page *page)
+{
+       set_bit(PG_locked, &page->flags);
+}
+#endif
+
 #endif
index 739e025..1163baf 100644 (file)
@@ -227,11 +227,7 @@ 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);