aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2011-12-24 17:35:30 +0700
committerPawit Pornkitprasan <p.pawit@gmail.com>2011-12-24 17:35:30 +0700
commitae000bca1031feae89ed22edda05b4183427cc95 (patch)
tree36f2874b841b5aac00ab7f16e72746f7ca944f22 /drivers/input
parent10e7cd96cd7e4808b71d34c1c637d17772c282e5 (diff)
downloadkernel_samsung_aries-ae000bca1031feae89ed22edda05b4183427cc95.zip
kernel_samsung_aries-ae000bca1031feae89ed22edda05b4183427cc95.tar.gz
kernel_samsung_aries-ae000bca1031feae89ed22edda05b4183427cc95.tar.bz2
cypress-touchkey: Improve semaphore
Diffstat (limited to 'drivers/input')
-rwxr-xr-xdrivers/input/keyboard/cypress-touchkey.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/input/keyboard/cypress-touchkey.c b/drivers/input/keyboard/cypress-touchkey.c
index 3055d5b..7972f27 100755
--- a/drivers/input/keyboard/cypress-touchkey.c
+++ b/drivers/input/keyboard/cypress-touchkey.c
@@ -259,11 +259,11 @@ static irqreturn_t touchkey_interrupt_handler(int irq, void *touchkey_devdata)
}
static void notify_led_on(void) {
- if (unlikely(bl_devdata->is_dead) || bl_on)
- return;
-
down(&enable_sem);
+ if (unlikely(bl_devdata->is_dead) || bl_on)
+ goto out;
+
if (bl_devdata->is_sleeping) {
bl_devdata->pdata->touchkey_sleep_onoff(TOUCHKEY_ON);
bl_devdata->pdata->touchkey_onoff(TOUCHKEY_ON);
@@ -271,18 +271,19 @@ static void notify_led_on(void) {
i2c_touchkey_write_byte(bl_devdata, bl_devdata->backlight_on);
bl_on = 1;
- up(&enable_sem);
-
printk(KERN_DEBUG "%s: notification led enabled\n", __FUNCTION__);
+
+out:
+ up(&enable_sem);
}
static void notify_led_off(void) {
- if (unlikely(bl_devdata->is_dead) || !bl_on)
- return;
-
// Avoid race condition with touch key resume
down(&enable_sem);
+ if (unlikely(bl_devdata->is_dead) || !bl_on)
+ goto out;
+
if (bl_on && bl_timer.expires < jiffies) // Don't disable if there's a timer scheduled
i2c_touchkey_write_byte(bl_devdata, bl_devdata->backlight_off);
@@ -292,9 +293,10 @@ static void notify_led_off(void) {
bl_on = 0;
- up(&enable_sem);
-
printk(KERN_DEBUG "%s: notification led disabled\n", __FUNCTION__);
+
+out:
+ up(&enable_sem);
}
#ifdef CONFIG_HAS_EARLYSUSPEND
@@ -308,8 +310,7 @@ static void cypress_touchkey_early_suspend(struct early_suspend *h)
devdata->is_powering_on = true;
if (unlikely(devdata->is_dead)) {
- up(&enable_sem);
- return;
+ goto out;
}
disable_irq(devdata->client->irq);
@@ -320,6 +321,7 @@ static void cypress_touchkey_early_suspend(struct early_suspend *h)
all_keys_up(devdata);
devdata->is_sleeping = true;
+out:
up(&enable_sem);
}