summaryrefslogtreecommitdiff
path: root/ANDROID_3.4.5/drivers/base/sync.c
diff options
context:
space:
mode:
authorKevin2014-11-15 10:00:36 +0800
committerKevin2014-11-15 10:00:36 +0800
commit9d40ac5867b9aefe0722bc1f110b965ff294d30d (patch)
treede942df665fac4bac0d9cb7ae86910fe937b0c1a /ANDROID_3.4.5/drivers/base/sync.c
parent392e8802486cb573b916e746010e141a75f507e6 (diff)
downloadFOSSEE-netbook-kernel-source-9d40ac5867b9aefe0722bc1f110b965ff294d30d.tar.gz
FOSSEE-netbook-kernel-source-9d40ac5867b9aefe0722bc1f110b965ff294d30d.tar.bz2
FOSSEE-netbook-kernel-source-9d40ac5867b9aefe0722bc1f110b965ff294d30d.zip
add via modify part source code for wm8880 4.4 kitkat
Diffstat (limited to 'ANDROID_3.4.5/drivers/base/sync.c')
-rw-r--r--ANDROID_3.4.5/drivers/base/sync.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/ANDROID_3.4.5/drivers/base/sync.c b/ANDROID_3.4.5/drivers/base/sync.c
index 809d02b2..ac9a1af0 100644
--- a/ANDROID_3.4.5/drivers/base/sync.c
+++ b/ANDROID_3.4.5/drivers/base/sync.c
@@ -31,6 +31,19 @@
#define CREATE_TRACE_POINTS
#include <trace/events/sync.h>
+/* Remove fence from sync_fence_list before release it. -- WonderMedia */
+#define FIX_SYNC_FENCE_LIST
+
+/* Limit number of pts per fence for speed. -- WonderMedia */
+#define SYNC_PTS_MAX 256
+
+#ifdef SYNC_PTS_MAX
+#include <linux/moduleparam.h>
+int sync_pts_max = SYNC_PTS_MAX;
+module_param(sync_pts_max, int, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH);
+MODULE_PARM_DESC(sync_pts_max, "Max pts per sync fence");
+#endif
+
static void sync_fence_signal_pt(struct sync_pt *pt);
static int _sync_pt_has_signaled(struct sync_pt *pt);
static void sync_fence_free(struct kref *kref);
@@ -313,6 +326,9 @@ EXPORT_SYMBOL(sync_fence_create);
static int sync_fence_copy_pts(struct sync_fence *dst, struct sync_fence *src)
{
struct list_head *pos;
+#ifdef SYNC_PTS_MAX
+ int num_pts = 0;
+#endif
list_for_each(pos, &src->pt_list_head) {
struct sync_pt *orig_pt =
@@ -324,8 +340,16 @@ static int sync_fence_copy_pts(struct sync_fence *dst, struct sync_fence *src)
new_pt->fence = dst;
list_add(&new_pt->pt_list, &dst->pt_list_head);
- sync_pt_activate(new_pt);
+#ifdef SYNC_PTS_MAX
+ num_pts++;
+#endif
}
+#ifdef SYNC_PTS_MAX
+ if (sync_pts_max && num_pts >= sync_pts_max) {
+ printk(KERN_ERR "too many pts per sync fence! %d\n", num_pts);
+ return -ENOMEM;
+ }
+#endif
return 0;
}
@@ -356,7 +380,6 @@ static int sync_fence_merge_pts(struct sync_fence *dst, struct sync_fence *src)
new_pt->fence = dst;
list_replace(&dst_pt->pt_list,
&new_pt->pt_list);
- sync_pt_activate(new_pt);
sync_pt_free(dst_pt);
}
collapsed = true;
@@ -372,7 +395,6 @@ static int sync_fence_merge_pts(struct sync_fence *dst, struct sync_fence *src)
new_pt->fence = dst;
list_add(&new_pt->pt_list, &dst->pt_list_head);
- sync_pt_activate(new_pt);
}
}
@@ -453,7 +475,11 @@ struct sync_fence *sync_fence_merge(const char *name,
struct sync_fence *a, struct sync_fence *b)
{
struct sync_fence *fence;
+ struct list_head *pos;
int err;
+#ifdef FIX_SYNC_FENCE_LIST
+ unsigned long flags;
+#endif
fence = sync_fence_alloc(name);
if (fence == NULL)
@@ -467,6 +493,12 @@ struct sync_fence *sync_fence_merge(const char *name,
if (err < 0)
goto err;
+ list_for_each(pos, &fence->pt_list_head) {
+ struct sync_pt *pt =
+ container_of(pos, struct sync_pt, pt_list);
+ sync_pt_activate(pt);
+ }
+
/*
* signal the fence in case one of it's pts were activated before
* they were activated
@@ -477,6 +509,11 @@ struct sync_fence *sync_fence_merge(const char *name,
return fence;
err:
+#ifdef FIX_SYNC_FENCE_LIST
+ spin_lock_irqsave(&sync_fence_list_lock, flags);
+ list_del(&fence->sync_fence_list);
+ spin_unlock_irqrestore(&sync_fence_list_lock, flags);
+#endif
sync_fence_free_pts(fence);
kfree(fence);
return NULL;