summaryrefslogtreecommitdiff
path: root/linux-core/drm_compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core/drm_compat.h')
-rw-r--r--linux-core/drm_compat.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h
index 88c5bb1d..585350f4 100644
--- a/linux-core/drm_compat.h
+++ b/linux-core/drm_compat.h
@@ -357,9 +357,24 @@ static inline int kobject_uevent_env(struct kobject *kobj,
#if (defined(CONFIG_X86) && defined(CONFIG_X86_32) && defined(CONFIG_HIGHMEM))
+/*
+ * pgd_offset_k() is a macro that uses the symbol init_mm,
+ * check that it is available.
+ */
+# if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) || \
+ defined(CONFIG_UNUSED_SYMBOLS))
#define DRM_KMAP_ATOMIC_PROT_PFN
extern void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type,
pgprot_t protection);
+# else
+#warning "init_mm is not available on this kernel!"
+static inline void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type,
+ pgprot_t protection)
+{
+ /* stub */
+ return NULL;
+}
+# endif /* no init_mm */
#endif
#if !defined(flush_agp_mappings)
@@ -409,4 +424,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