summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2008-02-05 10:10:36 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2008-02-05 10:10:36 +0000
commit7cc825f5946659ad586fd4aa4fd867a1373f3373 (patch)
treed87f4a6961d15c857d9fab00bcfd6a0bea51af53
parentc9772f8c037667ed3586337f90904e7978f8ab14 (diff)
Add missing round_jiffies_relative() for older kernels
-rw-r--r--linux-core/ati_pcigart.c3
-rw-r--r--linux-core/drm_compat.c35
-rw-r--r--linux-core/drm_compat.h4
3 files changed, 41 insertions, 1 deletions
diff --git a/linux-core/ati_pcigart.c b/linux-core/ati_pcigart.c
index c669067b..97a5dfb2 100644
--- a/linux-core/ati_pcigart.c
+++ b/linux-core/ati_pcigart.c
@@ -274,7 +274,8 @@ static int ati_pcigart_needs_unbind_cache_adjust(struct drm_ttm_backend *backend
static int ati_pcigart_populate(struct drm_ttm_backend *backend,
unsigned long num_pages,
- struct page **pages)
+ struct page **pages,
+ struct page *dummy_page)
{
ati_pcigart_ttm_backend_t *atipci_be =
container_of(backend, ati_pcigart_ttm_backend_t, backend);
diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c
index a745a7d9..cd4ff7df 100644
--- a/linux-core/drm_compat.c
+++ b/linux-core/drm_compat.c
@@ -729,3 +729,38 @@ void *idr_replace(struct idr *idp, void *ptr, int id)
}
EXPORT_SYMBOL(idr_replace);
#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static __inline__ unsigned long __round_jiffies(unsigned long j, int cpu)
+{
+ int rem;
+ unsigned long original = j;
+
+ j += cpu * 3;
+
+ rem = j % HZ;
+
+ if (rem < HZ/4) /* round down */
+ j = j - rem;
+ else /* round up */
+ j = j - rem + HZ;
+
+ /* now that we have rounded, subtract the extra skew again */
+ j -= cpu * 3;
+
+ if (j <= jiffies) /* rounding ate our timeout entirely; */
+ return original;
+ return j;
+}
+
+static __inline__ unsigned long __round_jiffies_relative(unsigned long j, int cpu)
+{
+ return __round_jiffies(j + jiffies, cpu) - jiffies;
+}
+
+unsigned long round_jiffies_relative(unsigned long j)
+{
+ return __round_jiffies_relative(j, raw_smp_processor_id());
+}
+EXPORT_SYMBOL(round_jiffies_relative);
+#endif
diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h
index c3a70486..92dcbc21 100644
--- a/linux-core/drm_compat.h
+++ b/linux-core/drm_compat.h
@@ -331,4 +331,8 @@ void idr_remove_all(struct idr *idp);
void *idr_replace(struct idr *idp, void *ptr, int id);
#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+extern unsigned long round_jiffies_relative(unsigned long j);
+#endif
+
#endif