summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/Makefile2
-rw-r--r--linux-core/drm_irq.c20
-rw-r--r--linux-core/drm_lock.c12
-rw-r--r--linux-core/drm_memory.c2
-rw-r--r--linux-core/drm_sysfs.c2
-rw-r--r--linux-core/drm_ttm.c6
-rw-r--r--linux-core/nouveau_sgdma.c8
7 files changed, 33 insertions, 19 deletions
diff --git a/linux-core/Makefile b/linux-core/Makefile
index aa212cf9..66bc4f25 100644
--- a/linux-core/Makefile
+++ b/linux-core/Makefile
@@ -346,7 +346,7 @@ CONFIG_DRM_I915 := m
endif
endif
-GIT_REVISION := $(shell cd "$(DRMSRCDIR)" && git-describe --abbrev=17)
+GIT_REVISION := $(shell cd "$(DRMSRCDIR)" && git describe --abbrev=17)
ifneq ($(GIT_REVISION),)
EXTRA_CFLAGS+=-D"GIT_REVISION=\"$(GIT_REVISION)\""
endif
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c
index 800768ae..b317d863 100644
--- a/linux-core/drm_irq.c
+++ b/linux-core/drm_irq.c
@@ -841,27 +841,31 @@ static void drm_locked_tasklet_func(unsigned long data)
{
struct drm_device *dev = (struct drm_device *)data;
unsigned long irqflags;
-
+ void (*tasklet_func)(struct drm_device *);
+
spin_lock_irqsave(&dev->tasklet_lock, irqflags);
+ tasklet_func = dev->locked_tasklet_func;
+ spin_unlock_irqrestore(&dev->tasklet_lock, irqflags);
- if (!dev->locked_tasklet_func ||
+ if (!tasklet_func ||
!drm_lock_take(&dev->primary->master->lock,
DRM_KERNEL_CONTEXT)) {
- spin_unlock_irqrestore(&dev->tasklet_lock, irqflags);
return;
}
dev->primary->master->lock.lock_time = jiffies;
atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
- dev->locked_tasklet_func(dev);
+ spin_lock_irqsave(&dev->tasklet_lock, irqflags);
+ tasklet_func = dev->locked_tasklet_func;
+ dev->locked_tasklet_func = NULL;
+ spin_unlock_irqrestore(&dev->tasklet_lock, irqflags);
+
+ if (tasklet_func != NULL)
+ tasklet_func(dev);
drm_lock_free(&dev->primary->master->lock,
DRM_KERNEL_CONTEXT);
-
- dev->locked_tasklet_func = NULL;
-
- spin_unlock_irqrestore(&dev->tasklet_lock, irqflags);
}
/**
diff --git a/linux-core/drm_lock.c b/linux-core/drm_lock.c
index 59f95e4e..8dd2e5ee 100644
--- a/linux-core/drm_lock.c
+++ b/linux-core/drm_lock.c
@@ -158,6 +158,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
struct drm_lock *lock = data;
struct drm_master *master = file_priv->master;
unsigned long irqflags;
+ void (*tasklet_func)(struct drm_device *);
if (lock->context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n",
@@ -166,14 +167,11 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
}
spin_lock_irqsave(&dev->tasklet_lock, irqflags);
-
- if (dev->locked_tasklet_func) {
- dev->locked_tasklet_func(dev);
-
- dev->locked_tasklet_func = NULL;
- }
-
+ tasklet_func = dev->locked_tasklet_func;
+ dev->locked_tasklet_func = NULL;
spin_unlock_irqrestore(&dev->tasklet_lock, irqflags);
+ if (tasklet_func != NULL)
+ tasklet_func(dev);
atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]);
diff --git a/linux-core/drm_memory.c b/linux-core/drm_memory.c
index fe648933..38b93bca 100644
--- a/linux-core/drm_memory.c
+++ b/linux-core/drm_memory.c
@@ -183,7 +183,7 @@ void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
if (!(pt = kmalloc(size, GFP_KERNEL)))
return NULL;
if (oldpt && oldsize) {
- memcpy(pt, oldpt, oldsize);
+ memcpy(pt, oldpt, DRM_MIN(oldsize,size));
kfree(oldpt);
}
return pt;
diff --git a/linux-core/drm_sysfs.c b/linux-core/drm_sysfs.c
index 3b217342..f5366e8c 100644
--- a/linux-core/drm_sysfs.c
+++ b/linux-core/drm_sysfs.c
@@ -511,7 +511,7 @@ int drm_sysfs_device_add(struct drm_minor *minor)
err_out_files:
if (i > 0)
for (j = 0; j < i; j++)
- device_remove_file(&minor->kdev, &dri_attrs[i]);
+ device_remove_file(&minor->kdev, &dri_attrs[j]);
device_unregister(&minor->kdev);
err_out:
diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c
index aa137dda..054a7ce8 100644
--- a/linux-core/drm_ttm.c
+++ b/linux-core/drm_ttm.c
@@ -72,7 +72,11 @@ void drm_ttm_cache_flush(struct page *pages[], unsigned long num_pages)
return;
}
#endif
- if (drm_on_each_cpu(drm_ttm_ipi_handler, NULL, 1) != 0)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+ if (on_each_cpu(drm_ttm_ipi_handler, NULL, 1))
+#else
+ if (on_each_cpu(drm_ttm_ipi_handler, NULL, 1, 1) != 0)
+#endif
DRM_ERROR("Timed out waiting for drm cache flush.\n");
}
EXPORT_SYMBOL(drm_ttm_cache_flush);
diff --git a/linux-core/nouveau_sgdma.c b/linux-core/nouveau_sgdma.c
index cc4d5a92..739e0252 100644
--- a/linux-core/nouveau_sgdma.c
+++ b/linux-core/nouveau_sgdma.c
@@ -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);