* [PATCH] Input: gpio-keys - use devm_add_action_or_reset
@ 2016-06-12 14:28 Sudip Mukherjee
2016-07-03 20:38 ` Sudip Mukherjee
2016-07-06 17:57 ` Dmitry Torokhov
0 siblings, 2 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2016-06-12 14:28 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 delayed work or a timer.
Lets now use the helper devm_add_action_or_reset() and return and in
case of error the cleanup function will be called by the helper to
cancel the delayed work or to delete the timer.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
drivers/input/keyboard/gpio_keys.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 2909365..2b1d2e9 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -542,7 +542,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
* Install custom action to cancel release timer and
* workqueue item.
*/
- error = devm_add_action(&pdev->dev, gpio_keys_quiesce_key, bdata);
+ error = devm_add_action_or_reset(&pdev->dev,
+ gpio_keys_quiesce_key, bdata);
if (error) {
dev_err(&pdev->dev,
"failed to register quiesce action, error: %d\n",
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: gpio-keys - use devm_add_action_or_reset
2016-06-12 14:28 [PATCH] Input: gpio-keys - use devm_add_action_or_reset Sudip Mukherjee
@ 2016-07-03 20:38 ` Sudip Mukherjee
2016-07-06 17:57 ` Dmitry Torokhov
1 sibling, 0 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2016-07-03 20:38 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-kernel, linux-input
On Sunday 12 June 2016 03:28 PM, Sudip Mukherjee wrote:
> If devm_add_action() fails we are printing the error message and
> returning but we have already setup a delayed work or a timer.
> Lets now use the helper devm_add_action_or_reset() and return and in
> case of error the cleanup function will be called by the helper to
> cancel the delayed work or to delete the timer.
>
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
A gentle ping.
Regards
Sudip
> drivers/input/keyboard/gpio_keys.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> index 2909365..2b1d2e9 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -542,7 +542,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> * Install custom action to cancel release timer and
> * workqueue item.
> */
> - error = devm_add_action(&pdev->dev, gpio_keys_quiesce_key, bdata);
> + error = devm_add_action_or_reset(&pdev->dev,
> + gpio_keys_quiesce_key, bdata);
> if (error) {
> dev_err(&pdev->dev,
> "failed to register quiesce action, error: %d\n",
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: gpio-keys - use devm_add_action_or_reset
2016-06-12 14:28 [PATCH] Input: gpio-keys - use devm_add_action_or_reset Sudip Mukherjee
2016-07-03 20:38 ` Sudip Mukherjee
@ 2016-07-06 17:57 ` Dmitry Torokhov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2016-07-06 17:57 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: linux-kernel, linux-input
On Sun, Jun 12, 2016 at 03:28:56PM +0100, Sudip Mukherjee wrote:
> If devm_add_action() fails we are printing the error message and
> returning but we have already setup a delayed work or a timer.
> Lets now use the helper devm_add_action_or_reset() and return and in
> case of error the cleanup function will be called by the helper to
> cancel the delayed work or to delete the timer.
We do not fire up timer/work unless IRQ triggers and we register it
afterwards so there is no need to quiesce the key if adding devm ction
fails.
Thanks.
>
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
> drivers/input/keyboard/gpio_keys.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> index 2909365..2b1d2e9 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -542,7 +542,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> * Install custom action to cancel release timer and
> * workqueue item.
> */
> - error = devm_add_action(&pdev->dev, gpio_keys_quiesce_key, bdata);
> + error = devm_add_action_or_reset(&pdev->dev,
> + gpio_keys_quiesce_key, bdata);
> if (error) {
> dev_err(&pdev->dev,
> "failed to register quiesce action, error: %d\n",
> --
> 1.9.1
>
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-06 17:57 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:28 [PATCH] Input: gpio-keys - use devm_add_action_or_reset Sudip Mukherjee
2016-07-03 20:38 ` Sudip Mukherjee
2016-07-06 17:57 ` 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).