* [PATCH] input: keyboard: imx_sc_key: Use devm_add_action_or_reset() to handle all cleanups
@ 2020-03-13 6:59 ` Anson Huang
0 siblings, 0 replies; 6+ messages in thread
From: Anson Huang @ 2020-03-13 6:59 UTC (permalink / raw)
To: dmitry.torokhov, shawnguo, s.hauer, kernel, festevam, robh,
linux-input, linux-arm-kernel, linux-kernel
Cc: Linux-imx
Use devm_add_action_or_reset() to handle all cleanups of failure in
.probe and .remove, then .remove callback can be dropped.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
drivers/input/keyboard/imx_sc_key.c | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
index 2672fd4..eab5dfb 100644
--- a/drivers/input/keyboard/imx_sc_key.c
+++ b/drivers/input/keyboard/imx_sc_key.c
@@ -96,6 +96,15 @@ static void imx_sc_check_for_events(struct work_struct *work)
msecs_to_jiffies(REPEAT_INTERVAL));
}
+static void imx_sc_key_action(void *data)
+{
+ struct imx_key_drv_data *priv = data;
+
+ imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON, false);
+ imx_scu_irq_unregister_notifier(&priv->key_notifier);
+ cancel_delayed_work_sync(&priv->check_work);
+}
+
static int imx_sc_key_probe(struct platform_device *pdev)
{
struct imx_key_drv_data *priv;
@@ -146,27 +155,16 @@ static int imx_sc_key_probe(struct platform_device *pdev)
return error;
}
+ error = devm_add_action_or_reset(&pdev->dev, imx_sc_key_action, &priv);
+ if (error)
+ return error;
+
priv->key_notifier.notifier_call = imx_sc_key_notify;
error = imx_scu_irq_register_notifier(&priv->key_notifier);
- if (error) {
- imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON,
- false);
+ if (error)
dev_err(&pdev->dev, "failed to register scu notifier\n");
- return error;
- }
-
- return 0;
-}
-
-static int imx_sc_key_remove(struct platform_device *pdev)
-{
- struct imx_key_drv_data *priv = platform_get_drvdata(pdev);
-
- imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON, false);
- imx_scu_irq_unregister_notifier(&priv->key_notifier);
- cancel_delayed_work_sync(&priv->check_work);
- return 0;
+ return error;
}
static const struct of_device_id imx_sc_key_ids[] = {
@@ -181,7 +179,6 @@ static struct platform_driver imx_sc_key_driver = {
.of_match_table = imx_sc_key_ids,
},
.probe = imx_sc_key_probe,
- .remove = imx_sc_key_remove,
};
module_platform_driver(imx_sc_key_driver);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] input: keyboard: imx_sc_key: Use devm_add_action_or_reset() to handle all cleanups
@ 2020-03-13 6:59 ` Anson Huang
0 siblings, 0 replies; 6+ messages in thread
From: Anson Huang @ 2020-03-13 6:59 UTC (permalink / raw)
To: dmitry.torokhov, shawnguo, s.hauer, kernel, festevam, robh,
linux-input, linux-arm-kernel, linux-kernel
Cc: Linux-imx
Use devm_add_action_or_reset() to handle all cleanups of failure in
.probe and .remove, then .remove callback can be dropped.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
drivers/input/keyboard/imx_sc_key.c | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
index 2672fd4..eab5dfb 100644
--- a/drivers/input/keyboard/imx_sc_key.c
+++ b/drivers/input/keyboard/imx_sc_key.c
@@ -96,6 +96,15 @@ static void imx_sc_check_for_events(struct work_struct *work)
msecs_to_jiffies(REPEAT_INTERVAL));
}
+static void imx_sc_key_action(void *data)
+{
+ struct imx_key_drv_data *priv = data;
+
+ imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON, false);
+ imx_scu_irq_unregister_notifier(&priv->key_notifier);
+ cancel_delayed_work_sync(&priv->check_work);
+}
+
static int imx_sc_key_probe(struct platform_device *pdev)
{
struct imx_key_drv_data *priv;
@@ -146,27 +155,16 @@ static int imx_sc_key_probe(struct platform_device *pdev)
return error;
}
+ error = devm_add_action_or_reset(&pdev->dev, imx_sc_key_action, &priv);
+ if (error)
+ return error;
+
priv->key_notifier.notifier_call = imx_sc_key_notify;
error = imx_scu_irq_register_notifier(&priv->key_notifier);
- if (error) {
- imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON,
- false);
+ if (error)
dev_err(&pdev->dev, "failed to register scu notifier\n");
- return error;
- }
-
- return 0;
-}
-
-static int imx_sc_key_remove(struct platform_device *pdev)
-{
- struct imx_key_drv_data *priv = platform_get_drvdata(pdev);
-
- imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON, false);
- imx_scu_irq_unregister_notifier(&priv->key_notifier);
- cancel_delayed_work_sync(&priv->check_work);
- return 0;
+ return error;
}
static const struct of_device_id imx_sc_key_ids[] = {
@@ -181,7 +179,6 @@ static struct platform_driver imx_sc_key_driver = {
.of_match_table = imx_sc_key_ids,
},
.probe = imx_sc_key_probe,
- .remove = imx_sc_key_remove,
};
module_platform_driver(imx_sc_key_driver);
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH] input: keyboard: imx_sc_key: Use devm_add_action_or_reset() to handle all cleanups
2020-03-13 6:59 ` Anson Huang
@ 2020-05-13 6:08 ` Anson Huang
-1 siblings, 0 replies; 6+ messages in thread
From: Anson Huang @ 2020-05-13 6:08 UTC (permalink / raw)
To: Anson Huang, dmitry.torokhov, shawnguo, s.hauer, kernel,
festevam, robh, linux-input, linux-arm-kernel, linux-kernel
Cc: dl-linux-imx
Gentle ping...
> Subject: [PATCH] input: keyboard: imx_sc_key: Use
> devm_add_action_or_reset() to handle all cleanups
>
> Use devm_add_action_or_reset() to handle all cleanups of failure in .probe
> and .remove, then .remove callback can be dropped.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
> drivers/input/keyboard/imx_sc_key.c | 33 +++++++++++++++------------------
> 1 file changed, 15 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/input/keyboard/imx_sc_key.c
> b/drivers/input/keyboard/imx_sc_key.c
> index 2672fd4..eab5dfb 100644
> --- a/drivers/input/keyboard/imx_sc_key.c
> +++ b/drivers/input/keyboard/imx_sc_key.c
> @@ -96,6 +96,15 @@ static void imx_sc_check_for_events(struct work_struct
> *work)
> msecs_to_jiffies(REPEAT_INTERVAL));
> }
>
> +static void imx_sc_key_action(void *data) {
> + struct imx_key_drv_data *priv = data;
> +
> + imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON,
> false);
> + imx_scu_irq_unregister_notifier(&priv->key_notifier);
> + cancel_delayed_work_sync(&priv->check_work);
> +}
> +
> static int imx_sc_key_probe(struct platform_device *pdev) {
> struct imx_key_drv_data *priv;
> @@ -146,27 +155,16 @@ static int imx_sc_key_probe(struct platform_device
> *pdev)
> return error;
> }
>
> + error = devm_add_action_or_reset(&pdev->dev, imx_sc_key_action,
> &priv);
> + if (error)
> + return error;
> +
> priv->key_notifier.notifier_call = imx_sc_key_notify;
> error = imx_scu_irq_register_notifier(&priv->key_notifier);
> - if (error) {
> - imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE,
> SC_IRQ_BUTTON,
> - false);
> + if (error)
> dev_err(&pdev->dev, "failed to register scu notifier\n");
> - return error;
> - }
> -
> - return 0;
> -}
> -
> -static int imx_sc_key_remove(struct platform_device *pdev) -{
> - struct imx_key_drv_data *priv = platform_get_drvdata(pdev);
> -
> - imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON,
> false);
> - imx_scu_irq_unregister_notifier(&priv->key_notifier);
> - cancel_delayed_work_sync(&priv->check_work);
>
> - return 0;
> + return error;
> }
>
> static const struct of_device_id imx_sc_key_ids[] = { @@ -181,7 +179,6 @@
> static struct platform_driver imx_sc_key_driver = {
> .of_match_table = imx_sc_key_ids,
> },
> .probe = imx_sc_key_probe,
> - .remove = imx_sc_key_remove,
> };
> module_platform_driver(imx_sc_key_driver);
>
> --
> 2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] input: keyboard: imx_sc_key: Use devm_add_action_or_reset() to handle all cleanups
@ 2020-05-13 6:08 ` Anson Huang
0 siblings, 0 replies; 6+ messages in thread
From: Anson Huang @ 2020-05-13 6:08 UTC (permalink / raw)
To: Anson Huang, dmitry.torokhov, shawnguo, s.hauer, kernel,
festevam, robh, linux-input, linux-arm-kernel, linux-kernel
Cc: dl-linux-imx
Gentle ping...
> Subject: [PATCH] input: keyboard: imx_sc_key: Use
> devm_add_action_or_reset() to handle all cleanups
>
> Use devm_add_action_or_reset() to handle all cleanups of failure in .probe
> and .remove, then .remove callback can be dropped.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
> drivers/input/keyboard/imx_sc_key.c | 33 +++++++++++++++------------------
> 1 file changed, 15 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/input/keyboard/imx_sc_key.c
> b/drivers/input/keyboard/imx_sc_key.c
> index 2672fd4..eab5dfb 100644
> --- a/drivers/input/keyboard/imx_sc_key.c
> +++ b/drivers/input/keyboard/imx_sc_key.c
> @@ -96,6 +96,15 @@ static void imx_sc_check_for_events(struct work_struct
> *work)
> msecs_to_jiffies(REPEAT_INTERVAL));
> }
>
> +static void imx_sc_key_action(void *data) {
> + struct imx_key_drv_data *priv = data;
> +
> + imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON,
> false);
> + imx_scu_irq_unregister_notifier(&priv->key_notifier);
> + cancel_delayed_work_sync(&priv->check_work);
> +}
> +
> static int imx_sc_key_probe(struct platform_device *pdev) {
> struct imx_key_drv_data *priv;
> @@ -146,27 +155,16 @@ static int imx_sc_key_probe(struct platform_device
> *pdev)
> return error;
> }
>
> + error = devm_add_action_or_reset(&pdev->dev, imx_sc_key_action,
> &priv);
> + if (error)
> + return error;
> +
> priv->key_notifier.notifier_call = imx_sc_key_notify;
> error = imx_scu_irq_register_notifier(&priv->key_notifier);
> - if (error) {
> - imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE,
> SC_IRQ_BUTTON,
> - false);
> + if (error)
> dev_err(&pdev->dev, "failed to register scu notifier\n");
> - return error;
> - }
> -
> - return 0;
> -}
> -
> -static int imx_sc_key_remove(struct platform_device *pdev) -{
> - struct imx_key_drv_data *priv = platform_get_drvdata(pdev);
> -
> - imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON,
> false);
> - imx_scu_irq_unregister_notifier(&priv->key_notifier);
> - cancel_delayed_work_sync(&priv->check_work);
>
> - return 0;
> + return error;
> }
>
> static const struct of_device_id imx_sc_key_ids[] = { @@ -181,7 +179,6 @@
> static struct platform_driver imx_sc_key_driver = {
> .of_match_table = imx_sc_key_ids,
> },
> .probe = imx_sc_key_probe,
> - .remove = imx_sc_key_remove,
> };
> module_platform_driver(imx_sc_key_driver);
>
> --
> 2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] input: keyboard: imx_sc_key: Use devm_add_action_or_reset() to handle all cleanups
2020-03-13 6:59 ` Anson Huang
@ 2020-05-13 17:19 ` Dmitry Torokhov
-1 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2020-05-13 17:19 UTC (permalink / raw)
To: Anson Huang
Cc: shawnguo, s.hauer, kernel, festevam, robh, linux-input,
linux-arm-kernel, linux-kernel, Linux-imx
On Fri, Mar 13, 2020 at 02:59:11PM +0800, Anson Huang wrote:
> Use devm_add_action_or_reset() to handle all cleanups of failure in
> .probe and .remove, then .remove callback can be dropped.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] input: keyboard: imx_sc_key: Use devm_add_action_or_reset() to handle all cleanups
@ 2020-05-13 17:19 ` Dmitry Torokhov
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2020-05-13 17:19 UTC (permalink / raw)
To: Anson Huang
Cc: robh, shawnguo, s.hauer, linux-kernel, Linux-imx, kernel,
linux-input, festevam, linux-arm-kernel
On Fri, Mar 13, 2020 at 02:59:11PM +0800, Anson Huang wrote:
> Use devm_add_action_or_reset() to handle all cleanups of failure in
> .probe and .remove, then .remove callback can be dropped.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Applied, thank you.
--
Dmitry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-13 17:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 6:59 [PATCH] input: keyboard: imx_sc_key: Use devm_add_action_or_reset() to handle all cleanups Anson Huang
2020-03-13 6:59 ` Anson Huang
2020-05-13 6:08 ` Anson Huang
2020-05-13 6:08 ` Anson Huang
2020-05-13 17:19 ` Dmitry Torokhov
2020-05-13 17:19 ` 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.