linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input: clps711x-keypad: Remove cond_resched() call
@ 2014-09-19  8:29 Alexander Shiyan
  2014-10-07 23:48 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2014-09-19  8:29 UTC (permalink / raw)
  To: linux-input; +Cc: Dmitry Torokhov, Alexander Shiyan

cond_resched() is not works as expected for clps711x-keypad driver
and cause runtime error.
This patch replaces this call with udelay().

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/input/keyboard/clps711x-keypad.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/keyboard/clps711x-keypad.c b/drivers/input/keyboard/clps711x-keypad.c
index 552b65c..650205d 100644
--- a/drivers/input/keyboard/clps711x-keypad.c
+++ b/drivers/input/keyboard/clps711x-keypad.c
@@ -9,13 +9,13 @@
  * (at your option) any later version.
  */
 
+#include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/input-polldev.h>
 #include <linux/module.h>
 #include <linux/of_gpio.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
-#include <linux/sched.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/mfd/syscon.h>
 #include <linux/mfd/syscon/clps711x.h>
@@ -54,9 +54,9 @@ static void clps711x_keypad_poll(struct input_polled_dev *dev)
 
 			/* Read twice for protection against fluctuations */
 			do {
-				state = gpiod_get_value_cansleep(data->desc);
-				cond_resched();
-				state1 = gpiod_get_value_cansleep(data->desc);
+				state = gpiod_get_value(data->desc);
+				udelay(5);
+				state1 = gpiod_get_value(data->desc);
 			} while (state != state1);
 
 			if (test_bit(col, data->last_state) != state) {
-- 
1.8.5.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] input: clps711x-keypad: Remove cond_resched() call
  2014-09-19  8:29 [PATCH] input: clps711x-keypad: Remove cond_resched() call Alexander Shiyan
@ 2014-10-07 23:48 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2014-10-07 23:48 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: linux-input

Hi Alexander,

On Fri, Sep 19, 2014 at 12:29:06PM +0400, Alexander Shiyan wrote:
> cond_resched() is not works as expected for clps711x-keypad driver
> and cause runtime error.
> This patch replaces this call with udelay().
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/input/keyboard/clps711x-keypad.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/keyboard/clps711x-keypad.c b/drivers/input/keyboard/clps711x-keypad.c
> index 552b65c..650205d 100644
> --- a/drivers/input/keyboard/clps711x-keypad.c
> +++ b/drivers/input/keyboard/clps711x-keypad.c
> @@ -9,13 +9,13 @@
>   * (at your option) any later version.
>   */
>  
> +#include <linux/delay.h>
>  #include <linux/input.h>
>  #include <linux/input-polldev.h>
>  #include <linux/module.h>
>  #include <linux/of_gpio.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
> -#include <linux/sched.h>
>  #include <linux/input/matrix_keypad.h>
>  #include <linux/mfd/syscon.h>
>  #include <linux/mfd/syscon/clps711x.h>
> @@ -54,9 +54,9 @@ static void clps711x_keypad_poll(struct input_polled_dev *dev)
>  
>  			/* Read twice for protection against fluctuations */
>  			do {
> -				state = gpiod_get_value_cansleep(data->desc);
> -				cond_resched();
> -				state1 = gpiod_get_value_cansleep(data->desc);
> +				state = gpiod_get_value(data->desc);
> +				udelay(5);
> +				state1 = gpiod_get_value(data->desc);

Why are you changing gpiod_get_value_cansleep() -> gpiod_get_value().
I am not saying it is incorrect, but could you give reasoning in the
changelog?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-07 23:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-19  8:29 [PATCH] input: clps711x-keypad: Remove cond_resched() call Alexander Shiyan
2014-10-07 23:48 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).