Re: [PATCH v2] input: don't call input_dev_release_keys() in resume

2013-12-06 Thread Oskar Andero
Hi Dmitry,

On 03:14 Tue 26 Nov , Dmitry Torokhov wrote:
> Hi Oskar,
> 
> On Fri, Nov 22, 2013 at 02:27:04PM +0100, Oskar Andero wrote:
> > From: Aleksej Makarov 
> > 
> > When waking up the platform by pressing a specific key, sending a
> > release on that key makes it impossible to react on the event in
> > user-space. This is fixed by moving the input_reset_device() call to
> > resume instead.
> > 
> > Cc: Dmitry Torokhov 
> > Reviewed-by: Radovan Lekanovic 
> > Signed-off-by: Aleksej Makarov 
> > Signed-off-by: Oskar Andero 
> > ---
> >  drivers/input/input.c | 11 +--
> >  1 file changed, 1 insertion(+), 10 deletions(-)
> > 
> > diff --git a/drivers/input/input.c b/drivers/input/input.c
> > index 846ccdd..511d490 100644
> > --- a/drivers/input/input.c
> > +++ b/drivers/input/input.c
> > @@ -1676,22 +1676,13 @@ static int input_dev_suspend(struct device *dev)
> >  {
> > struct input_dev *input_dev = to_input_dev(dev);
> >  
> > -   mutex_lock(_dev->mutex);
> > -
> > -   if (input_dev->users)
> > -   input_dev_toggle(input_dev, false);
> > -
> > -   mutex_unlock(_dev->mutex);
> > +   input_reset_device(input_dev);
> >  
> > return 0;
> >  }
> >  
> >  static int input_dev_resume(struct device *dev)
> >  {
> > -   struct input_dev *input_dev = to_input_dev(dev);
> > -
> > -   input_reset_device(input_dev);
> 
> We still need to restore LED state after resume. Does the patch below
> work for you?

Finally found some time to test the patch! Not much left of the initial
one though. :)

The patch works for our use-case, i.e. wake-up the phone by pressing a
key and then be able to retrieve what key was pressed.
Please note that I haven't tested the LED/sound and hibernation parts
of the patch.

Thanks,
 Oskar

> 
> Input: don't call input_dev_release_keys() in resume
> 
> From: Aleksej Makarov 
> 
> When waking up the platform by pressing a specific key, sending a
> release on that key makes it impossible to react on the event in
> user-space. This is fixed by moving the input_reset_device() call to
> resume instead.
> 
> [dmitry.torok...@gmail.com: make sure we still restore LED/sound state
> after resume, handle hibernation properly]
> 
> Signed-off-by: Aleksej Makarov 
> Signed-off-by: Oskar Andero 
> Signed-off-by: Dmitry Torokhov 
> ---
>  drivers/input/input.c |   76 
> +
>  1 file changed, 57 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 846ccdd..692435a 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -1653,35 +1653,36 @@ static void input_dev_toggle(struct input_dev *dev, 
> bool activate)
>   */
>  void input_reset_device(struct input_dev *dev)
>  {
> - mutex_lock(>mutex);
> + unsigned long flags;
>  
> - if (dev->users) {
> - input_dev_toggle(dev, true);
> + mutex_lock(>mutex);
> + spin_lock_irqsave(>event_lock, flags);
>  
> - /*
> -  * Keys that have been pressed at suspend time are unlikely
> -  * to be still pressed when we resume.
> -  */
> - spin_lock_irq(>event_lock);
> - input_dev_release_keys(dev);
> - spin_unlock_irq(>event_lock);
> - }
> + input_dev_toggle(dev, true);
> + input_dev_release_keys(dev);
>  
> + spin_unlock_irqrestore(>event_lock, flags);
>   mutex_unlock(>mutex);
>  }
>  EXPORT_SYMBOL(input_reset_device);
>  
> -#ifdef CONFIG_PM
> +#ifdef CONFIG_PM_SLEEP
>  static int input_dev_suspend(struct device *dev)
>  {
>   struct input_dev *input_dev = to_input_dev(dev);
>  
> - mutex_lock(_dev->mutex);
> + spin_lock_irq(_dev->event_lock);
>  
> - if (input_dev->users)
> - input_dev_toggle(input_dev, false);
> + /*
> +  * Keys that are pressed now are unlikely to be
> +  * still pressed when we resume.
> +  */
> + input_dev_release_keys(input_dev);
>  
> - mutex_unlock(_dev->mutex);
> + /* Turn off LEDs and sounds, if any are active. */
> + input_dev_toggle(input_dev, false);
> +
> + spin_unlock_irq(_dev->event_lock);
>  
>   return 0;
>  }
> @@ -1690,7 +1691,43 @@ static int input_dev_resume(struct device *dev)
>  {
>   struct input_dev *input_dev = to_input_dev(dev);
>  
> - input_reset_device(input_dev);
> + spin_lock_irq(_dev->event_lock);
> +
> + /* Restore state of LEDs and sounds, if any were active. */
> + input_dev_toggle(input_dev, true);
> +
> + spin_unlock_irq(_dev->event_lock);
> +
> + return 0;
> +}
> +
> +static int input_dev_freeze(struct device *dev)
> +{
> + struct input_dev *input_dev = to_input_dev(dev);
> +
> + spin_lock_irq(_dev->event_lock);
> +
> + /*
> +  * Keys that are pressed now are unlikely to be
> +  * still pressed when we resume.
> +  */
> + input_dev_release_keys(input_dev);
> +
> + spin_unlock_irq(_dev->event_lock);
> +
> + return 

Re: [PATCH v2] input: don't call input_dev_release_keys() in resume

2013-12-06 Thread Oskar Andero
Hi Dmitry,

On 03:14 Tue 26 Nov , Dmitry Torokhov wrote:
 Hi Oskar,
 
 On Fri, Nov 22, 2013 at 02:27:04PM +0100, Oskar Andero wrote:
  From: Aleksej Makarov aleksej.maka...@sonymobile.com
  
  When waking up the platform by pressing a specific key, sending a
  release on that key makes it impossible to react on the event in
  user-space. This is fixed by moving the input_reset_device() call to
  resume instead.
  
  Cc: Dmitry Torokhov dmitry.torok...@gmail.com
  Reviewed-by: Radovan Lekanovic radovan.lekano...@sonymobile.com
  Signed-off-by: Aleksej Makarov aleksej.maka...@sonymobile.com
  Signed-off-by: Oskar Andero oskar.and...@sonymobile.com
  ---
   drivers/input/input.c | 11 +--
   1 file changed, 1 insertion(+), 10 deletions(-)
  
  diff --git a/drivers/input/input.c b/drivers/input/input.c
  index 846ccdd..511d490 100644
  --- a/drivers/input/input.c
  +++ b/drivers/input/input.c
  @@ -1676,22 +1676,13 @@ static int input_dev_suspend(struct device *dev)
   {
  struct input_dev *input_dev = to_input_dev(dev);
   
  -   mutex_lock(input_dev-mutex);
  -
  -   if (input_dev-users)
  -   input_dev_toggle(input_dev, false);
  -
  -   mutex_unlock(input_dev-mutex);
  +   input_reset_device(input_dev);
   
  return 0;
   }
   
   static int input_dev_resume(struct device *dev)
   {
  -   struct input_dev *input_dev = to_input_dev(dev);
  -
  -   input_reset_device(input_dev);
 
 We still need to restore LED state after resume. Does the patch below
 work for you?

Finally found some time to test the patch! Not much left of the initial
one though. :)

The patch works for our use-case, i.e. wake-up the phone by pressing a
key and then be able to retrieve what key was pressed.
Please note that I haven't tested the LED/sound and hibernation parts
of the patch.

Thanks,
 Oskar

 
 Input: don't call input_dev_release_keys() in resume
 
 From: Aleksej Makarov aleksej.maka...@sonymobile.com
 
 When waking up the platform by pressing a specific key, sending a
 release on that key makes it impossible to react on the event in
 user-space. This is fixed by moving the input_reset_device() call to
 resume instead.
 
 [dmitry.torok...@gmail.com: make sure we still restore LED/sound state
 after resume, handle hibernation properly]
 
 Signed-off-by: Aleksej Makarov aleksej.maka...@sonymobile.com
 Signed-off-by: Oskar Andero oskar.and...@sonymobile.com
 Signed-off-by: Dmitry Torokhov dmitry.torok...@gmail.com
 ---
  drivers/input/input.c |   76 
 +
  1 file changed, 57 insertions(+), 19 deletions(-)
 
 diff --git a/drivers/input/input.c b/drivers/input/input.c
 index 846ccdd..692435a 100644
 --- a/drivers/input/input.c
 +++ b/drivers/input/input.c
 @@ -1653,35 +1653,36 @@ static void input_dev_toggle(struct input_dev *dev, 
 bool activate)
   */
  void input_reset_device(struct input_dev *dev)
  {
 - mutex_lock(dev-mutex);
 + unsigned long flags;
  
 - if (dev-users) {
 - input_dev_toggle(dev, true);
 + mutex_lock(dev-mutex);
 + spin_lock_irqsave(dev-event_lock, flags);
  
 - /*
 -  * Keys that have been pressed at suspend time are unlikely
 -  * to be still pressed when we resume.
 -  */
 - spin_lock_irq(dev-event_lock);
 - input_dev_release_keys(dev);
 - spin_unlock_irq(dev-event_lock);
 - }
 + input_dev_toggle(dev, true);
 + input_dev_release_keys(dev);
  
 + spin_unlock_irqrestore(dev-event_lock, flags);
   mutex_unlock(dev-mutex);
  }
  EXPORT_SYMBOL(input_reset_device);
  
 -#ifdef CONFIG_PM
 +#ifdef CONFIG_PM_SLEEP
  static int input_dev_suspend(struct device *dev)
  {
   struct input_dev *input_dev = to_input_dev(dev);
  
 - mutex_lock(input_dev-mutex);
 + spin_lock_irq(input_dev-event_lock);
  
 - if (input_dev-users)
 - input_dev_toggle(input_dev, false);
 + /*
 +  * Keys that are pressed now are unlikely to be
 +  * still pressed when we resume.
 +  */
 + input_dev_release_keys(input_dev);
  
 - mutex_unlock(input_dev-mutex);
 + /* Turn off LEDs and sounds, if any are active. */
 + input_dev_toggle(input_dev, false);
 +
 + spin_unlock_irq(input_dev-event_lock);
  
   return 0;
  }
 @@ -1690,7 +1691,43 @@ static int input_dev_resume(struct device *dev)
  {
   struct input_dev *input_dev = to_input_dev(dev);
  
 - input_reset_device(input_dev);
 + spin_lock_irq(input_dev-event_lock);
 +
 + /* Restore state of LEDs and sounds, if any were active. */
 + input_dev_toggle(input_dev, true);
 +
 + spin_unlock_irq(input_dev-event_lock);
 +
 + return 0;
 +}
 +
 +static int input_dev_freeze(struct device *dev)
 +{
 + struct input_dev *input_dev = to_input_dev(dev);
 +
 + spin_lock_irq(input_dev-event_lock);
 +
 + /*
 +  * Keys that are pressed now are unlikely to be
 +  * still pressed when we resume.

Re: [PATCH v2] input: don't call input_dev_release_keys() in resume

2013-11-25 Thread Dmitry Torokhov
Hi Oskar,

On Fri, Nov 22, 2013 at 02:27:04PM +0100, Oskar Andero wrote:
> From: Aleksej Makarov 
> 
> When waking up the platform by pressing a specific key, sending a
> release on that key makes it impossible to react on the event in
> user-space. This is fixed by moving the input_reset_device() call to
> resume instead.
> 
> Cc: Dmitry Torokhov 
> Reviewed-by: Radovan Lekanovic 
> Signed-off-by: Aleksej Makarov 
> Signed-off-by: Oskar Andero 
> ---
>  drivers/input/input.c | 11 +--
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 846ccdd..511d490 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -1676,22 +1676,13 @@ static int input_dev_suspend(struct device *dev)
>  {
>   struct input_dev *input_dev = to_input_dev(dev);
>  
> - mutex_lock(_dev->mutex);
> -
> - if (input_dev->users)
> - input_dev_toggle(input_dev, false);
> -
> - mutex_unlock(_dev->mutex);
> + input_reset_device(input_dev);
>  
>   return 0;
>  }
>  
>  static int input_dev_resume(struct device *dev)
>  {
> - struct input_dev *input_dev = to_input_dev(dev);
> -
> - input_reset_device(input_dev);

We still need to restore LED state after resume. Does the patch below
work for you?

Thanks.

-- 
Dmitry


Input: don't call input_dev_release_keys() in resume

From: Aleksej Makarov 

When waking up the platform by pressing a specific key, sending a
release on that key makes it impossible to react on the event in
user-space. This is fixed by moving the input_reset_device() call to
resume instead.

[dmitry.torok...@gmail.com: make sure we still restore LED/sound state
after resume, handle hibernation properly]

Signed-off-by: Aleksej Makarov 
Signed-off-by: Oskar Andero 
Signed-off-by: Dmitry Torokhov 
---
 drivers/input/input.c |   76 +
 1 file changed, 57 insertions(+), 19 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 846ccdd..692435a 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1653,35 +1653,36 @@ static void input_dev_toggle(struct input_dev *dev, 
bool activate)
  */
 void input_reset_device(struct input_dev *dev)
 {
-   mutex_lock(>mutex);
+   unsigned long flags;
 
-   if (dev->users) {
-   input_dev_toggle(dev, true);
+   mutex_lock(>mutex);
+   spin_lock_irqsave(>event_lock, flags);
 
-   /*
-* Keys that have been pressed at suspend time are unlikely
-* to be still pressed when we resume.
-*/
-   spin_lock_irq(>event_lock);
-   input_dev_release_keys(dev);
-   spin_unlock_irq(>event_lock);
-   }
+   input_dev_toggle(dev, true);
+   input_dev_release_keys(dev);
 
+   spin_unlock_irqrestore(>event_lock, flags);
mutex_unlock(>mutex);
 }
 EXPORT_SYMBOL(input_reset_device);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int input_dev_suspend(struct device *dev)
 {
struct input_dev *input_dev = to_input_dev(dev);
 
-   mutex_lock(_dev->mutex);
+   spin_lock_irq(_dev->event_lock);
 
-   if (input_dev->users)
-   input_dev_toggle(input_dev, false);
+   /*
+* Keys that are pressed now are unlikely to be
+* still pressed when we resume.
+*/
+   input_dev_release_keys(input_dev);
 
-   mutex_unlock(_dev->mutex);
+   /* Turn off LEDs and sounds, if any are active. */
+   input_dev_toggle(input_dev, false);
+
+   spin_unlock_irq(_dev->event_lock);
 
return 0;
 }
@@ -1690,7 +1691,43 @@ static int input_dev_resume(struct device *dev)
 {
struct input_dev *input_dev = to_input_dev(dev);
 
-   input_reset_device(input_dev);
+   spin_lock_irq(_dev->event_lock);
+
+   /* Restore state of LEDs and sounds, if any were active. */
+   input_dev_toggle(input_dev, true);
+
+   spin_unlock_irq(_dev->event_lock);
+
+   return 0;
+}
+
+static int input_dev_freeze(struct device *dev)
+{
+   struct input_dev *input_dev = to_input_dev(dev);
+
+   spin_lock_irq(_dev->event_lock);
+
+   /*
+* Keys that are pressed now are unlikely to be
+* still pressed when we resume.
+*/
+   input_dev_release_keys(input_dev);
+
+   spin_unlock_irq(_dev->event_lock);
+
+   return 0;
+}
+
+static int input_dev_poweroff(struct device *dev)
+{
+   struct input_dev *input_dev = to_input_dev(dev);
+
+   spin_lock_irq(_dev->event_lock);
+
+   /* Turn off LEDs and sounds, if any are active. */
+   input_dev_toggle(input_dev, false);
+
+   spin_unlock_irq(_dev->event_lock);
 
return 0;
 }
@@ -1698,7 +1735,8 @@ static int input_dev_resume(struct device *dev)
 static const struct dev_pm_ops input_dev_pm_ops = {
.suspend= input_dev_suspend,
.resume = input_dev_resume,
-  

Re: [PATCH v2] input: don't call input_dev_release_keys() in resume

2013-11-25 Thread Dmitry Torokhov
Hi Oskar,

On Fri, Nov 22, 2013 at 02:27:04PM +0100, Oskar Andero wrote:
 From: Aleksej Makarov aleksej.maka...@sonymobile.com
 
 When waking up the platform by pressing a specific key, sending a
 release on that key makes it impossible to react on the event in
 user-space. This is fixed by moving the input_reset_device() call to
 resume instead.
 
 Cc: Dmitry Torokhov dmitry.torok...@gmail.com
 Reviewed-by: Radovan Lekanovic radovan.lekano...@sonymobile.com
 Signed-off-by: Aleksej Makarov aleksej.maka...@sonymobile.com
 Signed-off-by: Oskar Andero oskar.and...@sonymobile.com
 ---
  drivers/input/input.c | 11 +--
  1 file changed, 1 insertion(+), 10 deletions(-)
 
 diff --git a/drivers/input/input.c b/drivers/input/input.c
 index 846ccdd..511d490 100644
 --- a/drivers/input/input.c
 +++ b/drivers/input/input.c
 @@ -1676,22 +1676,13 @@ static int input_dev_suspend(struct device *dev)
  {
   struct input_dev *input_dev = to_input_dev(dev);
  
 - mutex_lock(input_dev-mutex);
 -
 - if (input_dev-users)
 - input_dev_toggle(input_dev, false);
 -
 - mutex_unlock(input_dev-mutex);
 + input_reset_device(input_dev);
  
   return 0;
  }
  
  static int input_dev_resume(struct device *dev)
  {
 - struct input_dev *input_dev = to_input_dev(dev);
 -
 - input_reset_device(input_dev);

We still need to restore LED state after resume. Does the patch below
work for you?

Thanks.

-- 
Dmitry


Input: don't call input_dev_release_keys() in resume

From: Aleksej Makarov aleksej.maka...@sonymobile.com

When waking up the platform by pressing a specific key, sending a
release on that key makes it impossible to react on the event in
user-space. This is fixed by moving the input_reset_device() call to
resume instead.

[dmitry.torok...@gmail.com: make sure we still restore LED/sound state
after resume, handle hibernation properly]

Signed-off-by: Aleksej Makarov aleksej.maka...@sonymobile.com
Signed-off-by: Oskar Andero oskar.and...@sonymobile.com
Signed-off-by: Dmitry Torokhov dmitry.torok...@gmail.com
---
 drivers/input/input.c |   76 +
 1 file changed, 57 insertions(+), 19 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 846ccdd..692435a 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1653,35 +1653,36 @@ static void input_dev_toggle(struct input_dev *dev, 
bool activate)
  */
 void input_reset_device(struct input_dev *dev)
 {
-   mutex_lock(dev-mutex);
+   unsigned long flags;
 
-   if (dev-users) {
-   input_dev_toggle(dev, true);
+   mutex_lock(dev-mutex);
+   spin_lock_irqsave(dev-event_lock, flags);
 
-   /*
-* Keys that have been pressed at suspend time are unlikely
-* to be still pressed when we resume.
-*/
-   spin_lock_irq(dev-event_lock);
-   input_dev_release_keys(dev);
-   spin_unlock_irq(dev-event_lock);
-   }
+   input_dev_toggle(dev, true);
+   input_dev_release_keys(dev);
 
+   spin_unlock_irqrestore(dev-event_lock, flags);
mutex_unlock(dev-mutex);
 }
 EXPORT_SYMBOL(input_reset_device);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int input_dev_suspend(struct device *dev)
 {
struct input_dev *input_dev = to_input_dev(dev);
 
-   mutex_lock(input_dev-mutex);
+   spin_lock_irq(input_dev-event_lock);
 
-   if (input_dev-users)
-   input_dev_toggle(input_dev, false);
+   /*
+* Keys that are pressed now are unlikely to be
+* still pressed when we resume.
+*/
+   input_dev_release_keys(input_dev);
 
-   mutex_unlock(input_dev-mutex);
+   /* Turn off LEDs and sounds, if any are active. */
+   input_dev_toggle(input_dev, false);
+
+   spin_unlock_irq(input_dev-event_lock);
 
return 0;
 }
@@ -1690,7 +1691,43 @@ static int input_dev_resume(struct device *dev)
 {
struct input_dev *input_dev = to_input_dev(dev);
 
-   input_reset_device(input_dev);
+   spin_lock_irq(input_dev-event_lock);
+
+   /* Restore state of LEDs and sounds, if any were active. */
+   input_dev_toggle(input_dev, true);
+
+   spin_unlock_irq(input_dev-event_lock);
+
+   return 0;
+}
+
+static int input_dev_freeze(struct device *dev)
+{
+   struct input_dev *input_dev = to_input_dev(dev);
+
+   spin_lock_irq(input_dev-event_lock);
+
+   /*
+* Keys that are pressed now are unlikely to be
+* still pressed when we resume.
+*/
+   input_dev_release_keys(input_dev);
+
+   spin_unlock_irq(input_dev-event_lock);
+
+   return 0;
+}
+
+static int input_dev_poweroff(struct device *dev)
+{
+   struct input_dev *input_dev = to_input_dev(dev);
+
+   spin_lock_irq(input_dev-event_lock);
+
+   /* Turn off LEDs and sounds, if any are active. */
+   input_dev_toggle(input_dev, false);
+
+ 

[PATCH v2] input: don't call input_dev_release_keys() in resume

2013-11-22 Thread Oskar Andero
From: Aleksej Makarov 

When waking up the platform by pressing a specific key, sending a
release on that key makes it impossible to react on the event in
user-space. This is fixed by moving the input_reset_device() call to
resume instead.

Cc: Dmitry Torokhov 
Reviewed-by: Radovan Lekanovic 
Signed-off-by: Aleksej Makarov 
Signed-off-by: Oskar Andero 
---
 drivers/input/input.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 846ccdd..511d490 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1676,22 +1676,13 @@ static int input_dev_suspend(struct device *dev)
 {
struct input_dev *input_dev = to_input_dev(dev);
 
-   mutex_lock(_dev->mutex);
-
-   if (input_dev->users)
-   input_dev_toggle(input_dev, false);
-
-   mutex_unlock(_dev->mutex);
+   input_reset_device(input_dev);
 
return 0;
 }
 
 static int input_dev_resume(struct device *dev)
 {
-   struct input_dev *input_dev = to_input_dev(dev);
-
-   input_reset_device(input_dev);
-
return 0;
 }
 
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] input: don't call input_dev_release_keys() in resume

2013-11-22 Thread Oskar Andero
From: Aleksej Makarov aleksej.maka...@sonymobile.com

When waking up the platform by pressing a specific key, sending a
release on that key makes it impossible to react on the event in
user-space. This is fixed by moving the input_reset_device() call to
resume instead.

Cc: Dmitry Torokhov dmitry.torok...@gmail.com
Reviewed-by: Radovan Lekanovic radovan.lekano...@sonymobile.com
Signed-off-by: Aleksej Makarov aleksej.maka...@sonymobile.com
Signed-off-by: Oskar Andero oskar.and...@sonymobile.com
---
 drivers/input/input.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 846ccdd..511d490 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1676,22 +1676,13 @@ static int input_dev_suspend(struct device *dev)
 {
struct input_dev *input_dev = to_input_dev(dev);
 
-   mutex_lock(input_dev-mutex);
-
-   if (input_dev-users)
-   input_dev_toggle(input_dev, false);
-
-   mutex_unlock(input_dev-mutex);
+   input_reset_device(input_dev);
 
return 0;
 }
 
 static int input_dev_resume(struct device *dev)
 {
-   struct input_dev *input_dev = to_input_dev(dev);
-
-   input_reset_device(input_dev);
-
return 0;
 }
 
-- 
1.8.1.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] input: don't call input_dev_release_keys() in resume

2013-09-18 Thread Oskar Andero
Hii Dmitry,

On 14:09 Thu 25 Jul , Oskar Andero wrote:
> From: Aleksej Makarov 
> 
> When waking up the platform by pressing a specific key, sending a
> release on that key makes it impossible to react on the event in
> user-space. This is fixed by moving the input_reset_device() call to
> resume instead.
> 
> Cc: Dmitry Torokhov 
> Reviewed-by: Radovan Lekanovic 
> Signed-off-by: Aleksej Makarov 
> Signed-off-by: Oskar Andero 
> ---
>  drivers/input/input.c | 11 +--
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index c044699..ee3ff16 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -1676,22 +1676,13 @@ static int input_dev_suspend(struct device *dev)
>  {
>   struct input_dev *input_dev = to_input_dev(dev);
>  
> - mutex_lock(_dev->mutex);
> -
> - if (input_dev->users)
> - input_dev_toggle(input_dev, false);
> -
> - mutex_unlock(_dev->mutex);
> + input_reset_device(input_dev);
>  
>   return 0;
>  }
>  
>  static int input_dev_resume(struct device *dev)
>  {
> - struct input_dev *input_dev = to_input_dev(dev);
> -
> - input_reset_device(input_dev);
> -
>   return 0;
>  }

Sorry for bugging you with this patch again! I realize that changes to
input.c is sensitive since it's a central part of the subsystem.
However, the problem of reading input events after wake-up remains.

Does the patch make sense or do you see any potential risks with it?

Thanks,
 Oskar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] input: don't call input_dev_release_keys() in resume

2013-09-18 Thread Oskar Andero
Hii Dmitry,

On 14:09 Thu 25 Jul , Oskar Andero wrote:
 From: Aleksej Makarov aleksej.maka...@sonymobile.com
 
 When waking up the platform by pressing a specific key, sending a
 release on that key makes it impossible to react on the event in
 user-space. This is fixed by moving the input_reset_device() call to
 resume instead.
 
 Cc: Dmitry Torokhov dmitry.torok...@gmail.com
 Reviewed-by: Radovan Lekanovic radovan.lekano...@sonymobile.com
 Signed-off-by: Aleksej Makarov aleksej.maka...@sonymobile.com
 Signed-off-by: Oskar Andero oskar.and...@sonymobile.com
 ---
  drivers/input/input.c | 11 +--
  1 file changed, 1 insertion(+), 10 deletions(-)
 
 diff --git a/drivers/input/input.c b/drivers/input/input.c
 index c044699..ee3ff16 100644
 --- a/drivers/input/input.c
 +++ b/drivers/input/input.c
 @@ -1676,22 +1676,13 @@ static int input_dev_suspend(struct device *dev)
  {
   struct input_dev *input_dev = to_input_dev(dev);
  
 - mutex_lock(input_dev-mutex);
 -
 - if (input_dev-users)
 - input_dev_toggle(input_dev, false);
 -
 - mutex_unlock(input_dev-mutex);
 + input_reset_device(input_dev);
  
   return 0;
  }
  
  static int input_dev_resume(struct device *dev)
  {
 - struct input_dev *input_dev = to_input_dev(dev);
 -
 - input_reset_device(input_dev);
 -
   return 0;
  }

Sorry for bugging you with this patch again! I realize that changes to
input.c is sensitive since it's a central part of the subsystem.
However, the problem of reading input events after wake-up remains.

Does the patch make sense or do you see any potential risks with it?

Thanks,
 Oskar
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] input: don't call input_dev_release_keys() in resume

2013-07-25 Thread Oskar Andero
From: Aleksej Makarov 

When waking up the platform by pressing a specific key, sending a
release on that key makes it impossible to react on the event in
user-space. This is fixed by moving the input_reset_device() call to
resume instead.

Cc: Dmitry Torokhov 
Reviewed-by: Radovan Lekanovic 
Signed-off-by: Aleksej Makarov 
Signed-off-by: Oskar Andero 
---
 drivers/input/input.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index c044699..ee3ff16 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1676,22 +1676,13 @@ static int input_dev_suspend(struct device *dev)
 {
struct input_dev *input_dev = to_input_dev(dev);
 
-   mutex_lock(_dev->mutex);
-
-   if (input_dev->users)
-   input_dev_toggle(input_dev, false);
-
-   mutex_unlock(_dev->mutex);
+   input_reset_device(input_dev);
 
return 0;
 }
 
 static int input_dev_resume(struct device *dev)
 {
-   struct input_dev *input_dev = to_input_dev(dev);
-
-   input_reset_device(input_dev);
-
return 0;
 }
 
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] input: don't call input_dev_release_keys() in resume

2013-07-25 Thread Oskar Andero
From: Aleksej Makarov aleksej.maka...@sonymobile.com

When waking up the platform by pressing a specific key, sending a
release on that key makes it impossible to react on the event in
user-space. This is fixed by moving the input_reset_device() call to
resume instead.

Cc: Dmitry Torokhov dmitry.torok...@gmail.com
Reviewed-by: Radovan Lekanovic radovan.lekano...@sonymobile.com
Signed-off-by: Aleksej Makarov aleksej.maka...@sonymobile.com
Signed-off-by: Oskar Andero oskar.and...@sonymobile.com
---
 drivers/input/input.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index c044699..ee3ff16 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1676,22 +1676,13 @@ static int input_dev_suspend(struct device *dev)
 {
struct input_dev *input_dev = to_input_dev(dev);
 
-   mutex_lock(input_dev-mutex);
-
-   if (input_dev-users)
-   input_dev_toggle(input_dev, false);
-
-   mutex_unlock(input_dev-mutex);
+   input_reset_device(input_dev);
 
return 0;
 }
 
 static int input_dev_resume(struct device *dev)
 {
-   struct input_dev *input_dev = to_input_dev(dev);
-
-   input_reset_device(input_dev);
-
return 0;
 }
 
-- 
1.8.1.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/