All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: snvs_pwrkey - use devm_add_action_or_reset
@ 2016-06-12 14:34 Sudip Mukherjee
  2016-07-03 20:37 ` Sudip Mukherjee
  2016-07-06 17:59 ` Dmitry Torokhov
  0 siblings, 2 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2016-06-12 14:34 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-kernel, linux-input, Sudip Mukherjee

If devm_add_action() fails we are printing the error message and
returning but we have already setup a timer. Lets now use the helper
devm_add_action_or_reset() and return and so in case of error the
cleanup function will be called by the helper to delete the timer.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
 drivers/input/keyboard/snvs_pwrkey.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index 24a9f59..c301419 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -150,7 +150,8 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
 	input_set_capability(input, EV_KEY, pdata->keycode);
 
 	/* input customer action to cancel release timer */
-	error = devm_add_action(&pdev->dev, imx_snvs_pwrkey_act, pdata);
+	error = devm_add_action_or_reset(&pdev->dev,
+					 imx_snvs_pwrkey_act, pdata);
 	if (error) {
 		dev_err(&pdev->dev, "failed to register remove action\n");
 		return error;
-- 
1.9.1

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

* Re: [PATCH] Input: snvs_pwrkey - use devm_add_action_or_reset
  2016-06-12 14:34 [PATCH] Input: snvs_pwrkey - use devm_add_action_or_reset Sudip Mukherjee
@ 2016-07-03 20:37 ` Sudip Mukherjee
  2016-07-06 17:59 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2016-07-03 20:37 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-kernel, linux-input

On Sunday 12 June 2016 03:34 PM, Sudip Mukherjee wrote:
> If devm_add_action() fails we are printing the error message and
> returning but we have already setup a timer. Lets now use the helper
> devm_add_action_or_reset() and return and so in case of error the
> cleanup function will be called by the helper to delete the timer.
>
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---

A gentle ping.

Regards
Sudip


>   drivers/input/keyboard/snvs_pwrkey.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
> index 24a9f59..c301419 100644
> --- a/drivers/input/keyboard/snvs_pwrkey.c
> +++ b/drivers/input/keyboard/snvs_pwrkey.c
> @@ -150,7 +150,8 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
>   	input_set_capability(input, EV_KEY, pdata->keycode);
>
>   	/* input customer action to cancel release timer */
> -	error = devm_add_action(&pdev->dev, imx_snvs_pwrkey_act, pdata);
> +	error = devm_add_action_or_reset(&pdev->dev,
> +					 imx_snvs_pwrkey_act, pdata);
>   	if (error) {
>   		dev_err(&pdev->dev, "failed to register remove action\n");
>   		return error;
>

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

* Re: [PATCH] Input: snvs_pwrkey - use devm_add_action_or_reset
  2016-06-12 14:34 [PATCH] Input: snvs_pwrkey - use devm_add_action_or_reset Sudip Mukherjee
  2016-07-03 20:37 ` Sudip Mukherjee
@ 2016-07-06 17:59 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2016-07-06 17:59 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: linux-kernel, linux-input

On Sun, Jun 12, 2016 at 03:34:21PM +0100, Sudip Mukherjee wrote:
> If devm_add_action() fails we are printing the error message and
> returning but we have already setup a timer. Lets now use the helper
> devm_add_action_or_reset() and return and so in case of error the
> cleanup function will be called by the helper to delete the timer.
> 

We set up timer, that is correct, however the timer will not run so
there is no need to stop it.

Thanks.

> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
>  drivers/input/keyboard/snvs_pwrkey.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
> index 24a9f59..c301419 100644
> --- a/drivers/input/keyboard/snvs_pwrkey.c
> +++ b/drivers/input/keyboard/snvs_pwrkey.c
> @@ -150,7 +150,8 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
>  	input_set_capability(input, EV_KEY, pdata->keycode);
>  
>  	/* input customer action to cancel release timer */
> -	error = devm_add_action(&pdev->dev, imx_snvs_pwrkey_act, pdata);
> +	error = devm_add_action_or_reset(&pdev->dev,
> +					 imx_snvs_pwrkey_act, pdata);
>  	if (error) {
>  		dev_err(&pdev->dev, "failed to register remove action\n");
>  		return error;
> -- 
> 1.9.1
> 

-- 
Dmitry

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

end of thread, other threads:[~2016-07-06 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-12 14:34 [PATCH] Input: snvs_pwrkey - use devm_add_action_or_reset Sudip Mukherjee
2016-07-03 20:37 ` Sudip Mukherjee
2016-07-06 17:59 ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.