From aa0cae6ab52a7fc278ee3cc29d56cc4daa807004 Mon Sep 17 00:00:00 2001 From: Ilan Aelion Date: Fri, 10 Aug 2012 13:53:10 -0600 Subject: video: tegra: dc: disuse notifier Due to issues with rcu notifiers on secureos, modifying dc flip notifications to use a simple callback instead. Bug 1028850 Change-Id: Iebf2a6d64d7316e3df2b88444201f9f9a29698c5 Signed-off-by: Ilan Aelion Reviewed-on: http://git-master/r/123103 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Jon Mayo Reviewed-by: Terje Bergstrom Reviewed-by: Nitin Kumbhar --- drivers/misc/tegra-throughput.c | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/misc/tegra-throughput.c b/drivers/misc/tegra-throughput.c index 26573d8afc1a..366b0ecc10e6 100644 --- a/drivers/misc/tegra-throughput.c +++ b/drivers/misc/tegra-throughput.c @@ -19,7 +19,6 @@ #include #include -#include #include #include #include @@ -45,12 +44,10 @@ static void set_throughput_hint(struct work_struct *work) nvhost_scale3d_set_throughput_hint(throughput_hint); } -static int throughput_flip_notifier(struct notifier_block *nb, - unsigned long val, - void *data) +static int throughput_flip_callback(void) { - /* only register flips when a single display is active */ - if (val != 1 || multiple_app_disable) + /* only register flips when a single app is active */ + if (multiple_app_disable) return NOTIFY_DONE; else { long timediff; @@ -65,7 +62,7 @@ static int throughput_flip_notifier(struct notifier_block *nb, last_frame_time = (unsigned short) timediff; if (last_frame_time == 0) { - pr_warn("%s: notifications %lld nsec apart\n", + pr_warn("%s: flips %lld nsec apart\n", __func__, now.tv64 - last_flip.tv64); return NOTIFY_DONE; } @@ -82,10 +79,6 @@ static int throughput_flip_notifier(struct notifier_block *nb, return NOTIFY_OK; } -static struct notifier_block throughput_flip_nb = { - .notifier_call = throughput_flip_notifier, -}; - static int sync_rate; static int throughput_active_app_count; @@ -104,17 +97,15 @@ static void reset_target_frame_time(void) __func__, sync_rate, target_frame_time); } -static int notifier_initialized; +static int callback_initialized; static int throughput_open(struct inode *inode, struct file *file) { - int need_init = 0; - spin_lock(&lock); - if (!notifier_initialized) { - notifier_initialized = 1; - need_init = 1; + if (!callback_initialized) { + callback_initialized = 1; + tegra_dc_set_flip_callback(throughput_flip_callback); } throughput_active_app_count++; @@ -123,8 +114,6 @@ static int throughput_open(struct inode *inode, struct file *file) spin_unlock(&lock); - if (need_init) - tegra_dc_register_flip_notifier(&throughput_flip_nb); pr_debug("throughput_open node %p file %p\n", inode, file); @@ -133,23 +122,18 @@ static int throughput_open(struct inode *inode, struct file *file) static int throughput_release(struct inode *inode, struct file *file) { - int need_deinit = 0; - spin_lock(&lock); throughput_active_app_count--; if (throughput_active_app_count == 0) { reset_target_frame_time(); multiple_app_disable = 0; - notifier_initialized = 0; - need_deinit = 1; + callback_initialized = 0; + tegra_dc_unset_flip_callback(); } spin_unlock(&lock); - if (need_deinit) - tegra_dc_unregister_flip_notifier(&throughput_flip_nb); - pr_debug("throughput_release node %p file %p\n", inode, file); return 0; -- cgit v1.2.3