summaryrefslogtreecommitdiff
path: root/kernel/power/wakelock.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/wakelock.c')
-rw-r--r--kernel/power/wakelock.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c
index 8f50de394d2..4fd55503e00 100644
--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -18,8 +18,11 @@
#include <linux/rbtree.h>
#include <linux/slab.h>
+#define BAD_WAKELOCK "bluetooth_timer"
+
static DEFINE_MUTEX(wakelocks_lock);
+
struct wakelock {
char *name;
struct rb_node node;
@@ -189,21 +192,31 @@ int pm_wake_lock(const char *buf)
size_t len;
int ret = 0;
- if (!capable(CAP_BLOCK_SUSPEND))
+#if 0 /* OLIO our watch is entirely controlled by us, no need for this */
+ if (!capable(CAP_BLOCK_SUSPEND)) {
+ printk ("OLIO %s error return 1, lock %s\n", __FUNCTION__, buf);
return -EPERM;
+ }
+#elif 1 /* OLIO The bluetooth stack abuses this wake lock, so don't allow it to lock */
+ if (strncmp(buf, BAD_WAKELOCK, strlen(BAD_WAKELOCK)) == 0) {
+ printk ("OLIO %s error return 1, lock %s\n", __FUNCTION__, buf);
+ return -EPERM;
+ }
+#endif
while (*str && !isspace(*str))
str++;
len = str - buf;
- if (!len)
+ if (!len) {
return -EINVAL;
-
+ }
if (*str && *str != '\n') {
/* Find out if there's a valid timeout string appended. */
ret = kstrtou64(skip_spaces(str), 10, &timeout_ns);
- if (ret)
+ if (ret) {
return -EINVAL;
+ }
}
mutex_lock(&wakelocks_lock);
@@ -235,8 +248,10 @@ int pm_wake_unlock(const char *buf)
size_t len;
int ret = 0;
+#if 0 /* OLIO our watch is entirely controlled by us, no need for this */
if (!capable(CAP_BLOCK_SUSPEND))
return -EPERM;
+#endif
len = strlen(buf);
if (!len)